Commit 974b5a7b authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Most starred projects page for Explore area

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 76af5a1d
...@@ -16,4 +16,10 @@ class Explore::ProjectsController < ApplicationController ...@@ -16,4 +16,10 @@ class Explore::ProjectsController < ApplicationController
@trending_projects = TrendingProjectsFinder.new.execute(current_user) @trending_projects = TrendingProjectsFinder.new.execute(current_user)
@trending_projects = @trending_projects.page(params[:page]).per(10) @trending_projects = @trending_projects.page(params[:page]).per(10)
end end
def starred
@starred_projects = ProjectsFinder.new.execute(current_user)
@starred_projects = @starred_projects.order('star_count DESC')
@starred_projects = @starred_projects.page(params[:page]).per(10)
end
end end
...@@ -4,6 +4,10 @@ ...@@ -4,6 +4,10 @@
= visibility_level_icon(project.visibility_level) = visibility_level_icon(project.visibility_level)
= link_to project.name_with_namespace, project = link_to project.name_with_namespace, project
- if current_page?(starred_explore_projects_path)
%strong.pull-right
= pluralize project.star_count, 'star'
- if project.description.present? - if project.description.present?
%p.project-description.str-truncated %p.project-description.str-truncated
= project.description = project.description
...@@ -17,4 +21,5 @@ ...@@ -17,4 +21,5 @@
= link_to pluralize(project.repository.tag_names.count, 'tag'), project_tags_path(project) = link_to pluralize(project.repository.tag_names.count, 'tag'), project_tags_path(project)
- else - else
%i.icon-warning-sign %i.icon-warning-sign
Empty repository Empty repository
.explore-trending-block
%p.lead
%i.icon-comments-alt
See most starred projects
%hr
.public-projects
%ul.bordered-list
= render @starred_projects
= paginate @starred_projects, theme: 'gitlab'
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
%ul.nav.nav-tabs %ul.nav.nav-tabs
= nav_link(path: 'projects#trending') do = nav_link(path: 'projects#trending') do
= link_to 'Trending Projects', explore_root_path = link_to 'Trending Projects', explore_root_path
= nav_link(path: 'projects#starred') do
= link_to 'Most Starred Projects', starred_explore_projects_path
= nav_link(path: 'projects#index') do = nav_link(path: 'projects#index') do
= link_to 'All Projects', explore_projects_path = link_to 'All Projects', explore_projects_path
= nav_link(controller: :groups) do = nav_link(controller: :groups) do
......
...@@ -53,6 +53,7 @@ Gitlab::Application.routes.draw do ...@@ -53,6 +53,7 @@ Gitlab::Application.routes.draw do
resources :projects, only: [:index] do resources :projects, only: [:index] do
collection do collection do
get :trending get :trending
get :starred
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment