Sha256: 7d48e9ea0ce13610a5f2ce6d3a8bf3c80fb2f7d7fe26b8854e569fda2892b4f8

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

module Shoppe::ShoppeHelper

  def status_tag(status)
    content_tag :span, status, :class => "status-tag #{status}"
  end
  
  def attachment_preview(attachment, options = {})
    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
    elsif !options[:hide_if_blank]
      "<div class='attachmentPreview'><div class='imgContainer'><div class='img none'></div></div><div class='desc none'>No attachment</div></div>".html_safe
    end
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shoppe-0.0.15 app/helpers/shoppe/shoppe_helper.rb