diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2016-03-03 15:09:58 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2016-03-03 15:09:58 +0300 |
commit | 7455d950bcd0152ee30c024a30a652886970ac3f (patch) | |
tree | c8aded95124437644a8f32b9370000fc11360c93 /app/controllers/projects/forks_controller.rb | |
parent | 7e710acc1c72de7d11ad393ee3e111e250e0cb66 (diff) |
Refactor projects list
1. Fix double bottom border if pagination
2. Fix broken search on forks page
4. Remove duplicate js logic
4. Remove unused show all link
5. Remove duplicate “no project” message in different views
After this merge request you can easily render shared projects template
with all necessary html/js included to make searchable list with
pagination. All you need to provide is controller that returns
projects list with seach nad pagination and render html form with
project-filter-form id and text field with filter_projects name.
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/controllers/projects/forks_controller.rb')
-rw-r--r-- | app/controllers/projects/forks_controller.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/controllers/projects/forks_controller.rb b/app/controllers/projects/forks_controller.rb index a0835c9aad0..72f3fbd04b4 100644 --- a/app/controllers/projects/forks_controller.rb +++ b/app/controllers/projects/forks_controller.rb @@ -19,7 +19,18 @@ class Projects::ForksController < Projects::ApplicationController @public_forks_count = @total_forks_count - @private_forks_count @sort = params[:sort] || 'id_desc' + @forks = @forks.search(params[:filter_projects]) if params[:filter_projects].present? @forks = @forks.order_by(@sort).page(params[:page]).per(PER_PAGE) + + respond_to do |format| + format.html + + format.json do + render json: { + html: view_to_html_string("projects/forks/_projects", projects: @forks) + } + end + end end def new |