docbrown/app/views/admin/users/_current_roles.html.erb
Jacob Herrington a5b2d109d5
Rename banned and comment_banned roles (#12270)
* Rename banned and comment_banned roles

* Add data update script to rename roles containing 'ban'

* Add named error for Suspended users

* Update unidiomatic method names

* Rename misc banned to suspended

* Apply suggestions from code review

Co-authored-by: Michael Kohl <me@citizen428.net>

* Add unit tests for suspended methods

This commit also adds TODO comments for removing banned and
comment_banned from the codebase after data update scripts have
successfully run on all of our Forems.

Co-authored-by: Michael Kohl <me@citizen428.net>
2021-04-06 10:12:14 -05:00

19 lines
1,006 B
Text

<div class="crayons-card p-6 grid gap-2">
<h2>Current Roles</h2>
<p>(View full history in notes below)</p>
<div class="crayons-card__body">
<ul>
<% @user.roles.each do |role| %>
<% if role.name == "banned" || role.name == "suspended" || role.name == "super_admin" || @user.id == current_user.id %>
<li><%= role_display_name(role) %> <em><%= role.resource_name.to_s %></em></li>
<% else %>
<li>
<%= role_display_name(role) %> <em><%= role.resource_name.to_s %></em> &nbsp;
<%= link_to "X", url_for(action: :destroy, user_id: @user.id, role: role.name.to_sym, resource_type: role.resource_type), method: :delete, data: { confirm: "Are you sure?" },
class: "crayons-btn crayons-btn--danger crayons-btn--s lh-base fs-xs" %>
</li>
<% end %>
<% end %>
</ul>
</div>
</div>