Sha256: c168010fd6b7d6a95d3394ebad05d35297af9910a13a17cf89d937b7966ccd38
Contents?: true
Size: 937 Bytes
Versions: 2
Compression:
Stored size: 937 Bytes
Contents
module PushType module AssetsHelper def assets_array(assets) assets.map { |a| asset_hash(a) } end def asset_hash(asset) return nil if asset.nil? 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 url: media_path(asset), preview_thumb_url: asset_preview_thumb_url(asset) if asset.persisted? hash end def asset_preview_thumb_url(asset) if asset.image? media_path(asset, style: :push_type_thumb) else image_path(asset_icon(asset)) end end def asset_icon(asset) "push_type/icons-assets.svg##{ asset.kind }" end def asset_back_link(asset) if asset.trashed? push_type_admin.trash_assets_path else push_type_admin.assets_path end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
push_type_admin-0.10.0.beta.5 | app/helpers/push_type/assets_helper.rb |
push_type_admin-0.10.0.beta.3 | app/helpers/push_type/assets_helper.rb |