diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 21ec75472..1723d70ab 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -101,6 +101,14 @@ module ApplicationHelper time_tag(time.strftime("%Y-%m-%d %H:%M"), time) end + def external_link_to(url) + if url =~ %r!\Ahttps?://!i + link_to url, {}, {rel: :nofollow} + else + url + end + end + def link_to_ip(ip) link_to ip, moderator_ip_addrs_path(:search => {:ip_addr => ip}) end diff --git a/app/views/post_replacements/index.html.erb b/app/views/post_replacements/index.html.erb new file mode 100644 index 000000000..ce84f0af1 --- /dev/null +++ b/app/views/post_replacements/index.html.erb @@ -0,0 +1,54 @@ +
+
+

Post Replacements

+ + <%= render "posts/partials/common/inline_blacklist" %> + + <%= simple_form_for(:search, url: post_replacements_path, method: :get, defaults: { required: false }, html: { class: "inline-form" }) do |f| %> + <%= f.input :creator_name, label: "Replacer", input_html: { value: params[:search][:creator_name] } %> + <%= f.submit "Search" %> + <% end %> + + + + + + + + + + + <% @post_replacements.each do |post_replacement| %> + + + + + + <% end %> + +
PostSourceReplacer
<%= PostPresenter.preview(post_replacement.post) %> +
+
Original Source
+
<%= external_link_to post_replacement.original_url %>
+
Replacement Source
+
+ <% if post_replacement.replacement_url.present? %> + <%= external_link_to post_replacement.replacement_url %> + <% else %> + file + <% end %> +
+
+
+ <%= compact_time post_replacement.created_at %> +
by <%= link_to_user post_replacement.creator %> + <%= link_to "ยป", post_replacements_path(search: params[:search].merge(creator_name: post_replacement.creator.name)) %> +
+ + <%= numbered_paginator(@post_replacements) %> +
+
+ +<% content_for(:page_title) do %> + Post Replacements - <%= Danbooru.config.app_name %> +<% end %> diff --git a/app/views/posts/show.html.erb b/app/views/posts/show.html.erb index 6cb62c631..3a383c1ab 100644 --- a/app/views/posts/show.html.erb +++ b/app/views/posts/show.html.erb @@ -27,6 +27,7 @@
  • <%= fast_link_to "Notes", note_versions_path(:search => {:post_id => @post.id}) %>
  • <%= fast_link_to "Flags & Appeals", post_events_path(@post.id) %>
  • <%= fast_link_to "Commentary", artist_commentary_versions_path(:search => {:post_id => @post.id}) %>
  • +
  • <%= fast_link_to "Replacements", post_replacements_path(:search => {:post_id => @post.id}) %>
  • diff --git a/app/views/static/site_map.html.erb b/app/views/static/site_map.html.erb index 496d85807..b2706ff63 100644 --- a/app/views/static/site_map.html.erb +++ b/app/views/static/site_map.html.erb @@ -11,6 +11,7 @@
  • <%= link_to("Upload Listing", uploads_path) %>
  • <%= link_to("Appeals", post_appeals_path) %>
  • <%= link_to("Flags", post_flags_path) %>
  • +
  • <%= link_to("Replacements", post_replacements_path) %>
  • <% if CurrentUser.can_approve_posts? %>
  • <%= link_to("Moderate", moderator_post_queue_path) %>
  • <% end %>