replacements: link to old and new media assets.
On the /post_events and /post_replacements pages, include links to the old and new media assets pages so you can compare the two images.
This commit is contained in:
@@ -9,7 +9,7 @@ class PostEventsController < ApplicationController
|
||||
end
|
||||
|
||||
@post_events = authorize PostEvent.paginated_search(params, defaults: { post_id: @post&.id }, count_pages: @post.present?)
|
||||
@post_events = @post_events.includes(:creator, :post, model: [:post]) if request.format.html?
|
||||
@post_events = @post_events.includes(:creator, :post, model: [:post, :media_asset, :old_media_asset]) if request.format.html?
|
||||
|
||||
respond_with(@post_events)
|
||||
end
|
||||
|
||||
@@ -31,7 +31,7 @@ class PostReplacementsController < ApplicationController
|
||||
def index
|
||||
params[:search][:post_id] = params.delete(:post_id) if params.key?(:post_id)
|
||||
@post_replacements = authorize PostReplacement.paginated_search(params)
|
||||
@post_replacements = @post_replacements.includes(:creator, post: [:uploader, :media_asset]) if request.format.html?
|
||||
@post_replacements = @post_replacements.includes(:creator, :old_media_asset, :media_asset, post: [:uploader, :media_asset]) if request.format.html?
|
||||
|
||||
respond_with(@post_replacements)
|
||||
end
|
||||
|
||||
@@ -49,16 +49,50 @@
|
||||
<% end %>
|
||||
</div>
|
||||
<% when "PostReplacement" %>
|
||||
<% if model.old_file_size && model.old_file_ext && model.old_image_width && model.old_image_height && model.file_size && model.file_ext && model.image_width && model.image_height %>
|
||||
<%= link_to post.dtext_shortlink, post %> was replaced by <%= link_to_user creator %>
|
||||
(<%= external_link_to model.original_url.presence || "none", Source::URL.site_name(model.original_url) || model.original_url %>,
|
||||
<%= model.old_file_size.to_formatted_s(:human_size, precision: 4) %> .<%= model.old_file_ext %>, <%= model.old_image_width %>x<%= model.old_image_height %> ->
|
||||
<%= external_link_to model.replacement_url, Source::URL.site_name(model.replacement_url) || model.replacement_url %>,
|
||||
<%= model.file_size.to_formatted_s(:human_size, precision: 4) %> .<%= model.file_ext %>, <%= model.image_width %>x<%= model.image_height %>).
|
||||
<%= link_to post.dtext_shortlink, post %> was replaced by <%= link_to_user creator %>:
|
||||
|
||||
<% if model.original_url.match?(%r{\Ahttps?://}) %>
|
||||
<%= external_link_to(model.original_url, external_site_icon(Source::URL.site_name(model.original_url), title: model.original_url, class: "h-4")) %>
|
||||
<% elsif model.original_url.present? %>
|
||||
<%= tag.span(model.original_url.truncate(30, omission: "...#{model.original_url.last(15)}"), title: model.original_url) %>,
|
||||
<% end %>
|
||||
|
||||
<% if model.old_media_asset.present? %>
|
||||
<%= link_to model.old_media_asset do %><%#
|
||||
%><%= model.old_media_asset.file_size.to_fs(:human_size, precision: 4) %>
|
||||
.<%= model.old_media_asset.file_ext %>
|
||||
(<%= model.old_media_asset.image_width %>x<%= model.old_media_asset.image_height %><%= ", " + duration_to_hhmmss(model.old_media_asset.duration) if model.old_media_asset.duration.present? %>)
|
||||
<% end %>
|
||||
<% elsif model.old_file_size && model.old_file_ext && model.old_image_width && model.old_image_height %>
|
||||
<%= model.old_file_size.to_fs(:human_size, precision: 4) %>
|
||||
.<%= model.old_file_ext %>
|
||||
(<%= model.old_image_width %>x<%= model.old_image_height %>)
|
||||
<% elsif model.old_md5.present? %>
|
||||
<%= model.old_md5 %>
|
||||
<% else %>
|
||||
<%= link_to post.dtext_shortlink, post %> was replaced by <%= link_to_user creator %>
|
||||
(<%= external_link_to model.original_url.presence || "none", Source::URL.site_name(model.original_url) || model.original_url %> ->
|
||||
<%= external_link_to model.replacement_url, Source::URL.site_name(model.replacement_url) || model.replacement_url %>).
|
||||
<i>unknown file</i>
|
||||
<% end %>
|
||||
→
|
||||
<% if model.replacement_url.match?(%r{\Ahttps?://}) %>
|
||||
<%= external_link_to(model.replacement_url, external_site_icon(Source::URL.site_name(model.replacement_url), title: model.replacement_url, class: "h-4")) %>
|
||||
<% elsif model.replacement_url.present? %>
|
||||
<%= tag.span(model.replacement_url.truncate(30, omission: "...#{model.replacement_url.last(15)}"), title: model.replacement_url) %>,
|
||||
<% end %>
|
||||
|
||||
<% if model.media_asset.present? %>
|
||||
<%= link_to model.media_asset do %>
|
||||
<%= model.media_asset.file_size.to_fs(:human_size, precision: 4) %>
|
||||
.<%= model.media_asset.file_ext %>
|
||||
(<%= model.media_asset.image_width %>x<%= model.media_asset.image_height %><%= ", " + duration_to_hhmmss(model.media_asset.duration) if model.media_asset.duration.present? %>)<%#
|
||||
%><% end %>
|
||||
<% elsif model.file_size && model.file_ext && model.image_width && model.image_height %>
|
||||
<%= model.file_size.to_fs(:human_size, precision: 4) %>
|
||||
.<%= model.file_ext %>
|
||||
(<%= model.image_width %>x<%= model.image_height %>)
|
||||
<% elsif model.md5.present? %>
|
||||
<%= model.md5 %>
|
||||
<% else %>
|
||||
<i>unknown file</i>
|
||||
<% end %>
|
||||
<% when "ModAction" %>
|
||||
<% case model.category %>
|
||||
|
||||
@@ -32,10 +32,10 @@
|
||||
<% if post_replacement.old_md5.present? && post_replacement.md5.present? %>
|
||||
<dl>
|
||||
<dt>Original MD5</dt>
|
||||
<dd><%= post_replacement.old_md5 %></dd>
|
||||
<dd><%= link_to_if post_replacement.old_media_asset.present?, post_replacement.old_md5, post_replacement.old_media_asset %></dd>
|
||||
|
||||
<dt>Replacement MD5</dt>
|
||||
<dd><%= post_replacement.md5 %></dd>
|
||||
<dd><%= link_to_if post_replacement.media_asset.present?, post_replacement.md5, post_replacement.media_asset %></dd>
|
||||
</dl>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -44,14 +44,12 @@
|
||||
<dl>
|
||||
<dt>Original Size</dt>
|
||||
<dd>
|
||||
<%= post_replacement.old_image_width %>x<%= post_replacement.old_image_height %>
|
||||
(<%= post_replacement.old_file_size.to_formatted_s(:human_size, precision: 4) %>, <%= post_replacement.old_file_ext %>)
|
||||
<%= link_to_if post_replacement.old_media_asset.present?, "#{post_replacement.old_image_width}x#{post_replacement.old_image_height} (#{post_replacement.old_file_size.to_fs(:human_size, precision: 4)}, #{post_replacement.old_file_ext})", post_replacement.old_media_asset %>
|
||||
</dd>
|
||||
|
||||
<dt>Replacement Size</dt>
|
||||
<dd>
|
||||
<%= post_replacement.image_width %>x<%= post_replacement.image_height %>
|
||||
(<%= post_replacement.file_size.to_formatted_s(:human_size, precision: 4) %>, <%= post_replacement.file_ext %>)
|
||||
<%= link_to_if post_replacement.media_asset.present?, "#{post_replacement.image_width}x#{post_replacement.image_height} (#{post_replacement.file_size.to_fs(:human_size, precision: 4)}, #{post_replacement.file_ext})", post_replacement.media_asset %>
|
||||
</dd>
|
||||
</dl>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user