refactored source code, work on pixiv integration

This commit is contained in:
albert
2011-09-26 16:47:22 -04:00
parent 11b623c66b
commit 284141aace
19 changed files with 201 additions and 45 deletions

View File

@@ -0,0 +1,15 @@
<!--
- source
-->
<% if source.try(:available?) %>
<div id="source-info">
<p>This looks like a <%= source.site_name %> upload. <%= link_to "Fetch data", source_path(:format => "json", :url => params[:url]), :id => "fetch-data" %>.</p>
<ul>
<li><strong>Artist</strong>: <span id="source-artist"></span></li>
<li><strong>Tags</strong>: <span id="source-tags"></span></li>
<li><strong>Record</strong>: <span id="source-record"></span></li>
</ul>
</div>
<% end %>

View File

@@ -1,6 +0,0 @@
({
"artist_name": "<%= j @source.artist_name %>",
"profile_url": "<%= j @source.profile_url %>",
"image_url": "<%= j @source.image_url %>",
"tags": <%= @source.tags.to_json.html_safe %>
});

View File

@@ -0,0 +1,4 @@
<% if params[:url] %>
<%= image_tag(params[:url], :title => "Preview", :id => "image") %>
<p id="scale"></p>
<% end %>

View File

@@ -0,0 +1,6 @@
<!--
- post
-->
<% if post %>
<p>This post was probably already uploaded (<%= link_to "post ##{post.id}", posts_path(post), :target => "_blank" %>).</p>
<% end %>

View File

@@ -6,18 +6,11 @@
<p>Before uploading, please read the <%= link_to "how to upload guide", wiki_pages_path(:title => "howto:upload") %>.</p>
</div>
<%= render "image" %>
<%= render "post" %>
<%= render "sources/info", :source => @source %>
<%= form_for(@upload, :html => {:multipart => true, :class => "simple_form"}) do |f| %>
<% if params[:url] %>
<div id="image-preview">
<%= image_tag(params[:url], :title => "Preview") %>
<p id="scale"></p>
</div>
<% if @post %>
<p>This post was probably already uploaded (<%= link_to "post ##{@post.id}", posts_path(@post), :target => "_blank" %>).</p>
<% end %>
<% end %>
<div class="input">
<%= f.label :file %>
<%= f.file_field :file, :size => 50 %>