Sha256: 411f57100dad3d9c3ef0ef61b229d0bd6e40070de1a2a296c1aa4a8cb09f7594

Contents?: true

Size: 978 Bytes

Versions: 3

Compression:

Stored size: 978 Bytes

Contents

module Shoppe::ShoppeHelper

  def status_tag(status)
    content_tag :span, status, :class => "status-tag #{status}"
  end
  
  def attachment_preview(attachment)
    if attachment
      String.new.tap do |s|
        if attachment.image?
          style = "style='background-image:url(#{attachment.path})'"
        else
          style = ''
        end
        s << "<div class='attachmentPreview #{attachment.image? ? 'image' : 'doc'}'>"
        s << "<div class='imgContainer'><div class='img' #{style}></div></div>"
        s << "<div class='desc'>"
        s << "<span class='filename'><a href='#{attachment_path(attachment)}'>#{attachment.file_name}</a></span>"
        s << "<span class='delete'>"
        s << link_to("Delete this file?", attachment_path(attachment), :method => :delete, :data => {:confirm => "Are you sure you wish to remove this attachment?"})
        s << "</span>"
        s << "</div>"
        s << "</div>"
      end.html_safe
    end
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
shoppe-0.0.7 app/helpers/shoppe/shoppe_helper.rb
shoppe-0.0.6 app/helpers/shoppe/shoppe_helper.rb
shoppe-0.0.5 app/helpers/shoppe/shoppe_helper.rb