Commit 5f7895c386d4d9f7ed9795e52060b80023855bee
Committed by
Rodrigo Souto
1 parent
7b90808f
Exists in
master
and in
26 other branches
Merge request revision
- Fixed search method for members - Fixed headings and misplaced divs - Fixed tests for better reliability
Showing
7 changed files
with
18 additions
and
16 deletions
Show diff stats
app/controllers/my_profile/profile_roles_controller.rb
... | ... | @@ -31,7 +31,7 @@ class ProfileRolesController < MyProfileController |
31 | 31 | def assign_role_by_members |
32 | 32 | return redirect_to "/" if params[:q].nil? or !request.xhr? |
33 | 33 | arg = params[:q].downcase |
34 | - result = profile.members.where('LOWER(name) LIKE ?', "%#{arg}%") | |
34 | + result = find_by_contents(:people, environment, profile.members, params[:q])[:results] | |
35 | 35 | render :text => prepare_to_token_input(result).to_json |
36 | 36 | end |
37 | 37 | ... | ... |
app/views/profile_roles/assign.html.erb
1 | 1 | <%= javascript_include_tag('assign_role.js') %> |
2 | 2 | |
3 | -<h2> <%= _("Assign #{@role.name}") %> </h2> | |
3 | +<h1> <%= _("Assign #{@role.name}") %> </h1> | |
4 | 4 | |
5 | 5 | |
6 | 6 | <%= labelled_form_for :role, :url => { :action => 'define', :id => @role.id } do |f| %> |
7 | 7 | |
8 | - <h4> | |
8 | + <h2> | |
9 | 9 | <%= _("Assign role by:") %> |
10 | - </h3> | |
10 | + </h2> | |
11 | 11 | <p> |
12 | 12 | <%= labelled_radio_button _("Members"), :assign_role_by, "members", true, :id => "assign_role_by_members", :class => "assign_role_by" %> |
13 | 13 | |
14 | 14 | <%= labelled_radio_button _("Roles"), :assign_role_by, "roles", false, :id => "assign_role_by_roles", :class => "assign_role_by" %> |
15 | 15 | </p> |
16 | 16 | <div class="assign_by_members"> |
17 | - <%=token_input_field_tag(:person_id, 'search-article-privacy-exceptions', {:action => 'assign_role_by_members'}, | |
17 | + <%=token_input_field_tag(:person_id, 'search-profile-members', {:action => 'assign_role_by_members'}, | |
18 | 18 | {:focus => false, :hint_text => _('Select members to assign the role')}) %> |
19 | 19 | |
20 | 20 | <% button_bar do %> | ... | ... |
app/views/profile_roles/destroy.html.erb
app/views/profile_roles/edit.html.erb
app/views/profile_roles/index.html.erb
... | ... | @@ -11,9 +11,11 @@ |
11 | 11 | <%= link_to role.name, :action => 'show', :id => role %> |
12 | 12 | </td> |
13 | 13 | <td> |
14 | - <%= button_without_text :edit, _('Edit'), :action => 'edit', :id => role %> | |
15 | - <%= button_without_text :delete, _('Delete'), :action => 'destroy', :id => role %> | |
16 | - <%= button_without_text 'vertical-toggle', _('Assign'), :action => 'assign', :id => role %> | |
14 | + <div style="text-align: center;"> | |
15 | + <%= button_without_text :edit, _('Edit'), :action => 'edit', :id => role %> | |
16 | + <%= button_without_text :delete, _('Delete'), :action => 'destroy', :id => role %> | |
17 | + <%= button_without_text 'vertical-toggle', _('Assign'), :action => 'assign', :id => role %> | |
18 | + </div> | |
17 | 19 | </td> |
18 | 20 | </tr> |
19 | 21 | <% end %> | ... | ... |
app/views/profile_roles/new.html.erb
test/functional/profile_roles_controller_test.rb
... | ... | @@ -15,9 +15,9 @@ class ProfileRolesControllerTest < ActionController::TestCase |
15 | 15 | admin = create_user_with_permission('admin_user', 'manage_custom_roles', community) |
16 | 16 | login_as :admin_user |
17 | 17 | post :create, :profile => community.identifier, :role => {:name => "some_role", :permissions => ["edit_profile"] } |
18 | - role = Role.last | |
18 | + role = Role.where(:name => 'some_role').first | |
19 | 19 | |
20 | - assert_equal "some_role" , role.name | |
20 | + assert_not_nil role | |
21 | 21 | assert_equal community.id, role.profile_id |
22 | 22 | end |
23 | 23 | |
... | ... | @@ -25,14 +25,14 @@ class ProfileRolesControllerTest < ActionController::TestCase |
25 | 25 | community = fast_create(Community) |
26 | 26 | moderator = create_user_with_permission('profile_admin', 'edit_profile', community) |
27 | 27 | login_as :profile_admin |
28 | - post :create, :profile => community.identifier, :role => {:name => "admin", :permissions => ["edit_profile"] } | |
28 | + post :create, :profile => community.identifier, :role => {:name => "new_admin", :permissions => ["edit_profile"] } | |
29 | 29 | |
30 | 30 | assert_response 403 |
31 | 31 | assert_template 'access_denied' |
32 | 32 | |
33 | - role = Role.last | |
33 | + role = Role.where(:name => 'new_admin') | |
34 | 34 | |
35 | - assert_not_equal "admin" , role.name | |
35 | + assert_empty role | |
36 | 36 | end |
37 | 37 | |
38 | 38 | ... | ... |