Revision 14a5963c
Added by Marc Dequènes over 15 years ago
- ID 14a5963cf17251b46099fdc7515867918e81033c
app/helpers/application_helper.rb | ||
---|---|---|
display_title = params.has_key?(:display_title) ? params[:display_title] : true
|
||
display_size = params.has_key?(:display_size) ? params[:display_size] : true
|
||
|
||
style = "text-align: center; padding: 0px;"
|
||
thumb = artwork.image.artwork_step_thumbnails.find_by_thumbnail(size.to_s)
|
||
img_padding = 5
|
||
frame_margin = 3
|
||
frame_width = thumb.width + img_padding * 2
|
||
style = "text-align: center; padding: 0px; width: #{frame_width}px;"
|
||
#style += " border: 1px solid red;"
|
||
case frame_type
|
||
when :classic
|
||
style += " margin: 7px;"
|
||
style += " margin: #{frame_margin}px;"
|
||
when :cell
|
||
style += " padding-left: 3px; padding-right: 3px; margin-top: 7px; margin-bottom: 7px; margin-left: auto; margin-right: auto;"
|
||
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: 7px; float: left;"
|
||
style += " margin: #{frame_margin}px; float: left;"
|
||
end
|
||
|
||
html = "<div style=\"" + style + "\">"
|
||
html += "<div style=\padding: 0px; margin: 0px;\">" + display_thumbnail(artwork.image, size) + "</div>"
|
||
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>"
|
||
infos = []
|
||
if display_title
|
||
title = params[:force_title] ? params[:force_title] : artwork.title
|
||
infos << title
|
||
end
|
||
if display_size
|
||
infos << "<span style=\"font-size: smaller;\">(" + artwork.artwork_size.human_size + ")</span>"
|
||
infos << "<span style=\"padding: 0; font-size: smaller;\">(" + artwork.artwork_size.human_size + ")</span>"
|
||
end
|
||
html += infos.join("<br />")
|
||
html += "</div>"
|
||
html += "</div>"
|
||
end
|
||
end
|
Also available in: Unified diff
[evol] artwork frame improvements #1