summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2016-08-19 16:00:47 +0000
committerRobert Speicher <robert@gitlab.com>2016-08-19 16:00:47 +0000
commit4ecfd74fff060a3a6aaa16ace3b3360c74ed893a (patch)
treecf00c098be86aececef51761473f627109d35018 /app/helpers
parent55cd2e791bfeb90548e1cd4c142213470f1f2aac (diff)
parentd1b987fd05ef650cfb227da5828a1cd4fc811436 (diff)
downloadgitlab-ce-4ecfd74fff060a3a6aaa16ace3b3360c74ed893a.tar.gz
Merge branch 'label-tooltip-sidebar-collapsed' into 'master'
Added tooltip to label value in collapsed sidebar ## What does this MR do? Adds a list of the issuables labels to a tooltip in the collapsed sidebar. Limited to 5 otherwise the list could get crazy long. Closes #19398 See merge request !5232
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/issuables_helper.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/helpers/issuables_helper.rb b/app/helpers/issuables_helper.rb
index 47d174361db..b9baeb1d6c4 100644
--- a/app/helpers/issuables_helper.rb
+++ b/app/helpers/issuables_helper.rb
@@ -72,6 +72,15 @@ module IssuablesHelper
end
end
+ def issuable_labels_tooltip(labels, limit: 5)
+ first, last = labels.partition.with_index{ |_, i| i < limit }
+
+ label_names = first.collect(&:name)
+ label_names << "and #{last.size} more" unless last.empty?
+
+ label_names.join(', ')
+ end
+
private
def sidebar_gutter_collapsed?