Sha256: 20bbef5a9eb0e635dbbe7a1910231b021dc1a7bae9be0826758e61d42e8036b0

Contents?: true

Size: 732 Bytes

Versions: 7

Compression:

Stored size: 732 Bytes

Contents

module Smithy
  module AssetsHelper
    def asset_image_tag(asset_id)
      asset = Smithy::Asset.find_by_id(asset_id)
      return unless asset
      image_tag(asset.file.url(:host => "#{request.protocol}#{request.host_with_port}"), :alt => asset.name)
    end

    def file_type_icon(asset)
      case asset.file_type
      when :image
        nil
      when :pdf
        'smithy/icons/pdf.png'
      when :word
        'smithy/icons/doc.png'
      when :excel
        'smithy/icons/xls.png'
      when :powerpoint
        'smithy/icons/ppt.png'
      when :text
        'smithy/icons/txt.png'
      when :document
        'smithy/icons/_page.png'
      when :default
        'smithy/icons/_blank.png'
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
smithycms-0.5.99.3 app/helpers/smithy/assets_helper.rb
smithycms-0.5.99.2 app/helpers/smithy/assets_helper.rb
smithycms-0.5.99.1 app/helpers/smithy/assets_helper.rb
smithycms-0.5.99 app/helpers/smithy/assets_helper.rb
smithycms-0.5.2 app/helpers/smithy/assets_helper.rb
smithycms-0.5.1 app/helpers/smithy/assets_helper.rb
smithycms-0.5.0 app/helpers/smithy/assets_helper.rb