diff options
author | André Luís <me@andr3.net> | 2018-04-18 22:29:58 +0000 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2018-04-18 22:29:58 +0000 |
commit | c352f695d7f27858fb011c60e4facfe9dbca6a59 (patch) | |
tree | dbbb35c4a1684799738a3230df03d1158b8278a4 | |
parent | 8cce96b189393420b0c22fa1298f8d5db78bdf7a (diff) | |
download | gitlab-ce-c352f695d7f27858fb011c60e4facfe9dbca6a59.tar.gz |
Resolve "View labels when editing labels in sidebar and board sidebar"
-rw-r--r-- | app/assets/javascripts/issuable_context.js | 4 | ||||
-rw-r--r-- | app/assets/stylesheets/framework/sidebar.scss | 9 | ||||
-rw-r--r-- | app/views/shared/boards/components/sidebar/_labels.html.haml | 2 | ||||
-rw-r--r-- | app/views/shared/issuable/_sidebar.html.haml | 2 | ||||
-rw-r--r-- | changelogs/unreleased/34262-show-current-labels-when-editing.yml | 5 | ||||
-rw-r--r-- | spec/features/boards/sidebar_spec.rb | 20 | ||||
-rw-r--r-- | spec/features/issues/issue_sidebar_spec.rb | 9 |
7 files changed, 43 insertions, 8 deletions
diff --git a/app/assets/javascripts/issuable_context.js b/app/assets/javascripts/issuable_context.js index 7470d634b99..f3d722409b0 100644 --- a/app/assets/javascripts/issuable_context.js +++ b/app/assets/javascripts/issuable_context.js @@ -30,10 +30,10 @@ export default class IssuableContext { const $selectbox = $block.find('.selectbox'); if ($selectbox.is(':visible')) { $selectbox.hide(); - $block.find('.value').show(); + $block.find('.value:not(.dont-hide)').show(); } else { $selectbox.show(); - $block.find('.value').hide(); + $block.find('.value:not(.dont-hide)').hide(); } if ($selectbox.is(':visible')) { diff --git a/app/assets/stylesheets/framework/sidebar.scss b/app/assets/stylesheets/framework/sidebar.scss index 798f248dad4..64fff7463d2 100644 --- a/app/assets/stylesheets/framework/sidebar.scss +++ b/app/assets/stylesheets/framework/sidebar.scss @@ -16,7 +16,7 @@ .nav-header-btn { padding: 10px $gl-sidebar-padding; color: inherit; - transition-duration: .3s; + transition-duration: 0.3s; position: absolute; top: 0; cursor: pointer; @@ -137,6 +137,12 @@ } } +.issuable-sidebar .labels { + .value.dont-hide ~ .selectbox { + padding-top: $gl-padding-8; + } +} + .pikaday-container { .pika-single { margin-top: 2px; @@ -151,4 +157,3 @@ .sidebar-collapsed-icon .sidebar-collapsed-value { font-size: 12px; } - diff --git a/app/views/shared/boards/components/sidebar/_labels.html.haml b/app/views/shared/boards/components/sidebar/_labels.html.haml index 87e6b52f46e..1c73534c642 100644 --- a/app/views/shared/boards/components/sidebar/_labels.html.haml +++ b/app/views/shared/boards/components/sidebar/_labels.html.haml @@ -4,7 +4,7 @@ - if can_admin_issue? = icon("spinner spin", class: "block-loading") = link_to "Edit", "#", class: "js-sidebar-dropdown-toggle edit-link pull-right" - .value.issuable-show-labels + .value.issuable-show-labels.dont-hide %span.no-value{ "v-if" => "issue.labels && issue.labels.length === 0" } None %a{ href: "#", diff --git a/app/views/shared/issuable/_sidebar.html.haml b/app/views/shared/issuable/_sidebar.html.haml index 975b9cb4729..aa883b9b1fa 100644 --- a/app/views/shared/issuable/_sidebar.html.haml +++ b/app/views/shared/issuable/_sidebar.html.haml @@ -96,7 +96,7 @@ = icon('spinner spin', class: 'hidden block-loading', 'aria-hidden': 'true') - if can_edit_issuable = link_to _('Edit'), '#', class: 'js-sidebar-dropdown-toggle edit-link pull-right' - .value.issuable-show-labels.hide-collapsed{ class: ("has-labels" if selected_labels.any?) } + .value.issuable-show-labels.dont-hide.hide-collapsed{ class: ("has-labels" if selected_labels.any?) } - if selected_labels.any? - selected_labels.each do |label| = link_to_label(label, subject: issuable.project, type: issuable.to_ability_name) diff --git a/changelogs/unreleased/34262-show-current-labels-when-editing.yml b/changelogs/unreleased/34262-show-current-labels-when-editing.yml new file mode 100644 index 00000000000..d3b15b9ddd1 --- /dev/null +++ b/changelogs/unreleased/34262-show-current-labels-when-editing.yml @@ -0,0 +1,5 @@ +--- +title: Keep current labels visible when editing them in the sidebar +merge_request: +author: +type: changed diff --git a/spec/features/boards/sidebar_spec.rb b/spec/features/boards/sidebar_spec.rb index d4c44c1adf9..4d31123a699 100644 --- a/spec/features/boards/sidebar_spec.rb +++ b/spec/features/boards/sidebar_spec.rb @@ -237,6 +237,22 @@ describe 'Issue Boards', :js do end context 'labels' do + it 'shows current labels when editing' do + click_card(card) + + page.within('.labels') do + click_link 'Edit' + + wait_for_requests + + page.within('.value') do + expect(page).to have_selector('.label', count: 2) + expect(page).to have_content(development.title) + expect(page).to have_content(stretch.title) + end + end + end + it 'adds a single label' do click_card(card) @@ -296,7 +312,9 @@ describe 'Issue Boards', :js do wait_for_requests - click_link stretch.title + within('.dropdown-menu-labels') do + click_link stretch.title + end wait_for_requests diff --git a/spec/features/issues/issue_sidebar_spec.rb b/spec/features/issues/issue_sidebar_spec.rb index 27551bb70ee..830c794376d 100644 --- a/spec/features/issues/issue_sidebar_spec.rb +++ b/spec/features/issues/issue_sidebar_spec.rb @@ -5,9 +5,9 @@ feature 'Issue Sidebar' do let(:group) { create(:group, :nested) } let(:project) { create(:project, :public, namespace: group) } - let(:issue) { create(:issue, project: project) } let!(:user) { create(:user)} let!(:label) { create(:label, project: project, title: 'bug') } + let(:issue) { create(:labeled_issue, project: project, labels: [label]) } let!(:xss_label) { create(:label, project: project, title: '<script>alert("xss");</script>') } before do @@ -112,11 +112,18 @@ feature 'Issue Sidebar' do context 'editing issue labels', :js do before do + issue.update_attributes(labels: [label]) page.within('.block.labels') do find('.edit-link').click end end + it 'shows the current set of labels' do + page.within('.issuable-show-labels') do + expect(page).to have_content label.title + end + end + it 'shows option to create a project label' do page.within('.block.labels') do expect(page).to have_content 'Create project' |