From 2fd334b86a33cd96c7708980e1f9cd7f8717877a Mon Sep 17 00:00:00 2001 From: Luke Bennett Date: Thu, 17 May 2018 16:14:17 +0100 Subject: [PATCH] Fix group labels list --- app/assets/stylesheets/pages/labels.scss | 2 -- app/controllers/groups/labels_controller.rb | 6 ++--- app/views/groups/labels/index.html.haml | 27 ++++++--------------- 3 files changed, 11 insertions(+), 24 deletions(-) diff --git a/app/assets/stylesheets/pages/labels.scss b/app/assets/stylesheets/pages/labels.scss index 8e6b9ca6725..6348c5a878d 100644 --- a/app/assets/stylesheets/pages/labels.scss +++ b/app/assets/stylesheets/pages/labels.scss @@ -262,8 +262,6 @@ } .label-list-item { - overflow-x: scroll; - .content-list &:before, .content-list &:after { content: none; diff --git a/app/controllers/groups/labels_controller.rb b/app/controllers/groups/labels_controller.rb index 596dd5b2d69..0570edb51c2 100644 --- a/app/controllers/groups/labels_controller.rb +++ b/app/controllers/groups/labels_controller.rb @@ -9,11 +9,11 @@ class Groups::LabelsController < Groups::ApplicationController respond_to :html def index - @prioritized_labels = @available_labels.prioritized(@group) - @labels = @available_labels.unprioritized(@group).page(params[:page]) + @labels = @group.labels.page(params[:page]) respond_to do |format| - format.html + format.html do + end format.json do render json: LabelSerializer.new.represent_appearance(@available_labels) end diff --git a/app/views/groups/labels/index.html.haml b/app/views/groups/labels/index.html.haml index 1fa6389de0f..44b64a31972 100644 --- a/app/views/groups/labels/index.html.haml +++ b/app/views/groups/labels/index.html.haml @@ -2,6 +2,7 @@ - page_title "Labels" - can_admin_label = can?(current_user, :admin_label, @group) - hide_class = '' +- hide = @available_labels.empty? || (params[:page].present? && params[:page] != '1') - if can_admin_label - content_for(:header_content) do @@ -9,7 +10,7 @@ = link_to new_group_label_path(@group), class: "btn btn-new" do New label -- if @labels.exists? || @prioritized_labels.exists? +- if @labels.exists? #promote-label-modal %div{ class: container_class } .top-area.adjust @@ -19,24 +20,12 @@ Star a label to make it a priority label. Order the prioritized labels to change their relative priority, by dragging. .labels-container.prepend-top-5 - - if can_admin_label - -# Only show it in the first page - - hide = @available_labels.empty? || (params[:page].present? && params[:page] != '1') - .prioritized-labels{ class: ('hide' if hide) } - %h5.prepend-top-0 Prioritized Labels - %ul.content-list.manage-labels-list.js-prioritized-labels - #js-priority-labels-empty-state.priority-labels-empty-state{ class: "#{'hidden' unless @prioritized_labels.empty?}" } - = render 'shared/empty_states/priority_labels' - - if @prioritized_labels.present? - = render partial: 'shared/label', subject: @group, collection: @prioritized_labels, as: :label - - - if @labels.present? - .other-labels - - if can_admin_label - %h5{ class: ('hide' if hide) } Other Labels - %ul.content-list.manage-labels-list.js-other-labels - = render partial: 'shared/label', subject: @group, collection: @labels, as: :label - = paginate @labels, theme: 'gitlab' + .other-labels + - if can_admin_label + %h5{ class: ('hide' if hide) } Labels + %ul.content-list.manage-labels-list.js-other-labels + = render partial: 'shared/label', subject: @group, collection: @labels, as: :label + = paginate @labels, theme: 'gitlab' - else = render 'shared/empty_states/labels'