summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/init_labels.js1
-rw-r--r--app/helpers/labels_helper.rb7
-rw-r--r--app/views/projects/labels/index.html.haml24
3 files changed, 19 insertions, 13 deletions
diff --git a/app/assets/javascripts/init_labels.js b/app/assets/javascripts/init_labels.js
index 15da5d5cceb..d955b8cab10 100644
--- a/app/assets/javascripts/init_labels.js
+++ b/app/assets/javascripts/init_labels.js
@@ -4,6 +4,7 @@ import GroupLabelSubscription from './group_label_subscription';
import ProjectLabelSubscription from './project_label_subscription';
export default () => {
+ debugger
if ($('.prioritized-labels').length) {
new LabelManager(); // eslint-disable-line no-new
}
diff --git a/app/helpers/labels_helper.rb b/app/helpers/labels_helper.rb
index c4a6a1e4bb3..cd926ad5ce1 100644
--- a/app/helpers/labels_helper.rb
+++ b/app/helpers/labels_helper.rb
@@ -211,6 +211,13 @@ module LabelsHelper
end
end
+ def labels_list_class(can_admin_label, sortable = false)
+ list_classes = "manage-labels-list"
+ list_classes += " js-prioritized-labels" if can_admin_label && sortable
+
+ list_classes
+ end
+
# Required for Banzai::Filter::LabelReferenceFilter
module_function :render_colored_label, :text_color_for_bg, :escape_once
end
diff --git a/app/views/projects/labels/index.html.haml b/app/views/projects/labels/index.html.haml
index 9c78bade254..0988667aaaf 100644
--- a/app/views/projects/labels/index.html.haml
+++ b/app/views/projects/labels/index.html.haml
@@ -18,22 +18,20 @@
New label
.labels
- - 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 Prioritized Labels
- %ul.content-list.manage-labels-list.js-prioritized-labels{ "data-url" => set_priorities_project_labels_path(@project) }
- #js-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: @project, collection: @prioritized_labels, as: :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 Prioritized Labels
+ %ul.content-list{ class: labels_list_class(can_admin_label, true), "data-url": set_priorities_project_labels_path(@project) }
+ #js-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: @project, 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
+ %h5{ class: ('hide' if hide) } Other Labels
+ %ul.content-list.js-other-labels{ class: labels_list_class(can_admin_label) }
= render partial: 'shared/label', subject: @project, collection: @labels, as: :label
= paginate @labels, theme: 'gitlab'
- else