Extract component to add/remove admin/mod/manager
We remove some duplication by doing so.
This commit is contained in:
@@ -29,7 +29,10 @@
|
||||
<%= administrator.description %>
|
||||
</td>
|
||||
<td>
|
||||
<%= render Admin::TableActionsComponent.new(administrator) %>
|
||||
<%= render Admin::Roles::TableActionsComponent.new(
|
||||
administrator,
|
||||
actions: [:edit, :destroy]
|
||||
) %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
@@ -18,16 +18,7 @@
|
||||
<td><%= user.name %></td>
|
||||
<td><%= user.email %></td>
|
||||
<td>
|
||||
<% if user.administrator? && user.administrator.persisted? %>
|
||||
<%= render Admin::TableActionsComponent.new(user.administrator, actions: [:destroy]) %>
|
||||
<% else %>
|
||||
<%= link_to t("admin.administrators.administrator.add"),
|
||||
{ controller: "admin/administrators",
|
||||
action: :create,
|
||||
user_id: user },
|
||||
method: :post,
|
||||
class: "button success expanded" %>
|
||||
<% end %>
|
||||
<%= render Admin::Roles::TableActionsComponent.new(user.administrator || user.build_administrator) %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user