Commit 2ef44d71 authored by Vitaly Slobodin's avatar Vitaly Slobodin

Merge branch '300529-remove-license-checks-in-bulk-update-ce-haml' into 'master'

Remove license checks in issuable bulk update HAML

See merge request gitlab-org/gitlab!53093
parents 715d333a 58b20000
- type = local_assigns.fetch(:type)
- bulk_issue_health_status_flag = type == :issues && @project&.group&.feature_available?(:issuable_health_status)
- epic_bulk_edit_flag = @project&.group&.feature_available?(:epics) && type == :issues
- bulk_iterations_flag = @project&.group&.feature_available?(:iterations) && type == :issues
- is_issue = type == :issues
%aside.issues-bulk-update.js-right-sidebar.right-sidebar{ "aria-live" => "polite", data: { 'signed-in': current_user.present? }, 'aria-label': _('Bulk update') }
.issuable-sidebar.hidden
......@@ -30,32 +28,22 @@
- field_name = "update[assignee_ids][]"
= dropdown_tag(_("Select assignee"), options: { toggle_class: "js-user-search js-update-assignee js-filter-submit js-filter-bulk-update", title: _("Assign to"), filter: true, dropdown_class: "dropdown-menu-user dropdown-menu-selectable",
placeholder: _("Search authors"), data: { first_user: (current_user.username if current_user), null_user: true, current_user: true, project_id: @project.id, field_name: field_name } })
- if epic_bulk_edit_flag
.block
.title
= _('Epic')
.filter-item.epic-bulk-edit
#js-epic-select-root{ data: { group_id: @project&.group&.id, show_header: "true" } }
%input{ id: 'issue_epic_id', type: 'hidden', name: 'update[epic_id]' }
- if is_issue
= render_if_exists 'shared/issuable/epic_dropdown', parent: @project.group
.block
.title
= _('Milestone')
.filter-item
= dropdown_tag(_("Select milestone"), options: { title: _("Assign milestone"), toggle_class: "js-milestone-select js-extra-options js-filter-submit js-filter-bulk-update", filter: true, dropdown_class: "dropdown-menu-selectable dropdown-menu-milestone", placeholder: _("Search milestones"), data: { show_no: true, field_name: "update[milestone_id]", project_id: @project.id, use_id: true, default_label: _("Milestone") } })
- if bulk_iterations_flag
= render_if_exists 'shared/iterations_dropdown', path: @project.group.full_path
- if is_issue
= render_if_exists 'shared/issuable/iterations_dropdown', parent: @project.group
.block
.title
= _('Labels')
.filter-item.labels-filter
= render "shared/issuable/label_dropdown", classes: ["js-filter-bulk-update", "js-multiselect"], dropdown_title: _("Apply a label"), show_create: false, show_footer: false, extra_options: false, filter_submit: false, data_options: { persist_when_hide: "true", field_name: "update[label_ids][]", show_no: false, show_any: false, use_id: true, default_label: _("Labels") }, label_name: _("Select labels"), no_default_styles: true
- if bulk_issue_health_status_flag
.block
.title
= _('Health status')
.filter-item.health-status.health-status-filter
#js-bulk-update-health-status-root
%input{ id: 'issue_health_status_value', type: 'hidden', name: 'update[health_status]' }
- if is_issue
= render_if_exists 'shared/issuable/health_status_dropdown', parent: @project
.block
.title
= _('Subscriptions')
......
- parent = local_assigns.fetch(:parent)
- return unless parent&.feature_available?(:epics)
.block
.title
= _('Epic')
.filter-item.epic-bulk-edit
#js-epic-select-root{ data: { group_id: parent.id, show_header: "true" } }
%input{ id: 'issue_epic_id', type: 'hidden', name: 'update[epic_id]' }
- group = local_assigns.fetch(:group)
- type = local_assigns.fetch(:type)
- bulk_issue_health_status_flag = type == :issues && group&.feature_available?(:issuable_health_status)
- epic_bulk_edit_flag = type == :issues && group&.feature_available?(:epics)
- bulk_edit_iterations = group.feature_available?(:iterations) && type == :issues
- is_issue = type == :issues
%aside.issues-bulk-update.js-right-sidebar.right-sidebar{ 'aria-live' => 'polite', data: { 'signed-in': current_user.present? }, 'aria-label': _('Bulk update') }
.issuable-sidebar.hidden
......@@ -11,33 +9,23 @@
.filter-item.inline.update-issues-btn.float-left
= button_tag _('Update all'), class: "gl-button btn update-selected-issues btn-info", disabled: true
= button_tag _('Cancel'), class: "gl-button btn btn-default js-bulk-update-menu-hide float-right"
- if epic_bulk_edit_flag
.block
.title
= _('Epic')
.filter-item.epic-bulk-edit
#js-epic-select-root{ data: { group_id: group.id, show_header: "true" } }
%input{ id: 'issue_epic_id', type: 'hidden', name: 'update[epic_id]' }
- if is_issue
= render "shared/issuable/epic_dropdown", parent: group
- unless type == :epics
.block
.title
= _('Milestone')
.filter-item
= dropdown_tag(_('Select milestone'), options: { title: _('Assign milestone'), toggle_class: 'js-milestone-select js-extra-options js-filter-submit js-filter-bulk-update', filter: true, dropdown_class: 'dropdown-menu-selectable dropdown-menu-milestone', placeholder: _('Search milestones'), data: { show_no: true, field_name: 'update[milestone_id]', group_id: group&.id, use_id: true, default_label: _('Milestone') } })
- if bulk_edit_iterations
= render "shared/iterations_dropdown", path: group.full_path
- if is_issue
= render "shared/issuable/iterations_dropdown", parent: group
.block
.title
= _('Labels')
.filter-item.labels-filter
= render "shared/issuable/label_dropdown", classes: ["js-filter-bulk-update", "js-multiselect"], dropdown_title: _('Apply a label'), show_create: false, show_footer: false, extra_options: false, filter_submit: false, data_options: { persist_when_hide: "true", field_name: "update[label_ids][]", show_no: false, show_any: false, use_id: true, default_label: "Labels" }, label_name: _('Select labels'), no_default_styles: true, edit_context: group
- if bulk_issue_health_status_flag
.block
.title
= _('Health status')
.filter-item.health-status.health-status-filter
#js-bulk-update-health-status-root
%input{ id: 'issue_health_status_value', type: 'hidden', name: 'update[health_status]' }
- if is_issue
= render "shared/issuable/health_status_dropdown", parent: group
= hidden_field_tag 'update[issuable_ids]', []
= hidden_field_tag :state_event, params[:state_event]
- parent = local_assigns.fetch(:parent)
- return unless parent&.feature_available?(:issuable_health_status)
.block
.title
= _('Health status')
.filter-item.health-status.health-status-filter
#js-bulk-update-health-status-root
%input{ id: 'issue_health_status_value', type: 'hidden', name: 'update[health_status]' }
- path = local_assigns.fetch(:path)
- parent = local_assigns.fetch(:parent)
- return unless parent&.feature_available?(:iterations)
.block
.title
= _('Iteration')
.filter-item
#js-iteration-dropdown{ data: { full_path: path } }
#js-iteration-dropdown{ data: { full_path: parent.full_path } }
%input{ id: 'issue_iteration_id', type: 'hidden', name: 'update[iteration_id]' }
# frozen_string_literal: true
RSpec.shared_examples_for 'issuable bulk dropdown' do |path|
let(:parent) { create(:group) }
let(:feature_enabled) { true }
# We use `view.render`, because just `render` throws a "no implicit conversion of nil into String" exception
# https://gitlab.com/gitlab-org/gitlab/-/merge_requests/53093#note_499060593
subject { view.render(path, { parent: parent }) }
before do
stub_licensed_features(feature_id => feature_enabled)
end
it 'renders hidden input' do
expect(subject).to have_css(input_selector, visible: false)
end
it 'renders vue root' do
expect(subject).to have_css(root_selector)
end
context 'without parent' do
let(:parent) { nil }
it 'is nil' do
expect(subject).to be_nil
end
end
context 'without feature' do
let(:feature_enabled) { false }
it 'is nil' do
expect(subject).to be_nil
end
end
end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'shared/issuable/_epic_dropdown.html.haml' do
it_behaves_like 'issuable bulk dropdown', 'shared/issuable/epic_dropdown' do
let(:feature_id) { :epics }
let(:input_selector) { 'input#issue_epic_id[name="update[epic_id]"]' }
let(:root_selector) { "#js-epic-select-root[data-group-id=\"#{parent.id}\"][data-show-header=\"true\"]" }
end
end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'shared/issuable/_health_status_dropdown.html.haml' do
it_behaves_like 'issuable bulk dropdown', 'shared/issuable/health_status_dropdown' do
let(:feature_id) { :issuable_health_status }
let(:input_selector) { 'input#issue_health_status_value[name="update[health_status]"]' }
let(:root_selector) { "#js-bulk-update-health-status-root" }
end
end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'shared/issuable/_iterations_dropdown.html.haml' do
it_behaves_like 'issuable bulk dropdown', 'shared/issuable/iterations_dropdown' do
let(:feature_id) { :iterations }
let(:input_selector) { 'input#issue_iteration_id[name="update[iteration_id]"]' }
let(:root_selector) { "#js-iteration-dropdown[data-full-path=\"#{parent.full_path}\"]" }
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment