diff options
author | Josh Frye <joshfng@gmail.com> | 2016-02-05 14:33:24 -0500 |
---|---|---|
committer | Josh Frye <joshfng@gmail.com> | 2016-02-09 10:10:41 -0500 |
commit | 30e022a2feec7450c4173038d3fdfef0d6242953 (patch) | |
tree | 6a145d62527573a381072710fc17ec5785cf7954 /app/controllers | |
parent | 0dc64a8ce1e9bde993ea7a862c71d7edaa69a286 (diff) | |
download | gitlab-ce-30e022a2feec7450c4173038d3fdfef0d6242953.tar.gz |
Starred, All, and Trending on explore are paged also group projects. Need ajax filter.
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/explore/projects_controller.rb | 30 | ||||
-rw-r--r-- | app/controllers/groups_controller.rb | 11 |
2 files changed, 39 insertions, 2 deletions
diff --git a/app/controllers/explore/projects_controller.rb b/app/controllers/explore/projects_controller.rb index 2689bf4f1ec..317ad835006 100644 --- a/app/controllers/explore/projects_controller.rb +++ b/app/controllers/explore/projects_controller.rb @@ -6,19 +6,49 @@ class Explore::ProjectsController < Explore::ApplicationController @projects = @projects.where(visibility_level: params[:visibility_level]) if params[:visibility_level].present? @projects = @projects.non_archived @projects = @projects.search(params[:search]) if params[:search].present? + @projects = @projects.search(params[:filter_projects]) if params[:filter_projects].present? @projects = @projects.sort(@sort = params[:sort]) @projects = @projects.includes(:namespace).page(params[:page]).per(PER_PAGE) + + respond_to do |format| + format.html + format.json do + render json: { + html: view_to_html_string("dashboard/projects/_projects", locals: { projects: @projects }) + } + end + end end def trending @projects = TrendingProjectsFinder.new.execute(current_user) @projects = @projects.non_archived + @projects = @projects.search(params[:filter_projects]) if params[:filter_projects].present? @projects = @projects.page(params[:page]).per(PER_PAGE) + + respond_to do |format| + format.html + format.json do + render json: { + html: view_to_html_string("dashboard/projects/_projects", locals: { projects: @projects }) + } + end + end end def starred @projects = ProjectsFinder.new.execute(current_user) + @projects = @projects.search(params[:filter_projects]) if params[:filter_projects].present? @projects = @projects.reorder('star_count DESC') @projects = @projects.page(params[:page]).per(PER_PAGE) + + respond_to do |format| + format.html + format.json do + render json: { + html: view_to_html_string("dashboard/projects/_projects", locals: { projects: @projects }) + } + end + end end end diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index 90475c17c17..b4dd0021ed7 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -41,14 +41,21 @@ class GroupsController < Groups::ApplicationController def show @last_push = current_user.recent_push if current_user @projects = @projects.includes(:namespace) + @projects = @projects.search(params[:filter_projects]) if params[:filter_projects].present? @projects = @projects.page(params[:page]).per(PER_PAGE) respond_to do |format| format.html format.json do - load_events - pager_json("events/_events", @events.count) + if params[:filter_projects] + render json: { + html: view_to_html_string("dashboard/projects/_projects", locals: { projects: @projects }) + } + else + load_events + pager_json("events/_events", @events.count) + end end format.atom do |