* Refactors _banish.html.erb by removing duplicate code * Refactors _banish.html.erb to account for new and old users * Moves conditional into Admin::UsersController#set_user_to_be_banished * Reverts last commit, as it didnt work as expected * Fixes last commit, which reverted to the incorrect code * Pulls banishable user into instance var and fixes button txt
14 lines
891 B
Text
14 lines
891 B
Text
<div id="banish-for-spam">
|
|
<div class="flex flex-col gap-4">
|
|
<% if @banishable_user %>
|
|
<p>This action is irreversible.</p>
|
|
<p>Once banished, we will delete all content created by <%= @user.name %> and change their username to @spam_###.</p>
|
|
<p>Be careful with this action.</p>
|
|
<%= form_for(@user, url: banish_admin_user_path(@user), html: { method: :post, onsubmit: "return confirm('Are you sure? This action is irreversible. Banishing will delete all content by #{@user.name} and change their username to @spam_###.')", id: nil }) do %>
|
|
<button class="c-btn c-btn--primary c-btn--destructive">Banish <%= @user.name %></button>
|
|
<% end %>
|
|
<% else %>
|
|
<div class="crayons-notice crayons-notice--danger">This is not a new user. Only Super Admins or Support Admins are allowed to banish <%= @user.name %>.</div>
|
|
<% end %>
|
|
</div>
|
|
</div>
|