docbrown/app/views/admin/users/_activity.html.erb
Julianna Tetreault 71b35f28a0
Remove Roles via Admin (#12582) [deploy]
* Add the ability to remove a role from a non-super_admin in Admin::UsersController
 - Adds a #destroy action to the Admin::UsersController
 - Adds a destroy route for the action

* Add a removal button to non-super_admin roles on admin user pages
  - Pulls Current Roles out of _activity and into own partial
  - Adds a _current_roles partial to /admin/users/show
  - Adds REMOVE buttons to non-super_admin roles
  - Conditionally renders REMOVE buttons for certain roles only

* Add tests around the removal of roles to users_manage_spec

* Adjust formatting of link_to in _current_roles.html.erb

* Use :aggregate_failures in role-related tests in users_manage_spec.rb

* Refactors Admin::UsersController#destroy and role params

* Update admin/users_spec.rb to take into account _current_roles partial

* Replace REMOVE text with X on role removal buttons

* Add additional elsif to handle single_resource_admin removal
  - Adds resource_type params to Admin::UsersController
  - Adds elsif to handle removal of single_resource_admin roles
  - Adds resource_type to the removal button in _current_roles
  - Adds a spec around removing single_resource_admin roles

* Add .constantize to resource_type in Admin::UsersController

* Move .constantize to resource_type arg rather than params in #destroy

* Use .safe_constantize rather than .constantize for params[:resource_type]

* Remove .safe_constantize from params and onto inline var instead

* Add nil check to removal of :single_resource_admin role in #destroy

* Update users_manage_spec.rb to remove proper role in test

* Add resource_name to current user and super admin _current_roles list

* Add additional test around removing :single_resource_admin role
2021-02-16 10:50:10 -07:00

13 lines
438 B
Text

<div class="row">
<div class="col-sm-6">
<h2>Activity</h2>
<ul>
<li><%= @user.comments_count %> comments</li>
<li><%= @user.articles_count %> articles</li>
<li><%= @user.reactions_count %> reactions</li>
<li><%= @user.followers_count %> followers</li>
<li><%= @user.following_users_count %> users following</li>
<li><%= @user.badge_achievements_count %> badges</li>
</ul>
</div>
</div>