Differentiate version views with reversion links

This commit is contained in:
BrokenEagle
2018-01-01 18:45:46 -08:00
parent c3aff42458
commit 613beee375
15 changed files with 467 additions and 205 deletions

View File

@@ -0,0 +1,50 @@
<div id="p-revert-listing">
<table width="100%" class="striped autofit">
<thead>
<tr>
<th width="5%">Post</th>
<th>Original</th>
<th>Translated</th>
<% if CurrentUser.is_moderator? %>
<th width="10%">IP Address</th>
<% end %>
<th width="10%">Edited By</th>
<th width="10%">Date</th>
<% if CurrentUser.is_member? %>
<th width="7%"></th>
<% end %>
</tr>
</thead>
<tbody>
<% @commentary_versions.each do |commentary_version| %>
<tr>
<td><%= link_to commentary_version.post_id, post_path(commentary_version.post_id) %></td>
<td>
<h3><%= h(commentary_version.original_title) %></h3>
<div class="prose">
<%= format_text(commentary_version.original_description, :disable_mentions => true) %>
</div>
</td>
<td>
<h3><%= h(commentary_version.translated_title) %></h3>
<div class="prose">
<%= format_text(commentary_version.translated_description, :disable_mentions => true) %>
</div>
</td>
<% if CurrentUser.is_moderator? %>
<td>
<%= link_to_ip commentary_version.updater_ip_addr %>
</td>
<% end %>
<td><%= link_to_user commentary_version.updater %></td>
<td><%= compact_time commentary_version.updated_at %></td>
<% if CurrentUser.is_member? %>
<td>
<%= 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?"} %>
</td>
<% end %>
</tr>
<% end %>
</tbody>
</table>
</div>

View File

@@ -0,0 +1,44 @@
<div id="p-standard-listing">
<table width="100%" class="striped autofit">
<thead>
<tr>
<th width="5%">Post</th>
<th>Version</th>
<th>Original</th>
<th>Translated</th>
<% if CurrentUser.is_moderator? %>
<th width="10%">IP Address</th>
<% end %>
<th width="10%">Edited By</th>
<th width="10%">Date</th>
</tr>
</thead>
<tbody>
<% @commentary_versions.each do |commentary_version| %>
<tr>
<td><%= PostPresenter.preview(commentary_version.post, :tags => "status:any") %></td>
<td><%= link_to "#{commentary_version.post_id}.#{commentary_version.id}»", artist_commentary_versions_path(search: {post_id: commentary_version.post_id}) %></td>
<td>
<h3><%= h(commentary_version.original_title) %></h3>
<div class="prose">
<%= format_text(commentary_version.original_description, :disable_mentions => true) %>
</div>
</td>
<td>
<h3><%= h(commentary_version.translated_title) %></h3>
<div class="prose">
<%= format_text(commentary_version.translated_description, :disable_mentions => true) %>
</div>
</td>
<% if CurrentUser.is_moderator? %>
<td>
<%= link_to_ip commentary_version.updater_ip_addr %>
</td>
<% end %>
<td><%= link_to_user commentary_version.updater %></td>
<td><%= compact_time commentary_version.updated_at %></td>
</tr>
<% end %>
</tbody>
</table>
</div>

View File

@@ -4,60 +4,11 @@
<%= render "posts/partials/common/inline_blacklist" %>
<table width="100%" class="striped">
<thead>
<tr>
<th width="5%">Post</th>
<th>Original</th>
<th>Translated</th>
<% if CurrentUser.is_moderator? %>
<th width="10%">IP Address</th>
<% end %>
<th width="10%">Edited By</th>
<th width="10%">Date</th>
<% if CurrentUser.is_member? %>
<th width="7%"></th>
<% end %>
</tr>
</thead>
<tbody>
<% @commentary_versions.each do |commentary_version| %>
<tr>
<td>
<% if params.dig(:search, :post_id).present? %>
<%= link_to commentary_version.post_id, post_path(commentary_version.post_id) %>
<% else %>
<%= PostPresenter.preview(commentary_version.post, :tags => "status:any") %>
<% end %>
</td>
<td>
<h3><%= h(commentary_version.original_title) %></h3>
<div class="prose">
<%= format_text(commentary_version.original_description, :disable_mentions => true) %>
</div>
</td>
<td>
<h3><%= h(commentary_version.translated_title) %></h3>
<div class="prose">
<%= format_text(commentary_version.translated_description, :disable_mentions => true) %>
</div>
</td>
<% if CurrentUser.is_moderator? %>
<td>
<%= link_to_ip commentary_version.updater_ip_addr %>
</td>
<% end %>
<td><%= link_to_user commentary_version.updater %></td>
<td><%= compact_time commentary_version.updated_at %></td>
<% if CurrentUser.is_member? %>
<td>
<%= 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?"} %>
</td>
<% end %>
</tr>
<% end %>
</tbody>
</table>
<% if params.dig(:search, :post_id).present? %>
<%= render "revert_listing" %>
<% else %>
<%= render "standard_listing" %>
<% end %>
<%= numbered_paginator(@commentary_versions) %>