% title t("views.moderations.actions.meta.title2", title: @moderatable.title) %>
<%= javascript_packs_with_chunks_tag "commentModPage", defer: true %>
<% cache(release_adjusted_cache_key("mod-styling")) do %>
<% end %>
<% if flash[:error].present? %>
<% if @moderatable.class.name == "Article" &&
(Tag.where(requires_approval: true).pluck(:name) & @moderatable.decorate.cached_tag_list_array).any? &&
(current_user.any_admin? || @tag_moderator_tags.any? { |tag| @moderatable.tag_list.include?(tag.name) }) %>
<%= form_tag "/article_approvals", method: "post" do %>
<%= hidden_field_tag(:id, @moderatable.id) %>
<% if @moderatable.approved %>
<%= hidden_field_tag(:approved, false) %>
<% else %>
<%= hidden_field_tag(:approved, true) %>
<% end %>
<% end %>
<% end %>
<% if current_user.has_role?(:super_admin) && @moderatable.class.name == "Article" %>
<% elsif current_user.has_role?(:super_admin) && @moderatable.class.name == "Comment" %>
<% end %>
<%= t("views.moderations.actions.hint.subtitle") %>
<%= t("views.moderations.actions.hint.desc_html") %>
<% if current_user.any_admin? && @moderatable.class.name == "Comment" && !@moderatable.deleted %>
<%= t("views.moderations.actions.delete.subtitle") %>
<%= button_to t("views.moderations.actions.delete.button"), comment_admin_delete_path(@moderatable.id), method: :patch, class: "crayons-btn crayons-btn--secondary ml-2" %>
<% end %>
<% if @hidden_comments.present? %>
<%= t("views.moderations.actions.hidden.subtitle") %>
<% end %>
<% if @allowed_to_adjust %>
<%= t("views.moderations.actions.tag.subtitle") %>
<%= form_for(@tag_adjustment) do |f| %>
<%= t("views.moderations.actions.tag.live_html", tags: @moderatable.tag_list) %>
<% if @tag_adjustment.errors.any? %>
<%= t("views.moderations.actions.errors", count: @tag_adjustment.errors.count) %>
<% @tag_adjustment.errors.full_messages.each do |message| %>
- <%= message %>
<% end %>
<% end %>
<%= f.hidden_field :article_id, value: @moderatable.id %>
<% if current_user.any_admin? || @tag_moderator_tags.any? { |tag| @moderatable.tag_list.include?(tag.name) } %>
<%= f.radio_button :adjustment_type, "removal", required: true %>
<%= f.label :adjustment_type, t("views.moderations.actions.tag.remove"), value: "removal" %>
<% end %>
<% if @moderatable.tag_list.size < 4 %>
<%= f.radio_button :adjustment_type, "addition", required: true %>
<%= f.label :adjustment_type, t("views.moderations.actions.tag.add"), value: "addition" %>
<% end %>
<% if current_user.has_role?(:super_admin) %>
<%= f.text_field :tag_name, placeholder: t("views.moderations.actions.tag.tag_name"), required: true %>
<% else %>
<%= f.select :tag_name, @tag_moderator_tags, { prompt: t("views.moderations.actions.tag.select") }, required: true %>
<% end %>
<%= f.text_area :reason_for_adjustment, placeholder: t("views.moderations.actions.tag.reason"), required: true %>
<%= f.submit t("views.moderations.actions.tag.submit") %>
<% end %>
<% if @adjustments.present? %>
<% @adjustments.each do |adjustment| %>
<% if current_user.any_admin? || adjustment.user_id == current_user.id %>
<%= form_for(adjustment, url: "/tag_adjustments/#{adjustment.id}",
html: { method: :delete, onsubmit: "return confirm('#{t('views.moderations.actions.tag.undo.confirm', type: t("views.moderations.actions.tag.undo.type.#{adjustment.adjustment_type}"), tag: adjustment.tag_name)}')" }) do |f| %>
<%= t("views.moderations.actions.tag.#{adjustment.adjustment_type == 'removal' ? 'removed' : 'added'}_html", tag: adjustment.tag_name) %>
<%= f.submit t("views.moderations.actions.tag.undo.button"), id: "undo" %>
<% end %>
<% end %>
<% end %>
<% end %>
<% end %>
<% if @moderatable.class.name == "Article" %>
<% end %>