diff options
author | Josh Frye <joshfng@gmail.com> | 2016-02-04 00:33:01 +0300 |
---|---|---|
committer | Josh Frye <joshfng@gmail.com> | 2016-02-04 19:40:19 +0300 |
commit | 7522ac0b3cf4a777fda5dce3baa699970e5133a6 (patch) | |
tree | 79055e852a8f3e0d3da01514e352207d3e533cd3 /app/controllers/dashboard | |
parent | 87b61db7ed6b782423397626b6ea414c43f24a15 (diff) |
Paginate + ajax filter dashboard projects
Diffstat (limited to 'app/controllers/dashboard')
-rw-r--r-- | app/controllers/dashboard/projects_controller.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/app/controllers/dashboard/projects_controller.rb b/app/controllers/dashboard/projects_controller.rb index a205ab7d34a..2f56228ff75 100644 --- a/app/controllers/dashboard/projects_controller.rb +++ b/app/controllers/dashboard/projects_controller.rb @@ -5,6 +5,13 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController @projects = current_user.authorized_projects.sorted_by_activity.non_archived @projects = @projects.sort(@sort = params[:sort]) @projects = @projects.includes(:namespace) + + terms = params['filter_projects'] + + if terms.present? + @projects = @projects.search(terms) + end + @projects = @projects.page(params[:page]).per(PER_PAGE) @last_push = current_user.recent_push @@ -15,6 +22,11 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController load_events render layout: false end + format.json do + render json: { + html: view_to_html_string("dashboard/projects/projects", locals: { projects: @projects }) + } + end end end |