Extract component to show moderation actions
Note that in proposal notifications we're writing the call to render the component in the same line as the <div class="reply"> definition in order to be able to use the `:empty` selector when the component renders nothing. No browser matches whitespace with the `:empty` selector, so we can't add newline characters inside the tag. A more elegant solution would be extracting the proposal notification actions to a component and only rendering it if the moderation actions component is rendered.
This commit is contained in:
12
app/components/shared/moderation_actions_component.html.erb
Normal file
12
app/components/shared/moderation_actions_component.html.erb
Normal file
@@ -0,0 +1,12 @@
|
||||
<span class="moderation-actions">
|
||||
<% if can? :hide, record %>
|
||||
<%= link_to t("admin.actions.hide").capitalize, hide_path,
|
||||
method: :put, remote: true, data: { confirm: confirm_hide_text } %>
|
||||
<% end %>
|
||||
|
||||
<% if can? :hide, record.author %>
|
||||
<%= raw separator %>
|
||||
<%= link_to t("admin.actions.hide_author").capitalize, hide_moderation_user_path(record.author_id),
|
||||
method: :put, data: { confirm: confirm_hide_author_text } %>
|
||||
<% end %>
|
||||
</span>
|
||||
Reference in New Issue
Block a user