Combine version partials into one file

This commit is contained in:
BrokenEagle
2020-01-03 20:30:06 +00:00
parent 89df0a6ace
commit be92282990
15 changed files with 52 additions and 143 deletions

View File

@@ -1,33 +0,0 @@
<div id="p-revert-listing">
<%= table_for @commentary_versions, {class: "striped autofit", width: "100%"} do |t| %>
<% t.column "Post", {width: "5%"} do |commentary_version| %>
<%= link_to commentary_version.post_id, post_path(commentary_version.post_id) %>
<% end %>
<% t.column "Original" do |commentary_version| %>
<%= format_commentary_title(commentary_version.original_title) %>
<%= format_commentary_description(commentary_version.original_description) %>
<% end %>
<% t.column "Translated" do |commentary_version| %>
<%= format_commentary_title(commentary_version.translated_title) %>
<%= format_commentary_description(commentary_version.translated_description) %>
<% end %>
<% if CurrentUser.is_moderator? %>
<% t.column "IP Address", {width: "10%"} do |commentary_version| %>
<%= link_to_ip commentary_version.updater_ip_addr %>
<% end %>
<% end %>
<% t.column "Edited by", {width: "10%"} do |commentary_version| %>
<%= link_to_user commentary_version.updater %>
<% end %>
<% t.column "Date", {width: "10%"} do |commentary_version| %>
<%= compact_time commentary_version.updated_at %>
<% end %>
<% if CurrentUser.is_member? %>
<% t.column "", {width: "7%"} do |commentary_version| %>
<%= link_to "Revert to", revert_artist_commentary_path(commentary_version.post_id, :version_id => commentary_version.id), :remote => true, :method => :put, :data => {:confirm => "Are you sure you want to revert to this version?"} %>
<% end %>
<% end %>
<% end %>
</div>

View File

@@ -1,11 +1,17 @@
<div id="p-standard-listing">
<div id="p-<%= artist_commentary_versions_listing_type %>-listing">
<%= table_for @commentary_versions, {class: "striped autofit", width: "100%"} do |t| %>
<% t.column "Post", {width: "5%"} do |commentary_version| %>
<%= PostPresenter.preview(commentary_version.post, :tags => "status:any") %>
<% if artist_commentary_versions_listing_type == :revert %>
<%= link_to commentary_version.post_id, post_path(commentary_version.post_id) %>
<% else %>
<%= PostPresenter.preview(commentary_version.post, :tags => "status:any") %>
<% end %>
<% end %>
<% t.column "Version" do |commentary_version| %>
<%= link_to "#{commentary_version.post_id}.#{commentary_version.id}»", artist_commentary_versions_path(search: {post_id: commentary_version.post_id}) %>
<% if artist_commentary_versions_listing_type == :standard %>
<% t.column "Version" do |commentary_version| %>
<%= link_to "#{commentary_version.post_id}.#{commentary_version.id}»", artist_commentary_versions_path(search: {post_id: commentary_version.post_id}) %>
<% end %>
<% end %>
<% t.column "Original" do |commentary_version| %>
<%= format_commentary_title(commentary_version.original_title) %>
@@ -26,6 +32,11 @@
<% t.column "Date", {width: "10%"} do |commentary_version| %>
<%= compact_time commentary_version.updated_at %>
<% end %>
<% if artist_commentary_versions_listing_type == :revert %>
<% t.column "", {width: "7%"} do |commentary_version| %>
<%= link_to "Revert to", revert_artist_commentary_path(commentary_version.post_id, :version_id => commentary_version.id), :remote => true, :method => :put, :data => {:confirm => "Are you sure you want to revert to this version?"} %>
<% end %>
<% end %>
<% end %>
</div>

View File

@@ -4,11 +4,7 @@
<%= render "posts/partials/common/inline_blacklist" %>
<% if params.dig(:search, :post_id).present? %>
<%= render "revert_listing" %>
<% else %>
<%= render "standard_listing" %>
<% end %>
<%= render "standard_listing" %>
<%= numbered_paginator(@commentary_versions) %>