BigW Consortium Gitlab

Commit 50b89fc5 by Robert Speicher

Merge branch 'tags-sort-default' into 'master'

Fixed tags sort dropdown being empty Closes #31618 See merge request !11055
parents 37b1b14a fdacc4ee
......@@ -70,6 +70,14 @@ module SortingHelper
}
end
def tags_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
......
- @no_container = true
- @sort ||= sort_value_recently_updated
- page_title "Tags"
= render "projects/commits/head"
......@@ -14,16 +15,14 @@
.dropdown
%button.dropdown-toggle{ type: 'button', data: { toggle: 'dropdown'} }
%span.light
= projects_sort_options_hash[@sort]
= tags_sort_options_hash[@sort]
= icon('chevron-down')
%ul.dropdown-menu.dropdown-menu-align-right
%li
= link_to filter_tags_path(sort: sort_value_name) do
= sort_title_name
= link_to filter_tags_path(sort: sort_value_recently_updated) do
= sort_title_recently_updated
= link_to filter_tags_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
- tags_sort_options_hash.each do |value, title|
%li
= link_to title, filter_tags_path(sort: value), class: ("is-active" if @sort == value)
- if can?(current_user, :push_code, @project)
= link_to new_namespace_project_tag_path(@project.namespace, @project), class: 'btn btn-create new-tag-btn' do
New tag
......
---
title: Fixed tags sort from defaulting to empty
merge_request:
author:
require 'spec_helper'
describe 'projects/tags/index', :view do
let(:project) { create(:project) }
before do
assign(:project, project)
assign(:repository, project.repository)
assign(:tags, [])
allow(view).to receive(:current_ref).and_return('master')
allow(view).to receive(:can?).and_return(false)
end
it 'defaults sort dropdown toggle to last updated' do
render
expect(rendered).to have_button('Last updated')
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment