Sha256: 9b2272fba5500c745e0d1991ef841126a904aefdfe2efc501e3f0fdcbd9e2b10
Contents?: true
Size: 713 Bytes
Versions: 1
Compression:
Stored size: 713 Bytes
Contents
module PushType module AssetsHelper def assets_array(assets) assets.map { |a| asset_hash(a) } end def asset_hash(asset) hash = [ :id, :file_name, :file_size, :mime_type, :created_at, :new_record?, :image?, :description_or_file_name ].inject({}) do |h, att| h.update att => asset.send(att) end hash.update preview_thumb_url: asset_preview_thumb_url(asset) end def asset_preview_thumb_url(asset) if asset.image? main_app.media_path(file_uid: asset.file_uid, style: :push_type_thumb) else image_path(asset_icon(asset)) end end def asset_icon(asset) "push_type/icon-file-#{ asset.kind }.png" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
push_type_admin-0.2.0.beta2 | app/helpers/push_type/assets_helper.rb |