diff options
author | Phil Hughes <me@iamphill.com> | 2016-08-18 11:38:12 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2016-08-19 15:27:18 +0100 |
commit | 87284321ffc23fde2be175cb9ba01a5aa37071a6 (patch) | |
tree | 53d16861b5d6c118d2fbbf2054a175cb747a59fe | |
parent | 696740844b58cc24cd983a1b87acc9f7a6acaad7 (diff) | |
download | gitlab-ce-87284321ffc23fde2be175cb9ba01a5aa37071a6.tar.gz |
Addressed feedback
-rw-r--r-- | CHANGELOG | 3 | ||||
-rw-r--r-- | app/assets/javascripts/labels_select.js | 2 | ||||
-rw-r--r-- | app/helpers/issuables_helper.rb | 16 | ||||
-rw-r--r-- | app/views/shared/issuable/_sidebar.html.haml | 2 | ||||
-rw-r--r-- | spec/features/issues/issue_sidebar_spec.rb | 4 |
5 files changed, 13 insertions, 14 deletions
diff --git a/CHANGELOG b/CHANGELOG index d7b561f8922..2ff1be3322b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -18,6 +18,7 @@ v 8.11.0 (unreleased) - API: Endpoints for enabling and disabling deploy keys - API: List access requests, request access, approve, and deny access requests to a project or a group. !4833 - Use long options for curl examples in documentation !5703 (winniehell) + - Added tooltip listing label names to the labels value in the collapsed issuable sidebar - Remove magic comments (`# encoding: UTF-8`) from Ruby files. !5456 (winniehell) - Fix badge count alignment (ClemMakesApps) - GitLab Performance Monitoring can now track custom events such as the number of tags pushed to a repository @@ -300,8 +301,6 @@ v 8.10.0 - Reduce size of HTML used by diff comment forms - Protected branches have a "Developers can Merge" setting. !4892 (original implementation by Mathias Vestergaard) - Fix user creation with stronger minimum password requirements. !4054 (nathan-pmt) - - Added tooltip listing label names to the labels value in the collapsed issuable sidebar - - Fix user creation with stronger minimum password requirements !4054 (nathan-pmt) - Only show New Snippet button to users that can create snippets. - PipelinesFinder uses git cache data - Track a user who created a pipeline diff --git a/app/assets/javascripts/labels_select.js b/app/assets/javascripts/labels_select.js index 5eb9def1982..8dbbd9dd517 100644 --- a/app/assets/javascripts/labels_select.js +++ b/app/assets/javascripts/labels_select.js @@ -32,6 +32,8 @@ labelNoneHTMLTemplate = '<span class="no-value">None</span>'; } + $sidebarLabelTooltip.tooltip(); + new gl.CreateLabelDropdown($dropdown.closest('.dropdown').find('.dropdown-new-label'), projectId); saveLabelData = function() { diff --git a/app/helpers/issuables_helper.rb b/app/helpers/issuables_helper.rb index b95a3e95001..c3f4c1b148d 100644 --- a/app/helpers/issuables_helper.rb +++ b/app/helpers/issuables_helper.rb @@ -72,18 +72,14 @@ module IssuablesHelper end end - def issuable_labels_tooltip(labels) - max_labels = 5 - label_size = labels.size - label_names = labels.each_with_index.map do |label, i| - label.name unless i >= max_labels - end + def issuable_labels_tooltip(labels, limit: 5) + first = labels[0...limit] + last = labels[(limit-1)...-1] - if label_size > max_labels - label_names << "and #{label_size - max_labels} more" - end + label_names = first.collect(&:name) + label_names << "and #{last.size} more" unless last.empty? - label_names.compact.join(', ') + label_names.join(', ') end private diff --git a/app/views/shared/issuable/_sidebar.html.haml b/app/views/shared/issuable/_sidebar.html.haml index c1b50e65af5..bb18ef2536e 100644 --- a/app/views/shared/issuable/_sidebar.html.haml +++ b/app/views/shared/issuable/_sidebar.html.haml @@ -109,7 +109,7 @@ - if issuable.project.labels.any? .block.labels - .sidebar-collapsed-icon.js-sidebar-labels-tooltip{ title: issuable_labels_tooltip(issuable.labels_array), data: { placement: "left", container: "body" } } + .sidebar-collapsed-icon.js-sidebar-labels-tooltip{ title: issuable_labels_tooltip(issuable.labels), data: { placement: "left", container: "body" } } = icon('tags') %span = issuable.labels_array.size diff --git a/spec/features/issues/issue_sidebar_spec.rb b/spec/features/issues/issue_sidebar_spec.rb index a6acbd5a701..b043bc3feee 100644 --- a/spec/features/issues/issue_sidebar_spec.rb +++ b/spec/features/issues/issue_sidebar_spec.rb @@ -1,6 +1,8 @@ require 'rails_helper' feature 'Issue Sidebar', feature: true do + include WaitForAjax + let(:project) { create(:project) } let(:issue) { create(:issue, project: project) } let!(:user) { create(:user)} @@ -103,7 +105,7 @@ feature 'Issue Sidebar', feature: true do end find('.edit-link').click - sleep 1 + wait_for_ajax expect(find('.js-sidebar-labels-tooltip', visible: false)['data-original-title']).to eq('a, b, c, d, e, and 1 more') end |