From fe823be926ece8f73b06dc6528221306431ff895 Mon Sep 17 00:00:00 2001 From: Martin Hobert Date: Tue, 22 Jan 2019 17:42:10 +0000 Subject: fix(labels): Move the primary button out of breadcrumbs and into the project section --- app/views/groups/labels/index.html.haml | 7 +------ app/views/projects/labels/index.html.haml | 7 +------ app/views/shared/labels/_nav.html.haml | 4 ++++ changelogs/unreleased/fix-56558-move-primary-button.yml | 5 +++++ qa/qa/page/label/index.rb | 2 +- spec/features/projects/labels/update_prioritization_spec.rb | 2 +- 6 files changed, 13 insertions(+), 14 deletions(-) create mode 100644 changelogs/unreleased/fix-56558-move-primary-button.yml diff --git a/app/views/groups/labels/index.html.haml b/app/views/groups/labels/index.html.haml index 4df3d831942..5cf3193bc62 100644 --- a/app/views/groups/labels/index.html.haml +++ b/app/views/groups/labels/index.html.haml @@ -6,15 +6,10 @@ - subscribed = params[:subscribed] - labels_or_filters = @labels.exists? || search.present? || subscribed.present? -- if @labels.present? && can_admin_label - - content_for(:header_content) do - .nav-controls - = link_to _('New label'), new_group_label_path(@group), class: "btn btn-success" - - if labels_or_filters #promote-label-modal %div{ class: container_class } - = render 'shared/labels/nav' + = render 'shared/labels/nav', labels_or_filters: labels_or_filters, can_admin_label: can_admin_label .labels-container.prepend-top-5 - if @labels.any? diff --git a/app/views/projects/labels/index.html.haml b/app/views/projects/labels/index.html.haml index 56b06374d6d..bb7c297ba1f 100644 --- a/app/views/projects/labels/index.html.haml +++ b/app/views/projects/labels/index.html.haml @@ -5,15 +5,10 @@ - subscribed = params[:subscribed] - labels_or_filters = @labels.exists? || @prioritized_labels.exists? || search.present? || subscribed.present? -- 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" - - if labels_or_filters #promote-label-modal %div{ class: container_class } - = render 'shared/labels/nav' + = render 'shared/labels/nav', labels_or_filters: labels_or_filters, can_admin_label: can_admin_label .labels-container.prepend-top-10 - if can_admin_label diff --git a/app/views/shared/labels/_nav.html.haml b/app/views/shared/labels/_nav.html.haml index 98572db738b..e69246dd0eb 100644 --- a/app/views/shared/labels/_nav.html.haml +++ b/app/views/shared/labels/_nav.html.haml @@ -18,3 +18,7 @@ %button.btn.btn-default{ type: "submit", "aria-label" => _('Submit search') } = icon("search") = render 'shared/labels/sort_dropdown' + - if labels_or_filters && can_admin_label && @project + = link_to _('New label'), new_project_label_path(@project), class: "btn btn-success qa-label-create-new" + - if labels_or_filters && can_admin_label && @group + = link_to _('New label'), new_group_label_path(@group), class: "btn btn-success qa-label-create-new" diff --git a/changelogs/unreleased/fix-56558-move-primary-button.yml b/changelogs/unreleased/fix-56558-move-primary-button.yml new file mode 100644 index 00000000000..4dcc896b327 --- /dev/null +++ b/changelogs/unreleased/fix-56558-move-primary-button.yml @@ -0,0 +1,5 @@ +--- +title: Moved primary button for labels to follow the design patterns used on rest of the site +merge_request: +author: Martin Hobert +type: fixed diff --git a/qa/qa/page/label/index.rb b/qa/qa/page/label/index.rb index 9344371a0b6..97ce8f0eba5 100644 --- a/qa/qa/page/label/index.rb +++ b/qa/qa/page/label/index.rb @@ -2,7 +2,7 @@ module QA module Page module Label class Index < Page::Base - view 'app/views/projects/labels/index.html.haml' do + view 'app/views/shared/labels/_nav.html.haml' do element :label_create_new end diff --git a/spec/features/projects/labels/update_prioritization_spec.rb b/spec/features/projects/labels/update_prioritization_spec.rb index 055a0c83a11..d36f043f880 100644 --- a/spec/features/projects/labels/update_prioritization_spec.rb +++ b/spec/features/projects/labels/update_prioritization_spec.rb @@ -125,7 +125,7 @@ describe 'Prioritize labels' do wait_for_requests end - page.within('.breadcrumbs-container') do + page.within('.top-area') do expect(page).to have_link('New label') end end -- cgit v1.2.1