Move more logic to the helper modules

- Diff view changes
-- Only show pool description changes in diff view
-- Conditionally render diff link when applicable values are changed
-- Conditionally show diff view sections when values are changed
- Show renames on index view
-- There is plenty of space
-- This wasn't shown at all for wikis
-- Having to navigate to an alternate page is unwieldy for pools
- Show "posts" as a status on pools
-- This is so all changes among versions are quantified as a status
- Standardize diff/index titles
This commit is contained in:
BrokenEagle
2020-03-17 05:23:51 +00:00
parent 4b30e644bb
commit a95e57d938
15 changed files with 152 additions and 105 deletions

View File

@@ -1,6 +1,6 @@
<div id="c-artist-commentary-versions">
<div id="a-index">
<h1>Artist Commentary Changes</h1>
<h1>Artist Commentary History</h1>
<%= render "posts/partials/common/inline_blacklist" %>

View File

@@ -1,14 +1,13 @@
<div id="p-<%= listing_type(:artist_id) %>-listing">
<%= table_for @artist_versions, {class: "striped autofit", width: "100%"} do |t| %>
<% t.column "Name" do |artist_version| %>
<% t.column "Name", td: {class: "diff-body"} do |artist_version| %>
<%= link_to artist_version.name, artist_path(artist_version.artist_id) %>
<%= link_to "»", artist_versions_path(search: {artist_id: artist_version.artist_id}, anchor: "artist-version-#{artist_version.id}") %>
<%= artist_version_name_diff(artist_version) %>
<% end %>
<% t.column "Other Names" do |artist_version| %>
<% if artist_version.group_name.present? %>
<p><b>Group:</b><br>&ensp;<%= artist_version.group_name %></p>
<% end %>
<% t.column "Other Names", td: {class: "diff-body"} do |artist_version| %>
<%= artist_version_group_name_diff(artist_version) %>
<%= artist_version_other_names_diff(artist_version) %>
<% end %>
<% t.column "URLs", td: {class: "col-expand"} do |artist_version| %>

View File

@@ -1,6 +1,6 @@
<div id="c-note-versions">
<div id="a-index">
<h1>Note Changes</h1>
<h1>Note History</h1>
<%= render "listing" %>

View File

@@ -2,14 +2,15 @@
<%= table_for @pool_versions, {class: "striped autofit", width: "100%"} do |t| %>
<% t.column column: "diff", width: "3%" do |pool_version| %>
<%= link_to_if pool_version.text_field_changed, "diff", diff_pool_version_path(pool_version.id) %>
<%= link_to_if pool_version_show_diff(pool_version), "diff", diff_pool_version_path(pool_version.id) %>
<% end %>
<% t.column "Pool" do |pool_version| %>
<% t.column "Pool", td: {class: "diff-body"} do |pool_version| %>
<%= link_to pool_version.pretty_name, pool_path(pool_version.pool_id), class: "pool-category-#{pool_version.pool.category}" %>
<%= link_to "»", pool_versions_path(search: { pool_id: pool_version.pool_id }, anchor: "pool-version-#{pool_version.id}"), class: "pool-category-#{pool_version.pool.category}" %>
<%= pool_version_name_diff(pool_version) %>
<% end %>
<% t.column "Post Changes", td: { class: "col-expand" } do |pool_version| %>
<%= render "pool_versions/diff", diff: pool_version.build_diff %>
<%= pool_version_post_diff(pool_version) %>
<% end %>
<% t.column "Post Count" do |pool_version| %>
<%= link_to pool_version.post_ids.size, pool_versions_path(search: { pool_id: pool_version.pool_id }) %>

View File

