summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2017-04-18 13:48:52 +0100
committerPhil Hughes <me@iamphill.com>2017-04-18 13:48:52 +0100
commit476fc19743291bb34a050d380c06a5aef5926cb0 (patch)
tree31b51cd34111c22e215491f4ff74c0971a625de4
parent00c1e31c1c3a5631b85a0f2be1389d0c87be376c (diff)
downloadgitlab-ce-branches-sort-toggle-empty.tar.gz
Fixed branches sort toggle being emptybranches-sort-toggle-empty
Closes #30950
-rw-r--r--app/helpers/sorting_helper.rb8
-rw-r--r--app/views/projects/branches/index.html.haml16
2 files changed, 15 insertions, 9 deletions
diff --git a/app/helpers/sorting_helper.rb b/app/helpers/sorting_helper.rb
index 3a5d1b97c36..2fda98cae90 100644
--- a/app/helpers/sorting_helper.rb
+++ b/app/helpers/sorting_helper.rb
@@ -62,6 +62,14 @@ module SortingHelper
}
end
+ def branches_sort_options_hash
+ {
+ sort_value_name => sort_title_name,
+ sort_value_recently_updated => sort_title_recently_updated,
+ sort_value_oldest_updated => sort_title_oldest_updated
+ }
+ end
+
def sort_title_priority
'Priority'
end
diff --git a/app/views/projects/branches/index.html.haml b/app/views/projects/branches/index.html.haml
index bd1f2d96f56..91b86280e4c 100644
--- a/app/views/projects/branches/index.html.haml
+++ b/app/views/projects/branches/index.html.haml
@@ -15,16 +15,14 @@
.dropdown.inline>
%button.dropdown-menu-toggle{ type: 'button', 'data-toggle' => 'dropdown' }
%span.light
- = projects_sort_options_hash[@sort]
+ = branches_sort_options_hash[@sort]
= icon('chevron-down')
- %ul.dropdown-menu.dropdown-menu-align-right
- %li
- = link_to filter_branches_path(sort: sort_value_name) do
- = sort_title_name
- = link_to filter_branches_path(sort: sort_value_recently_updated) do
- = sort_title_recently_updated
- = link_to filter_branches_path(sort: sort_value_oldest_updated) do
- = sort_title_oldest_updated
+ %ul.dropdown-menu.dropdown-menu-align-right.dropdown-menu-selectable
+ %li.dropdown-header
+ Sort by
+ - branches_sort_options_hash.each do |value, title|
+ %li
+ = link_to title, filter_branches_path(sort: value), class: ("is-active" if @sort == value)
- if can? current_user, :push_code, @project
= link_to namespace_project_merged_branches_path(@project.namespace, @project), class: 'btn btn-inverted btn-remove has-tooltip', title: "Delete all branches that are merged into '#{@project.repository.root_ref}'", method: :delete, data: { confirm: "Deleting the merged branches cannot be undone. Are you sure?", container: 'body' } do