diff --git a/app/controllers/my_profile/profile_roles_controller.rb b/app/controllers/my_profile/profile_roles_controller.rb index b0863a9..f5f4cb3 100644 --- a/app/controllers/my_profile/profile_roles_controller.rb +++ b/app/controllers/my_profile/profile_roles_controller.rb @@ -31,7 +31,7 @@ class ProfileRolesController < MyProfileController def assign_role_by_members return redirect_to "/" if params[:q].nil? or !request.xhr? arg = params[:q].downcase - result = profile.members.where('LOWER(name) LIKE ?', "%#{arg}%") + result = find_by_contents(:people, environment, profile.members, params[:q])[:results] render :text => prepare_to_token_input(result).to_json end diff --git a/app/views/profile_roles/assign.html.erb b/app/views/profile_roles/assign.html.erb index 0bb8b34..542b19e 100644 --- a/app/views/profile_roles/assign.html.erb +++ b/app/views/profile_roles/assign.html.erb @@ -1,20 +1,20 @@ <%= javascript_include_tag('assign_role.js') %> -

<%= _("Assign #{@role.name}") %>

+

<%= _("Assign #{@role.name}") %>

<%= labelled_form_for :role, :url => { :action => 'define', :id => @role.id } do |f| %> -

+

<%= _("Assign role by:") %> -

+

<%= labelled_radio_button _("Members"), :assign_role_by, "members", true, :id => "assign_role_by_members", :class => "assign_role_by" %>   <%= labelled_radio_button _("Roles"), :assign_role_by, "roles", false, :id => "assign_role_by_roles", :class => "assign_role_by" %>

- <%=token_input_field_tag(:person_id, 'search-article-privacy-exceptions', {:action => 'assign_role_by_members'}, + <%=token_input_field_tag(:person_id, 'search-profile-members', {:action => 'assign_role_by_members'}, {:focus => false, :hint_text => _('Select members to assign the role')}) %> <% button_bar do %> diff --git a/app/views/profile_roles/destroy.html.erb b/app/views/profile_roles/destroy.html.erb index 94bfb8c..a790578 100644 --- a/app/views/profile_roles/destroy.html.erb +++ b/app/views/profile_roles/destroy.html.erb @@ -1,4 +1,4 @@ -

<%= _("Deleting #{@role.name}") %>

+

<%= _("Deleting #{@role.name}") %>

<% if @members.nil? || @members.empty? %>

<%= _('This role is not being currently used.')%>

diff --git a/app/views/profile_roles/edit.html.erb b/app/views/profile_roles/edit.html.erb index 04dd3ea..52b87aa 100644 --- a/app/views/profile_roles/edit.html.erb +++ b/app/views/profile_roles/edit.html.erb @@ -1,3 +1,3 @@ -

<%= _("Editing #{@role.name}") %>

+

<%= _("Editing #{@role.name}") %>

<%= render :partial => 'form', :locals => { :mode => :edit, :role => @role, :permissions => [@role.kind] } %> diff --git a/app/views/profile_roles/index.html.erb b/app/views/profile_roles/index.html.erb index aeb4369..3720375 100644 --- a/app/views/profile_roles/index.html.erb +++ b/app/views/profile_roles/index.html.erb @@ -11,9 +11,11 @@ <%= link_to role.name, :action => 'show', :id => role %> - <%= button_without_text :edit, _('Edit'), :action => 'edit', :id => role %> - <%= button_without_text :delete, _('Delete'), :action => 'destroy', :id => role %> - <%= button_without_text 'vertical-toggle', _('Assign'), :action => 'assign', :id => role %> +
+ <%= button_without_text :edit, _('Edit'), :action => 'edit', :id => role %> + <%= button_without_text :delete, _('Delete'), :action => 'destroy', :id => role %> + <%= button_without_text 'vertical-toggle', _('Assign'), :action => 'assign', :id => role %> +
<% end %> diff --git a/app/views/profile_roles/new.html.erb b/app/views/profile_roles/new.html.erb index 69e3f9f..8f69b99 100644 --- a/app/views/profile_roles/new.html.erb +++ b/app/views/profile_roles/new.html.erb @@ -1,3 +1,3 @@ -

<%= _("Create a new role") %>

+

<%= _("Create a new role") %>

<%= render :partial => 'form', :locals => { :mode => :create, :role => @role, :permissions => ['Profile'] } %> diff --git a/test/functional/profile_roles_controller_test.rb b/test/functional/profile_roles_controller_test.rb index d849c8a..0d83cc9 100644 --- a/test/functional/profile_roles_controller_test.rb +++ b/test/functional/profile_roles_controller_test.rb @@ -15,9 +15,9 @@ class ProfileRolesControllerTest < ActionController::TestCase admin = create_user_with_permission('admin_user', 'manage_custom_roles', community) login_as :admin_user post :create, :profile => community.identifier, :role => {:name => "some_role", :permissions => ["edit_profile"] } - role = Role.last + role = Role.where(:name => 'some_role').first - assert_equal "some_role" , role.name + assert_not_nil role assert_equal community.id, role.profile_id end @@ -25,14 +25,14 @@ class ProfileRolesControllerTest < ActionController::TestCase community = fast_create(Community) moderator = create_user_with_permission('profile_admin', 'edit_profile', community) login_as :profile_admin - post :create, :profile => community.identifier, :role => {:name => "admin", :permissions => ["edit_profile"] } + post :create, :profile => community.identifier, :role => {:name => "new_admin", :permissions => ["edit_profile"] } assert_response 403 assert_template 'access_denied' - role = Role.last + role = Role.where(:name => 'new_admin') - assert_not_equal "admin" , role.name + assert_empty role end -- libgit2 0.21.2