Sha256: 6ed89c6f068111961cf87686fd9c0ec12be2d8c1f7a66073f6c5922208de8ac2

Contents?: true

Size: 1.06 KB

Versions: 27

Compression:

Stored size: 1.06 KB

Contents

module Tenon
  module TenonContent
    class Piece < ActiveRecord::Base
      self.table_name = 'tenon_tenon_content_pieces'
      attr_reader :sizes, :styles

      def sizes
        # to translate between the stored piece size in words and a number for math
        {
          :one => 1.0,
          :two => 2.0,
          :three => 3.0,
          :four => 4.0,
          :five => 5.0,
          :six => 6.0,
          :seven => 7.0,
          :eight => 8.0,
          :nine => 9.0,
          :ten => 10.0,
          :eleven => 11.0,
          :twelve => 12.0
        }
      end

      def styles
        Hash[(1..10).map{|n| ["x#{n*200}", (n*200).to_s]}]
      end

      # Scopes, attachments, etc.
      has_asset :image, styles: {
        x2000: '2000>',
        x1800: '1800>',
        x1600: '1600>',
        x1400: '1400>',
        x1200: '1200>',
        x1000: '1000>',
        x800: '800>',
        x600: '600>',
        x400: '400>',
        x200: '200>'
      }

      # Relationships
      belongs_to :row, class_name: '::Tenon::TenonContent::Row'
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
tenon-1.1.8 app/models/tenon/tenon_content/piece.rb
tenon-1.1.7 app/models/tenon/tenon_content/piece.rb
tenon-1.1.6 app/models/tenon/tenon_content/piece.rb
tenon-1.1.5 app/models/tenon/tenon_content/piece.rb
tenon-1.1.4 app/models/tenon/tenon_content/piece.rb
tenon-1.1.3 app/models/tenon/tenon_content/piece.rb
tenon-1.1.2 app/models/tenon/tenon_content/piece.rb
tenon-1.1.1 app/models/tenon/tenon_content/piece.rb
tenon-1.0.76 app/models/tenon/tenon_content/piece.rb
tenon-1.0.75 app/models/tenon/tenon_content/piece.rb
tenon-1.0.74 app/models/tenon/tenon_content/piece.rb
tenon-1.0.73 app/models/tenon/tenon_content/piece.rb
tenon-1.0.72 app/models/tenon/tenon_content/piece.rb
tenon-1.0.71 app/models/tenon/tenon_content/piece.rb
tenon-1.0.70 app/models/tenon/tenon_content/piece.rb
tenon-1.0.69 app/models/tenon/tenon_content/piece.rb
tenon-1.0.68 app/models/tenon/tenon_content/piece.rb
tenon-1.0.67 app/models/tenon/tenon_content/piece.rb
tenon-1.0.66 app/models/tenon/tenon_content/piece.rb
tenon-1.0.65 app/models/tenon/tenon_content/piece.rb