@@ -3,34 +3,18 @@
<div id="c-pool-versions">
<div id="a-diff">
<h1>Pool Version Comparison: <%= @pool_version.name %></h1>
<h1>Pool Version Comparison: <%= link_to @pool_version.pretty_name, pool_versions_path(search: { pool_id: @pool_version.pool_id }, anchor: "pool-version-#{@pool_version.id}"), class: "pool-category-#{@pool_version.pool.category}" %></h1>
<% if @other_version.present? %>
<p>Showing differences between <%= compact_time @pool_version.updated_at %> (<%= link_to_user @pool_version.updater %>) and <%= compact_time @other_version.updated_at %> (<%= link_to_user @other_version.updater %>)</p>
<div class="diff-body">
<h2>Name:</h2>
<p>
<% if @pool_version.name != @other_version.name %>
<del><%= @other_version.name %></del> -> <ins><%= @pool_version.name %></ins>
<% else %>
<%= @pool_version.name %>
<% end %>
</p>
</div>
<div>
<h2>Posts:</h2>
<p><%= render "pool_versions/diff", diff: @pool_version.build_diff(@other_version) %></p>
</div>
<div class="diff-body">
<h2>Description:</h2>
<p>
<% if @pool_version.description != @other_version.description %>
<% if @pool_version.description != @other_version.description %>
<div class="diff-body">
<%= diff_body_html(@pool_version, @other_version, :description) %>
<% else %>
<i>Unchanged.</i>
<% end %>
</p>
</div>
</div>
<% else %>
<p><em>No changes to description.</em></p>
<% end %>
<% end %>
</div>
</div>

View File

@@ -1,9 +1,9 @@
<div id="c-post-versions">
<div id="a-index">
<% if listing_type(:post_id) == :revert && @post_versions.present? %>
<h1>Tag History: <%= link_to "Post ##{params.dig(:search, :post_id)}", @post_versions[0].post %></h1>
<h1>Post History: <%= link_to "Post ##{params.dig(:search, :post_id)}", @post_versions[0].post %></h1>
<% else %>
<h1>Tag History</h1>
<h1>Post History</h1>
<% end %>
<%= search_form_for(post_versions_path, classes: "inline-form") do |f| %>

View File

@@ -2,7 +2,7 @@
<%= form_tag(diff_wiki_page_versions_path, :method => :get) do %>
<%= table_for @wiki_page_versions.includes(:updater, :tag), width: "100%" do |t| %>
<% t.column column: "diff", width: "3%" do |wiki_page_version, i| %>
<%= link_to_if wiki_page_version.previous.present?, "diff", diff_wiki_page_versions_path(otherpage: wiki_page_version.previous.try(:id), thispage: wiki_page_version.id) %>
<%= link_to_if wiki_version_show_diff(wiki_page_version), "diff", diff_wiki_page_versions_path(otherpage: wiki_page_version.previous.try(:id), thispage: wiki_page_version.id) %>
<% end %>
<% if listing_type(:wiki_page_id, member_check: false, types: [:page, :global]) == :page %>
@@ -14,12 +14,13 @@
<% end %>
<% end %>
<% t.column "Title" do |wiki_page_version| %>
<% t.column "Title", td: {class: "diff-body"} do |wiki_page_version| %>
<span class="<%= tag_class(wiki_page_version.tag) %>">
<%= link_to "?", wiki_page_path(wiki_page_version.wiki_page_id) %>
<%= link_to wiki_page_version.title, wiki_page_version %>
<%= link_to "»", wiki_page_versions_path(search: { wiki_page_id: wiki_page_version.wiki_page_id }) %>
</span>
<%= wiki_version_title_diff(wiki_page_version) %>
<% end %>
<% t.column "Changes", width: "5%" do |wiki_page_version| %>
<%= status_diff_html(wiki_page_version) %>

View File

@@ -4,13 +4,21 @@
<%= render "wiki_pages/sidebar" %>
<% content_for(:content) do %>
<h1>Wiki Page: <%= @thispage.title %></h1>
<h1>Wiki Page Version Comparison: <%= link_to @thispage.title, wiki_page_versions_path(search: { wiki_page_id: @thispage.wiki_page_id }, anchor: "wiki-page-version-#{@thispage.id}"), class: "tag-type-#{@thispage.wiki_page.category_name}" %></h1>
<p>Showing differences between <%= compact_time @thispage.updated_at %> (<%= link_to_user @thispage.updater %>) and <%= compact_time @otherpage.updated_at %> (<%= link_to_user @otherpage.updater %>)</p>
<%= wiki_other_names_diff(@thispage, @otherpage) %>
<% if wiki_version_show_other_names(@thispage, @otherpage) %>
<p><%= wiki_version_other_names_diff(@thispage, @otherpage) %></p>
<% else %>
<p><em>No changes to other names.</em></p>
<% end %>
<div class="diff-body">
<%= diff_body_html(@thispage, @otherpage, :body) %>
</div>
<% if @thispage.body != @otherpage.body %>
<div class="diff-body">
<%= diff_body_html(@thispage, @otherpage, :body) %>
</div>
<% else %>
<p><em>No changes to body.</em></p>
<% end %>
<% end %>