diff options
author | Robert Speicher <robert@gitlab.com> | 2016-08-19 16:00:47 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2016-08-19 16:00:47 +0000 |
commit | 4ecfd74fff060a3a6aaa16ace3b3360c74ed893a (patch) | |
tree | cf00c098be86aececef51761473f627109d35018 /app/helpers | |
parent | 55cd2e791bfeb90548e1cd4c142213470f1f2aac (diff) | |
parent | d1b987fd05ef650cfb227da5828a1cd4fc811436 (diff) | |
download | gitlab-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.rb | 9 |
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? |