Add ability to sort forks. #2406
This commit is contained in:
parent
af501845dd
commit
40e1ad9052
2 changed files with 7 additions and 4 deletions
|
@ -5,6 +5,8 @@ class Projects::ForksController < Projects::ApplicationController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@all_forks = project.forks.includes(:creator)
|
@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|
|
@public_forks, @protected_forks = @all_forks.partition do |project|
|
||||||
can?(current_user, :read_project, project)
|
can?(current_user, :read_project, project)
|
||||||
end
|
end
|
||||||
|
|
|
@ -20,13 +20,14 @@
|
||||||
%b.caret
|
%b.caret
|
||||||
%ul.dropdown-menu.dropdown-menu-align-right
|
%ul.dropdown-menu.dropdown-menu-align-right
|
||||||
%li
|
%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
|
= 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
|
= 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
|
= 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
|
= sort_title_oldest_updated
|
||||||
|
|
||||||
.fork_link.inline
|
.fork_link.inline
|
||||||
|
|
Loading…
Reference in a new issue