Sha256: e15d672943c99f2b4b08870387e4058c72f05c7abfc49740541f7446b5e675af
Contents?: true
Size: 1.11 KB
Versions: 24
Compression:
Stored size: 1.11 KB
Contents
module AssetsHelper def gallery(assets, size = :square) if assets.respond_to? :images and assets.images.any? images = assets.images elsif assets.any? images = assets.reject{|a| !a.content_type.starts_with?('image')} else return end images_items = images.collect { |asset| content_tag( :li, link_to(image_tag(asset.public_filename(size), :alt => asset.description), asset.public_filename, :title => asset.description, :rel => 'gallery' ) ) } content_tag :ul, images_items.join, :class => 'gallery' unless images_items.empty? end def documents(assets) if assets.respond_to? :documents and assets.documents.any? documents = assets.documents elsif assets.any? documents = assets.reject{|a| a.content_type.starts_with?('image')} else return end documents_items = documents.collect { |asset| content_tag( :li, link_to("<em>Download #{asset.filename}</em> (#{number_to_human_size(asset.size)})", asset.public_filename, :title => asset.description ) ) } content_tag :ul, documents_items.join, :class => 'documents' unless documents_items.empty? end end
Version data entries
24 entries across 24 versions & 1 rubygems