diff --git a/app/controllers/projects/forks_controller.rb b/app/controllers/projects/forks_controller.rb index bcb64479cbf8202fdedb012f7ca769d21c10fc15..f6fabba26f92046fbd17ee8f8cbe16ac3bc1f114 100644 --- a/app/controllers/projects/forks_controller.rb +++ b/app/controllers/projects/forks_controller.rb @@ -5,6 +5,8 @@ class Projects::ForksController < Projects::ApplicationController def index @all_forks = project.forks.includes(:creator) + @all_forks = @all_forks.sort(params[:sort]) if params[:sort] + @public_forks, @protected_forks = @all_forks.partition do |project| can?(current_user, :read_project, project) end diff --git a/app/views/projects/forks/index.html.haml b/app/views/projects/forks/index.html.haml index 24efc7b3097a0d1d79baeb406a07eda27d490c5b..10ab5c44af183cf7f7ee5bfa9549e617bee74819 100644 --- a/app/views/projects/forks/index.html.haml +++ b/app/views/projects/forks/index.html.haml @@ -20,13 +20,14 @@ %b.caret %ul.dropdown-menu.dropdown-menu-align-right %li - = link_to page_filter_path(sort: sort_value_recently_created) do + - excluded_filters = [:state, :scope, :label_name, :milestone_id, :assignee_id, :author_id] + = link_to page_filter_path(sort: sort_value_recently_created, without: excluded_filters) do = sort_title_recently_created - = link_to page_filter_path(sort: sort_value_oldest_created) do + = link_to page_filter_path(sort: sort_value_oldest_created, without: excluded_filters) do = sort_title_oldest_created - = link_to page_filter_path(sort: sort_value_recently_updated) do + = link_to page_filter_path(sort: sort_value_recently_updated, without: excluded_filters) do = sort_title_recently_updated - = link_to page_filter_path(sort: sort_value_oldest_updated) do + = link_to page_filter_path(sort: sort_value_oldest_updated, without: excluded_filters) do = sort_title_oldest_updated .fork_link.inline