Fix group labels list

This commit is contained in:
Luke Bennett 2018-05-17 16:14:17 +01:00
parent bd47118e1b
commit 2fd334b86a
No known key found for this signature in database
GPG key ID: A738E9C68D3BF31A
3 changed files with 11 additions and 24 deletions

View file

@ -262,8 +262,6 @@
} }
.label-list-item { .label-list-item {
overflow-x: scroll;
.content-list &:before, .content-list &:before,
.content-list &:after { .content-list &:after {
content: none; content: none;

View file

@ -9,11 +9,11 @@ class Groups::LabelsController < Groups::ApplicationController
respond_to :html respond_to :html
def index def index
@prioritized_labels = @available_labels.prioritized(@group) @labels = @group.labels.page(params[:page])
@labels = @available_labels.unprioritized(@group).page(params[:page])
respond_to do |format| respond_to do |format|
format.html format.html do
end
format.json do format.json do
render json: LabelSerializer.new.represent_appearance(@available_labels) render json: LabelSerializer.new.represent_appearance(@available_labels)
end end

View file

@ -2,6 +2,7 @@
- page_title "Labels" - page_title "Labels"
- can_admin_label = can?(current_user, :admin_label, @group) - can_admin_label = can?(current_user, :admin_label, @group)
- hide_class = '' - hide_class = ''
- hide = @available_labels.empty? || (params[:page].present? && params[:page] != '1')
- if can_admin_label - if can_admin_label
- content_for(:header_content) do - content_for(:header_content) do
@ -9,7 +10,7 @@
= link_to new_group_label_path(@group), class: "btn btn-new" do = link_to new_group_label_path(@group), class: "btn btn-new" do
New label New label
- if @labels.exists? || @prioritized_labels.exists? - if @labels.exists?
#promote-label-modal #promote-label-modal
%div{ class: container_class } %div{ class: container_class }
.top-area.adjust .top-area.adjust
@ -19,21 +20,9 @@
Star a label to make it a priority label. Order the prioritized labels to change their relative priority, by dragging. 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 .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 .other-labels
- if can_admin_label - if can_admin_label
%h5{ class: ('hide' if hide) } Other Labels %h5{ class: ('hide' if hide) } Labels
%ul.content-list.manage-labels-list.js-other-labels %ul.content-list.manage-labels-list.js-other-labels
= render partial: 'shared/label', subject: @group, collection: @labels, as: :label = render partial: 'shared/label', subject: @group, collection: @labels, as: :label
= paginate @labels, theme: 'gitlab' = paginate @labels, theme: 'gitlab'