diff options
author | Toon Claes <toon@gitlab.com> | 2017-05-31 15:59:01 +0200 |
---|---|---|
committer | Toon Claes <toon@gitlab.com> | 2017-06-20 14:19:45 +0200 |
commit | 91c58ed14d13dcefd7ca2834d6157a9fa630a9af (patch) | |
tree | 9a3b714841297140c85d13dcc803479e6af63768 | |
parent | 458c292f41860d7ddea7803e4ba890fe04dc5dc4 (diff) | |
download | gitlab-ce-91c58ed14d13dcefd7ca2834d6157a9fa630a9af.tar.gz |
FormHelper#issue_assignees_dropdown_options never has multiple assignees
Only EE supports multiple issue assignees, so this CE code should not contain
code to have multiple assignees. EE will override the multiple issue assignees
feature by overriding this method.
-rw-r--r-- | app/helpers/form_helper.rb | 16 | ||||
-rw-r--r-- | app/views/shared/issuable/form/_metadata_issue_assignee.html.haml | 2 | ||||
-rw-r--r-- | spec/features/issues/form_spec.rb | 4 |
3 files changed, 7 insertions, 15 deletions
diff --git a/app/helpers/form_helper.rb b/app/helpers/form_helper.rb index 014fc46b130..729bc4bf329 100644 --- a/app/helpers/form_helper.rb +++ b/app/helpers/form_helper.rb @@ -16,8 +16,8 @@ module FormHelper end end - def issue_dropdown_options(issuable, has_multiple_assignees = true) - options = { + def issue_assignees_dropdown_options + { toggle_class: 'js-user-search js-assignee-search js-multiselect js-save-user-data', title: 'Select assignee', filter: true, @@ -27,8 +27,8 @@ module FormHelper first_user: current_user&.username, null_user: true, current_user: true, - project_id: issuable.project.try(:id), - field_name: "#{issuable.class.model_name.param_key}[assignee_ids][]", + project_id: @project.id, + field_name: 'issue[assignee_ids][]', default_label: 'Unassigned', 'max-select': 1, 'dropdown-header': 'Assignee', @@ -38,13 +38,5 @@ module FormHelper current_user_info: current_user.to_json(only: [:id, :name]) } } - - if has_multiple_assignees - options[:title] = 'Select assignee(s)' - options[:data][:'dropdown-header'] = 'Assignee(s)' - options[:data].delete(:'max-select') - end - - options end end diff --git a/app/views/shared/issuable/form/_metadata_issue_assignee.html.haml b/app/views/shared/issuable/form/_metadata_issue_assignee.html.haml index 77175c839a6..567cde764e2 100644 --- a/app/views/shared/issuable/form/_metadata_issue_assignee.html.haml +++ b/app/views/shared/issuable/form/_metadata_issue_assignee.html.haml @@ -7,5 +7,5 @@ - if issuable.assignees.length === 0 = hidden_field_tag "#{issuable.to_ability_name}[assignee_ids][]", 0, id: nil, data: { meta: '' } - = dropdown_tag(users_dropdown_label(issuable.assignees), options: issue_dropdown_options(issuable,false)) + = dropdown_tag(users_dropdown_label(issuable.assignees), options: issue_assignees_dropdown_options) = link_to 'Assign to me', '#', class: "assign-to-me-link #{'hide' if issuable.assignees.include?(current_user)}" diff --git a/spec/features/issues/form_spec.rb b/spec/features/issues/form_spec.rb index b369ef1ff79..58f6bd277e4 100644 --- a/spec/features/issues/form_spec.rb +++ b/spec/features/issues/form_spec.rb @@ -31,8 +31,8 @@ describe 'New/edit issue', :feature, :js do # the original method, resulting in infinite recurison when called. # This is likely a bug with helper modules included into dynamically generated view classes. # To work around this, we have to hold on to and call to the original implementation manually. - original_issue_dropdown_options = FormHelper.instance_method(:issue_dropdown_options) - allow_any_instance_of(FormHelper).to receive(:issue_dropdown_options).and_wrap_original do |original, *args| + original_issue_dropdown_options = FormHelper.instance_method(:issue_assignees_dropdown_options) + allow_any_instance_of(FormHelper).to receive(:issue_assignees_dropdown_options).and_wrap_original do |original, *args| options = original_issue_dropdown_options.bind(original.receiver).call(*args) options[:data][:per_page] = 2 |