Merge pull request #3826 from opf/21998-single-select-on-members

Switch to single select when creating membership
pull/3835/head
Oliver Günther 9 years ago
commit e3820f1369
  1. 4
      app/assets/stylesheets/content/_select2.scss
  2. 23
      app/views/members/_member_form_non_impaired.html.erb
  3. 29
      spec/features/members/error_messages_spec.rb

@ -335,3 +335,7 @@ $se2-arrow-button-width: 32px;
}
}
}
.select2-search-choice-close {
top: 3px;
}

@ -38,7 +38,7 @@ See doc/COPYRIGHT.rdoc for more details.
<div class="form--section">
<div id="new-member-message"></div>
<div class="grid-block">
<div class="grid-block medium-6">
<div class="grid-block medium-4">
<div class="form--field">
<%
user_id_title = I18n.t(:label_principal_search)
@ -60,16 +60,21 @@ See doc/COPYRIGHT.rdoc for more details.
</div>
</div>
<div class="grid-block">
<div class="grid-block medium-6">
<div class="grid-block">
<div class="form--field">
<%= styled_label_tag :member_role_ids, l(:label_role_search) %>
<% options = roles.collect { |obj| [obj.name, obj.id] } %>
<%= select_tag 'member[role_ids]', options_for_select(options),
multiple: true,
no_label: true,
title: l(:label_role_search),
tabIndex: 0,
class: 'form--select' %>
<div class="form--field-container">
<div class="form--select-container -auto">
<% options = roles.collect { |obj| [obj.name, obj.id] } %>
<%= select_tag 'member[role_ids][]', options_for_select(options),
multiple: false,
no_label: true,
title: l(:label_role_search),
tabIndex: 0,
class: 'form--select',
id: 'member_role_ids' %>
</div>
</div>
</div>
</div>
</div>

@ -28,7 +28,7 @@
require 'spec_helper'
feature 'group memberships through groups page', type: :feature do
feature 'Group memberships through groups page', type: :feature do
let!(:project) { FactoryGirl.create :project, name: 'Project 1', identifier: 'project1' }
let(:admin) { FactoryGirl.create :admin }
@ -43,13 +43,6 @@ feature 'group memberships through groups page', type: :feature do
end
shared_examples 'errors when adding members' do
scenario 'adding a principal without a role, non impaired', js: true do
members_page.visit!
members_page.add_user! 'Peter Pan', as: nil
expect(page).to have_text 'choose at least one role'
end
scenario 'adding a role without a principal, non impaired', js: true do
members_page.visit!
members_page.add_user! nil, as: 'Manager'
@ -58,16 +51,18 @@ feature 'group memberships through groups page', type: :feature do
end
end
context 'with an impaired user' do
before do
admin.impaired = true
admin.save!
end
context 'creating membership' do
context 'with an impaired user' do
before do
admin.impaired = true
admin.save!
end
it_behaves_like 'errors when adding members'
end
it_behaves_like 'errors when adding members'
end
context 'with an un-impaired user' do
it_behaves_like 'errors when adding members'
context 'with an un-impaired user' do
it_behaves_like 'errors when adding members'
end
end
end

Loading…
Cancel
Save