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,45 +0,0 @@
<div id="p-revert-listing">
<%= table_for @note_versions, {class: "striped autofit", width: "100%"} do |t| %>
<% t.column %>
<% t.column "Post", {width: "5%"} do |note_version| %>
<%= link_to note_version.post_id, post_path(note_version.post_id) %>
<% if params.dig(:search, :note_id).present? %>
<%= link_to "»", note_versions_path(search: {post_id: note_version.post_id}) %>
<% end %>
<% end %>
<% t.column "Note", {width: "5%"} do |note_version| %>
<%= link_to "#{note_version.note_id}.#{note_version.version}", post_path(note_version.post_id, anchor: "note-#{note_version.note_id}") %>
<% if params.dig(:search, :post_id).present? %>
<%= link_to "»", note_versions_path(search: {note_id: note_version.note_id}) %>
<% end %>
<% end %>
<% t.column "Body", nil, {class: "col-expand"} do |note_version| %>
<%= h(note_version.body) %>
<% unless note_version.is_active? %>
<span class="inactive">(deleted)</span>
<% end %>
<%= note_version_body_diff_info(note_version) %>
<% end %>
<% t.column "Position", {width: "5%"} do |note_version| %>
<%= note_version_position_diff(note_version) %>
<% end %>
<% if CurrentUser.is_moderator? %>
<% t.column "IP Address", {width: "10%"} do |note_version| %>
<%= link_to_ip note_version.updater_ip_addr %>
<% end %>
<% end %>
<% t.column "Edited By", {width: "10%"} do |note_version| %>
<%= link_to_user note_version.updater %>
<% end %>
<% t.column "Date", {width: "10%"} do |note_version| %>
<%= compact_time note_version.updated_at %>
<% end %>
<% if CurrentUser.is_member? %>
<% t.column "", {width: "7%"} do |note_version| %>
<%= link_to "Revert to", revert_note_path(note_version.note_id, :version_id => note_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,4 +1,4 @@
<div id="p-standard-listing">
<div id="p-<%= note_versions_listing_type %>-listing">
<%= table_for @note_versions, {class: "striped autofit", width: "100%"} do |t| %>
<% t.column %>
@@ -35,6 +35,11 @@
<% t.column "Date", {width: "10%"} do |note_version| %>
<%= compact_time note_version.updated_at %>
<% end %>
<% if note_versions_listing_type == :revert %>
<% t.column "", {width: "7%"} do |note_version| %>
<%= link_to "Revert to", revert_note_path(note_version.note_id, :version_id => note_version.id), :remote => true, :method => :put, :data => {:confirm => "Are you sure you want to revert to this version?"} %>
<% end %>
<% end %>
<% end %>
</div>

View File

@@ -2,11 +2,7 @@
<div id="a-index">
<h1>Note Changes</h1>
<% if params.dig(:search, :post_id).present? || params.dig(:search, :note_id).present? %>
<%= render "revert_listing" %>
<% else %>
<%= render "standard_listing" %>
<% end %>
<%= render "standard_listing" %>
<%= numbered_paginator(@note_versions) %>