Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-09-20 06:09:57 +0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-10-19 19:58:24 +0300
commitbdb7bf4b5188ffd68e54cbf671ba9ce1a4ffb1d1 (patch)
tree3f53930ff56ab0cfeceb0ab3af75fe9b75fefebd /app/helpers
parentbf9d928b45516e716b0f7f099361ca03aa1454f8 (diff)
List group labels on project labels page
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/labels_helper.rb43
1 files changed, 43 insertions, 0 deletions
diff --git a/app/helpers/labels_helper.rb b/app/helpers/labels_helper.rb
index 540eb6dd493..3f0e502fbc9 100644
--- a/app/helpers/labels_helper.rb
+++ b/app/helpers/labels_helper.rb
@@ -68,6 +68,49 @@ module LabelsHelper
end
end
+ def can_admin_label(label)
+ subject =
+ case label
+ when GroupLabel then label.group
+ else label.project
+ end
+
+ can?(current_user, :admin_label, subject)
+ end
+
+ def edit_label_path(label)
+ case label
+ when GroupLabel then edit_group_label_path(label.group, label)
+ else edit_namespace_project_label_path(label.project.namespace, label.project, label)
+ end
+ end
+
+ def destroy_label_path(label)
+ case label
+ when GroupLabel then group_label_path(label.group, label)
+ else namespace_project_label_path(label.project.namespace, label.project, label)
+ end
+ end
+
+ def label_type_icon(label, options = {})
+ title, icon =
+ case label
+ when GroupLabel then ['Group', 'folder-open']
+ else ['Project', 'bookmark']
+ end
+
+ options[:class] ||= ''
+ options[:class] << ' has-tooltip js-label-type'
+
+ content_tag :span,
+ class: options[:class],
+ data: { 'placement' => 'top' },
+ title: title,
+ aria: { label: title } do
+ icon(icon, base: true)
+ end
+ end
+
def project_label_names
@project.labels.pluck(:title)
end