Sha256: c220b7d8b6880d70bbfad6af085c531a245691cf24ac574f30ceccde9dccdfaf
Contents?: true
Size: 1.85 KB
Versions: 43
Compression:
Stored size: 1.85 KB
Contents
<% img = block.child_value('image_src') img_style = block.child_value('image_style') link = block.child_value('link') align = block.child_value('align') width = block.child_value('width') height = block.child_value('height') mt = block.child_value('margin_top').downcase mr = block.child_value('margin_right').downcase mb = block.child_value('margin_bottom').downcase ml = block.child_value('margin_left').downcase url = img ? img.url(img_style.downcase.to_sym) : nil img = nil if url && !url.include?('missing.png') style = [] if align == 'Center' ml = 'auto' mr = 'auto' style << "display: block" end ml = "#{ml}px" if ml && ml != 'auto' && !ml.ends_with?('px') && !ml.ends_with?('em') && !ml.ends_with?('%') mr = "#{mr}px" if mr && mr != 'auto' && !mr.ends_with?('px') && !mr.ends_with?('em') && !mr.ends_with?('%') mt = "#{mt}px" if mt && mt != 'auto' && !mt.ends_with?('px') && !mt.ends_with?('em') && !mt.ends_with?('%') mb = "#{mb}px" if mb && mb != 'auto' && !mb.ends_with?('px') && !mb.ends_with?('em') && !mb.ends_with?('%') style << "width: #{width}px" if width style << "max-height: #{height}px" if height style << "float: left" if align == 'Left' style << "float: right" if align == 'Right' style << "margin-left: #{ml}" if ml style << "margin-right: #{mr}" if mr style << "margin-top: #{mt}" if mt style << "margin-bottom: #{mb}" if mb style = style.join('; ') img = "<img src='#{url}' style='#{style}' id='block_#{block.id}' />" if link && link.strip.length > 0 if editing img = "<a href='#'>#{img}</a>" else img = "<a href='#{link}'>#{img}</a>" end end end if editing && img.nil? %><p id='block_<%= block.id %>'>Please upload an image.</p><% else %><%= raw img %><% end %>
Version data entries
43 entries across 43 versions & 1 rubygems