Sha256: e3406fb83135ab68df00f0ab0858dd029774f7bf08c31a0858513f15000b7ac8

Contents?: true

Size: 1.09 KB

Versions: 14

Compression:

Stored size: 1.09 KB

Contents

module Plugins
  module Core
    class AssetInfoCell < Plugins::Core::Cell
      include ActionView::Helpers::NumberHelper

      property :data
      property :content_item

      def show
        render
      end

      def index
        render
      end

      private

      def config
        @options[:config] || {}
      end

      def asset
        data['asset']
      end

      def dimensions
        "#{asset['versions']['original']['dimensions']['width']} x #{asset['versions']['original']['dimensions']['width']}"
      end

      def creator
        content_item.creator
      end

      def created_at
        content_item.created_at.to_formatted_s(:long_ordinal)
      end

      def updated_at
        content_item.updated_at.to_formatted_s(:long_ordinal)
      end

      def link_to_asset
        link_to asset['versions']['original']['url'], asset['versions']['original']['url'], target: '_blank'
      end

      def asset_type
        MimeMagic.new(asset['versions']['original']['mime_type']).mediatype
      end

      def asset_is_image?
        asset_type == 'image'
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
cortex-plugins-core-3.2.0 app/cells/plugins/core/asset_info_cell.rb
cortex-plugins-core-3.1.0 app/cells/plugins/core/asset_info_cell.rb
cortex-plugins-core-3.0.0 app/cells/plugins/core/asset_info_cell.rb
cortex-plugins-core-2.1.1 app/cells/plugins/core/asset_info_cell.rb
cortex-plugins-core-2.1.0 app/cells/plugins/core/asset_info_cell.rb
cortex-plugins-core-2.0.1 app/cells/plugins/core/asset_info_cell.rb
cortex-plugins-core-1.1.1 app/cells/plugins/core/asset_info_cell.rb
cortex-plugins-core-1.1.0 app/cells/plugins/core/asset_info_cell.rb
cortex-plugins-core-1.0.0 app/cells/plugins/core/asset_info_cell.rb
cortex-plugins-core-0.12.4 app/cells/plugins/core/asset_info_cell.rb
cortex-plugins-core-0.12.3 app/cells/plugins/core/asset_info_cell.rb
cortex-plugins-core-0.12.2 app/cells/plugins/core/asset_info_cell.rb
cortex-plugins-core-0.12.1 app/cells/plugins/core/asset_info_cell.rb
cortex-plugins-core-0.12.0 app/cells/plugins/core/asset_info_cell.rb