Refactor sources

This commit is contained in:
Albert Yi
2018-08-06 17:39:25 -07:00
parent 54363ffecf
commit 762dc3da24
71 changed files with 2340 additions and 2430 deletions

View File

@@ -1,8 +1,8 @@
<% if params[:url] %>
<% if ImageProxy.needs_proxy?(@normalized_url) %>
<%= image_tag(image_proxy_uploads_path(:url => @normalized_url), :title => "Preview", :id => "image") %>
<% if ImageProxy.needs_proxy?(@source.image_url) %>
<%= image_tag(image_proxy_uploads_path(:url => @source.image_url), :title => "Preview", :id => "image") %>
<% else %>
<%= image_tag(@normalized_url, :title => "Preview", :id => "image") %>
<%= image_tag(@source.image_url, :title => "Preview", :id => "image") %>
<% end %>
<ul>

View File

@@ -47,11 +47,10 @@
</span>
<br>
<% if upload.alt_source.present? %>
<% if upload.referer_url.present? %>
<span class="info">
<strong>Alternate Source</strong>
<%= link_to_if (upload.alt_source =~ %r!\Ahttps?://!i), (upload.alt_source.presence.try(:truncate, 50) || content_tag(:em, "none")), upload.source %>
<%= link_to "»", uploads_path(search: params[:search].merge(source_matches: upload.alt_source)) %>
<strong>Referer</strong>
<%= URI.parse(upload.referer_url).host rescue nil %>
</span>
<br>
<% end %>

View File

@@ -20,9 +20,7 @@
<%= form_for(@upload, :html => {:multipart => true, :class => "simple_form", :id => "form"}) do |f| %>
<%= hidden_field_tag :url, params[:url] %>
<%= hidden_field_tag :ref, params[:ref] %>
<%= hidden_field_tag :normalized_url, @normalized_url %>
<%= f.hidden_field :md5_confirmation %>
<%= f.hidden_field :referer_url, :value => @source.try(:referer_url) %>
<% if CurrentUser.can_upload_free? %>
<div class="input">