Sha256: 891be1644a2948b3bc55a3cc1ecb07f76fdc3192bfaa0397ef8679baf8bb9e16

Contents?: true

Size: 641 Bytes

Versions: 9

Compression:

Stored size: 641 Bytes

Contents

module Tenon
  module AssetHelper
    def asset_icon(asset)
      if asset.attachment.exists?(:thumbnail)
        i = image_tag(asset.attachment.url(:thumbnail))
      else
        i = image_tag(default_asset_thumbnail(asset))
      end
      link_to(i, [:edit, asset], default_options)
    end

    def default_asset_thumbnail(asset)
      if asset && asset.attachment_content_type.match('video')
        'tenon/thumb-video.png'
      else
        'tenon/thumb-doc.png'
      end
    end

    private

    def default_options
      {
        'data-modal-remote' => true,
        'data-modal-title' => 'Edit Asset'
      }
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
tenon-1.0.8 app/helpers/tenon/asset_helper.rb
tenon-1.0.7 app/helpers/tenon/asset_helper.rb
tenon-1.0.6 app/helpers/tenon/asset_helper.rb
tenon-1.0.5 app/helpers/tenon/asset_helper.rb
tenon-1.0.4 app/helpers/tenon/asset_helper.rb
tenon-1.0.3 app/helpers/tenon/asset_helper.rb
tenon-1.0.2 app/helpers/tenon/asset_helper.rb
tenon-1.0.1 app/helpers/tenon/asset_helper.rb
tenon-1.0 app/helpers/tenon/asset_helper.rb