Add ability to sort forks. #2406

This commit is contained in:
Rubén Dávila 2016-01-14 19:58:57 -05:00
parent af501845dd
commit 40e1ad9052
2 changed files with 7 additions and 4 deletions

View file

@ -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

View file

@ -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