posts: rework post events page.
* Add a global /post_events page that shows the history of all approvals, disapprovals, flags, appeals, and replacements on a single page. * Redesign the /posts/:id/events page to show all approval, disapproval, flag, appeal, and replacement events for a single post (before it only showed approvals, flags, and appeals). * Remove the replacement history link from the post show page. Replacements are now included in the post events page (closes #4948: Highlighed replacements). * Add /post_approvals/:id and /post_replacements/:id routes (these are used by the "Details" link on the post events page).
This commit is contained in:
@@ -43,3 +43,5 @@
|
||||
<%= numbered_paginator(@post_appeals) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "post_events/secondary_links" %>
|
||||
|
||||
@@ -23,3 +23,5 @@
|
||||
<%= numbered_paginator(@post_approvals) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "post_events/secondary_links" %>
|
||||
|
||||
@@ -39,3 +39,5 @@
|
||||
<%= numbered_paginator(@post_disapprovals) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "post_events/secondary_links" %>
|
||||
|
||||
17
app/views/post_events/_secondary_links.html.erb
Normal file
17
app/views/post_events/_secondary_links.html.erb
Normal file
@@ -0,0 +1,17 @@
|
||||
<% content_for(:secondary_links) do %>
|
||||
<% case controller_name %>
|
||||
<% when "post_approvals" %>
|
||||
<%= quick_search_form_for(:user_name, post_approvals_path, "user", autocomplete: "user") %>
|
||||
<% when "post_disapprovals" %>
|
||||
<%= quick_search_form_for(:user_name, post_disapprovals_path, "user", autocomplete: "user") %>
|
||||
<% else %>
|
||||
<%= quick_search_form_for(:creator_name, url_for, "user", autocomplete: "user") %>
|
||||
<% end %>
|
||||
|
||||
<%= subnav_link_to "Events", post_events_path %>
|
||||
<%= subnav_link_to "Appeals", post_appeals_path %>
|
||||
<%= subnav_link_to "Approvals", post_approvals_path %>
|
||||
<%= subnav_link_to "Disapprovals", post_disapprovals_path %>
|
||||
<%= subnav_link_to "Flags", post_flags_path %>
|
||||
<%= subnav_link_to "Replacements", post_replacements_path %>
|
||||
<% end %>
|
||||
@@ -1,25 +1,106 @@
|
||||
<div id="c-post-events">
|
||||
<div id="a-index">
|
||||
<h1>Post Events</h1>
|
||||
<% if @post %>
|
||||
<h1>Events: <%= link_to @post.dtext_shortlink, @post %></h1>
|
||||
<%= link_to "« Back", post_events_path, class: "text-xs" %>
|
||||
<% else %>
|
||||
<h1>Events</h1>
|
||||
<% end %>
|
||||
|
||||
<%= table_for @events, class: "striped autofit", width: "100%" do |t| %>
|
||||
<% t.column :type_name, name: "Type" %>
|
||||
<% t.column "Description", td: { class: "col-expand" } do |event| %>
|
||||
<div class="prose">
|
||||
<%= format_text event.reason %>
|
||||
</div>
|
||||
<% unless @post %>
|
||||
<%= search_form_for(post_events_path) do |f| %>
|
||||
<%= f.input :creator_name, label: "User", input_html: { value: params[:search][:creator_name], "data-autocomplete": "user" } %>
|
||||
<%= f.input :post_tags_match, label: "Tags", input_html: { value: params[:search][:post_tags_match], "data-autocomplete": "tag-query" } %>
|
||||
<%= f.input :model_type, label: "Category", collection: PostEvent.model_types.map { |type| [type.titleize.delete_prefix("Post "), type] }, include_blank: true, selected: params[:search][:model_type] %>
|
||||
<%= f.input :order, collection: [%w[Newest event_at], %w[Oldest event_at_asc]], include_blank: true, selected: params[:search][:order] %>
|
||||
<%= f.submit "Search" %>
|
||||
<% end %>
|
||||
<% t.column "Status" do |event| %>
|
||||
<%= event.status %>
|
||||
<% end %>
|
||||
|
||||
<%= table_for @post_events, class: "striped autofit mt-4", width: "100%" do |t| %>
|
||||
<% t.column "Event", td: { class: "col-expand" } do |event| %>
|
||||
<% post = event.post %>
|
||||
<% model = event.model %>
|
||||
<% creator = event.creator %>
|
||||
|
||||
<% case event.model_type %>
|
||||
<% when "Post" %>
|
||||
<%= link_to post.dtext_shortlink, post %> was uploaded by <%= link_to_user creator %>.
|
||||
<% when "PostAppeal" %>
|
||||
<div class="prose">
|
||||
<%= link_to post.dtext_shortlink, post %> was appealed by <%= link_to_user creator %><%= " (#{format_text(model.reason.strip.chomp("."), inline: true)})".html_safe if model.reason.present? %>.
|
||||
</div>
|
||||
<% when "PostApproval" %>
|
||||
<%= link_to post.dtext_shortlink, post %> was approved by <%= link_to_user creator %>.
|
||||
<% when "PostDisapproval" %>
|
||||
<div class="prose">
|
||||
<% if policy(model).can_view_creator? %>
|
||||
<%= link_to post.dtext_shortlink, post %> was disapproved by <%= link_to_user creator %> (<%= model.reason.titleize.downcase %><%= ": ".html_safe + format_text(model.message.strip.chomp("."), inline: true) if model.message.present? %>).
|
||||
<% else %>
|
||||
<%= link_to post.dtext_shortlink, post %> was disapproved (<%= model.reason.titleize.downcase %><%= ": ".html_safe + format_text(model.message.strip.chomp("."), inline: true) if model.message.present? %>).
|
||||
<% end %>
|
||||
</div>
|
||||
<% when "PostFlag" %>
|
||||
<div class="prose">
|
||||
<% if policy(model).can_view_flagger? %>
|
||||
<%= link_to post.dtext_shortlink, post %> was flagged by <%= link_to_user creator %> (<%= format_text(model.reason.strip.chomp("."), inline: true) %>).
|
||||
<% else %>
|
||||
<%= link_to post.dtext_shortlink, post %> was flagged (<%= format_text(model.reason.strip.chomp("."), inline: true) %>).
|
||||
<% end %>
|
||||
</div>
|
||||
<% when "PostReplacement" %>
|
||||
<% if model.old_file_size && model.old_file_ext && model.old_image_width && model.old_image_height && model.file_size && model.file_ext && model.image_width && model.image_height %>
|
||||
<%= link_to post.dtext_shortlink, post %> was replaced by <%= link_to_user creator %>
|
||||
(<%= external_link_to model.original_url.presence || "none", Source::URL.site_name(model.original_url) || model.original_url %>,
|
||||
<%= model.old_file_size.to_formatted_s(:human_size, precision: 4) %> .<%= model.old_file_ext %>, <%= model.old_image_width %>x<%= model.old_image_height %> ->
|
||||
<%= external_link_to model.replacement_url, Source::URL.site_name(model.replacement_url) || model.replacement_url %>,
|
||||
<%= model.file_size.to_formatted_s(:human_size, precision: 4) %> .<%= model.file_ext %>, <%= model.image_width %>x<%= model.image_height %>).
|
||||
<% else %>
|
||||
<%= link_to post.dtext_shortlink, post %> was replaced by <%= link_to_user creator %>
|
||||
(<%= external_link_to model.original_url.presence || "none", Source::URL.site_name(model.original_url) || model.original_url %> ->
|
||||
<%= external_link_to model.replacement_url, Source::URL.site_name(model.replacement_url) || model.replacement_url %>).
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% t.column "Category" do |event| %>
|
||||
<%= link_to event.model_type.titleize.delete_prefix("Post "), post_events_path(search: { model_type: event.model_type, **search_params }) %>
|
||||
<% end %>
|
||||
|
||||
<% t.column "User" do |event| %>
|
||||
<% if event.is_creator_visible? %>
|
||||
<%= link_to_user event.creator %>
|
||||
<% if policy(event).can_see_creator? %>
|
||||
<%= link_to_user event.creator %> <%= link_to "»", post_events_path(search: { **search_params, creator_name: event.creator.name }) %>
|
||||
<% else %>
|
||||
<i>hidden</i>
|
||||
<% end %>
|
||||
<br><%= time_ago_in_words_tagged event.created_at %>
|
||||
<div><%= time_ago_in_words_tagged(event.event_at) %></div>
|
||||
<% end %>
|
||||
|
||||
<% t.column column: "control" do |event| %>
|
||||
<%= render PopupMenuComponent.new do |menu| %>
|
||||
<% unless @post %>
|
||||
<% menu.item do %>
|
||||
<%= link_to "Post history", post_post_events_path(event.post) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if policy(event).can_see_creator? %>
|
||||
<% menu.item do %>
|
||||
<%= link_to "User history", post_events_path(search: { creator_name: event.creator.name }) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if policy(event).can_see_creator? %>
|
||||
<% menu.item do %>
|
||||
<%= link_to "Details", event.model %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<%= numbered_paginator(@post_events) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "secondary_links" %>
|
||||
|
||||
@@ -48,3 +48,5 @@
|
||||
<%= numbered_paginator(@post_flags) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "post_events/secondary_links" %>
|
||||
|
||||
@@ -66,3 +66,5 @@
|
||||
<%= numbered_paginator(@post_replacements) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "post_events/secondary_links" %>
|
||||
|
||||
@@ -188,9 +188,8 @@
|
||||
<li id="post-history-tags"><%= link_to "Tags", post_versions_path(search: { post_id: @post.id }) %></li>
|
||||
<li id="post-history-pools"><%= link_to "Pools", pool_versions_path(search: { post_id: @post.id }) %></li>
|
||||
<li id="post-history-notes"><%= link_to "Notes", note_versions_path(search: { post_id: @post.id }) %></li>
|
||||
<li id="post-history-moderation"><%= link_to "Moderation", post_events_path(@post.id) %></li>
|
||||
<li id="post-history-moderation"><%= link_to "Moderation", post_post_events_path(@post.id) %></li>
|
||||
<li id="post-history-commentary"><%= link_to "Commentary", artist_commentary_versions_path(search: { post_id: @post.id }) %></li>
|
||||
<li id="post-history-replacements"><%= link_to "Replacements", post_replacements_path(search: {post_id: @post.id }) %></li>
|
||||
</ul>
|
||||
</section>
|
||||
<% end %>
|
||||
|
||||
@@ -18,9 +18,10 @@
|
||||
<ul>
|
||||
<li><h2>Post Events</h2></li>
|
||||
<li><%= link_to("Tag History", post_versions_path) %></li>
|
||||
<li><%= link_to("Events", post_events_path) %></li>
|
||||
<li><%= link_to("Appeals", post_appeals_path) %></li>
|
||||
<li><%= link_to("Approvals", post_approvals_path) %></li>
|
||||
<li><%= link_to("Disapprovals", post_disapprovals_path) %></li>
|
||||
<li><%= link_to("Appeals", post_appeals_path) %></li>
|
||||
<li><%= link_to("Flags", post_flags_path) %></li>
|
||||
<li><%= link_to("Replacements", post_replacements_path) %></li>
|
||||
</ul>
|
||||
|
||||
Reference in New Issue
Block a user