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

@@ -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>