Add "Download" link which will include post's tags in filename
This commit is contained in:
@@ -95,6 +95,10 @@ class Post < ActiveRecord::Base
|
|||||||
"#{Rails.root}/public/data/preview/#{file_path_prefix}#{md5}.jpg"
|
"#{Rails.root}/public/data/preview/#{file_path_prefix}#{md5}.jpg"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def file_name
|
||||||
|
"#{file_path_prefix}#{md5}.#{file_ext}"
|
||||||
|
end
|
||||||
|
|
||||||
def file_url
|
def file_url
|
||||||
"/data/#{file_path_prefix}#{md5}.#{file_ext}"
|
"/data/#{file_path_prefix}#{md5}.#{file_ext}"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
<li><%= link_to "Favorite", favorites_path(:post_id => post.id), :remote => true, :method => :post, :id => "add-to-favorites", :title => "Shortcut is F" %></li>
|
<li><%= link_to "Favorite", favorites_path(:post_id => post.id), :remote => true, :method => :post, :id => "add-to-favorites", :title => "Shortcut is F" %></li>
|
||||||
<li><%= link_to "Unfavorite", favorite_path(post), :remote => true, :method => :delete, :id => "remove-from-favorites" %></li>
|
<li><%= link_to "Unfavorite", favorite_path(post), :remote => true, :method => :delete, :id => "remove-from-favorites" %></li>
|
||||||
<li><%= link_to "Edit", "#", :id => "side-edit-link" %></li>
|
<li><%= link_to "Edit", "#", :id => "side-edit-link" %></li>
|
||||||
|
<li><%= link_to_if post.visible?, "Download", post.file_url, :download => post.presenter.humanized_essential_tag_string + " - " + post.file_name %></li>
|
||||||
<li id="random-post-list"><%= link_to "Random post", random_posts_path(:tags => params[:tags]), :id => "random-post" %></li>
|
<li id="random-post-list"><%= link_to "Random post", random_posts_path(:tags => params[:tags]), :id => "random-post" %></li>
|
||||||
<li id="add-to-pool-list"><%= link_to "Add to pool", "#", :id => "pool" %></li>
|
<li id="add-to-pool-list"><%= link_to "Add to pool", "#", :id => "pool" %></li>
|
||||||
<% if post.is_note_locked? %>
|
<% if post.is_note_locked? %>
|
||||||
|
|||||||
Reference in New Issue
Block a user