diff options
author | Josh Frye <joshfng@gmail.com> | 2016-02-05 22:33:24 +0300 |
---|---|---|
committer | Josh Frye <joshfng@gmail.com> | 2016-02-09 18:10:41 +0300 |
commit | 30e022a2feec7450c4173038d3fdfef0d6242953 (patch) | |
tree | 6a145d62527573a381072710fc17ec5785cf7954 /app/controllers/explore | |
parent | 0dc64a8ce1e9bde993ea7a862c71d7edaa69a286 (diff) |
Starred, All, and Trending on explore are paged also group projects. Need ajax filter.
Diffstat (limited to 'app/controllers/explore')
-rw-r--r-- | app/controllers/explore/projects_controller.rb | 30 |
1 files changed, 30 insertions, 0 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 |