Revision e7326ceb
Added by Marc Dequènes over 15 years ago
- ID e7326cebef6f8f122b06e169526907b2531be5d1
app/helpers/application_helper.rb | ||
---|---|---|
image_tag(img.public_filename(thumb_name))
|
||
end
|
||
|
||
def display_artwork_frame(artwork, params = {})
|
||
def display_image_frame(image, params = {})
|
||
frame_type = params.has_key?(:frame_type) ? params[:frame_type] : :classic
|
||
size = params[:size] || :thumb_big
|
||
display_title = params.has_key?(:display_title) ? params[:display_title] : true
|
||
display_size = params.has_key?(:display_size) ? params[:display_size] : true
|
||
with_link = params.has_key?(:with_link) ? params[:with_link] : true
|
||
|
||
thumb = artwork.image.artwork_step_thumbnails.find_by_thumbnail(size.to_s)
|
||
thumb = image.artwork_step_thumbnails.find_by_thumbnail(size.to_s)
|
||
img_padding = 5
|
||
frame_margin = 3
|
||
frame_width = thumb.width + img_padding * 2
|
||
... | ... | |
style += " padding-left: 3px; padding-right: 3px; margin-top: #{frame_margin}px; margin-bottom: #{frame_margin}px; margin-left: auto; margin-right: auto;"
|
||
when :float
|
||
style += " margin: #{frame_margin}px; float: left;"
|
||
when :inline
|
||
style += " margin: #{frame_margin}px; display: inline-block;"
|
||
end
|
||
|
||
html = "<div class=\"artwork_frame\" style=\"" + style + "\">"
|
||
html += "<div style=\"padding: #{img_padding}px #{img_padding}px 0; margin: 0px;\">" + display_thumbnail(artwork.image, size) + "</div>"
|
||
html += "<div style=\"padding: #{img_padding}px #{img_padding}px 0; margin: 0px;\">" + display_thumbnail(image, size) + "</div>"
|
||
html += "<div>"
|
||
infos = []
|
||
if display_title
|
||
title = params[:force_title] ? params[:force_title] : artwork.title
|
||
title = params[:force_title] ? params[:force_title] : image.artwork.title
|
||
infos << title
|
||
end
|
||
if display_size
|
||
infos << "<span style=\"padding: 0; font-size: smaller;\">(" + artwork.artwork_size.human_size + ")</span>"
|
||
infos << "<span style=\"padding: 0; font-size: smaller;\">(" + image.artwork.artwork_size.human_size + ")</span>"
|
||
end
|
||
html += infos.join("<br />")
|
||
html += "</div>"
|
||
html += "</div>"
|
||
|
||
with_link ? link_to(html, :controller => '/view', :action => 'artwork', :id => image.artwork.id) : html
|
||
end
|
||
end
|
Also available in: Unified diff
[evol] image frame improvements #2 (was artwork frame improvements)