Sha256: 845859d1f5eaf39169ee8d5750fd8367fba6699e206e769be5ccfadb7812824b
Contents?: true
Size: 1.2 KB
Versions: 23
Compression:
Stored size: 1.2 KB
Contents
module Tenon class AssetDecorator < ApplicationDecorator def icon h.asset_icon(object) end def tile h.asset_tile(object) end def human_size h.number_to_human_size(object.attachment_file_size) end def display_name name = object.title.blank? ? object.attachment_file_name : object.title h.truncate(name, length: 50) end def crop_link h.action_link( 'Crop', [:crop, object], 'crop', class: 'asset-crop', data: { 'asset-id' => object.id, 'post-crop-handler' => 'Tenon.features.AssetListPostCropHandler' } ) if object.attachment_content_type.include?('image') || object.attachment_content_type.include?('video') end def edit_link(opts = {}) defaults = { 'data-modal-remote' => true, 'data-modal-title' => 'Edit Asset' } super(opts.merge(defaults)) end def download_link h.action_link('Download', object.attachment.url, 'download', target: '_') end def style_urls styles = object.attachment.styles.map do |key, style| [key, object.attachment.url(key)] end Hash[styles] end end end
Version data entries
23 entries across 23 versions & 1 rubygems