Sha256: 62ca72ce5bda5ce711761823f3104046936a5b8886f256738392fbd1310a280b
Contents?: true
Size: 905 Bytes
Versions: 1
Compression:
Stored size: 905 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) return nil unless asset.persisted? 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 def asset_back_link(asset) if asset.trashed? push_type.trash_assets_path else push_type.assets_path end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
push_type_admin-0.3.1 | app/helpers/push_type/assets_helper.rb |