From f8fdf93ec94b1ad43141a1463a6793082750d86e Mon Sep 17 00:00:00 2001 From: George Tsiolis Date: Fri, 7 Dec 2018 13:47:26 +0000 Subject: [PATCH] Show primary button when all labels are prioritized --- app/views/projects/labels/index.html.haml | 2 +- ...ary-button-when-all-labels-are-prioritized.yml | 5 +++++ .../projects/labels/update_prioritization_spec.rb | 15 +++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 changelogs/unreleased/gt-show-primary-button-when-all-labels-are-prioritized.yml diff --git a/app/views/projects/labels/index.html.haml b/app/views/projects/labels/index.html.haml index 2c6484c2c99..56b06374d6d 100644 --- a/app/views/projects/labels/index.html.haml +++ b/app/views/projects/labels/index.html.haml @@ -5,7 +5,7 @@ - subscribed = params[:subscribed] - labels_or_filters = @labels.exists? || @prioritized_labels.exists? || search.present? || subscribed.present? -- if @labels.present? && can_admin_label +- if labels_or_filters && can_admin_label - content_for(:header_content) do .nav-controls = link_to _('New label'), new_project_label_path(@project), class: "btn btn-success qa-label-create-new" diff --git a/changelogs/unreleased/gt-show-primary-button-when-all-labels-are-prioritized.yml b/changelogs/unreleased/gt-show-primary-button-when-all-labels-are-prioritized.yml new file mode 100644 index 00000000000..eed31950a76 --- /dev/null +++ b/changelogs/unreleased/gt-show-primary-button-when-all-labels-are-prioritized.yml @@ -0,0 +1,5 @@ +--- +title: Show primary button when all labels are prioritized +merge_request: 23648 +author: George Tsiolis +type: other diff --git a/spec/features/projects/labels/update_prioritization_spec.rb b/spec/features/projects/labels/update_prioritization_spec.rb index 996040fde02..055a0c83a11 100644 --- a/spec/features/projects/labels/update_prioritization_spec.rb +++ b/spec/features/projects/labels/update_prioritization_spec.rb @@ -115,6 +115,21 @@ describe 'Prioritize labels' do end end + it 'user can see a primary button when there are only prioritized labels', :js do + visit project_labels_path(project) + + page.within('.other-labels') do + all('.js-toggle-priority').each do |el| + el.click + end + wait_for_requests + end + + page.within('.breadcrumbs-container') do + expect(page).to have_link('New label') + end + end + it 'shows a help message about prioritized labels' do visit project_labels_path(project)