Sha256: 4edb92b6b4ed7c1a66c3bfaa78275d2118a753cdc0d2cf54cd6261fc77a03446

Contents?: true

Size: 657 Bytes

Versions: 1

Compression:

Stored size: 657 Bytes

Contents

module Fooltip
  class Link < ::ActiveRecord::Base
    PLACEMENT_MAPPINGS = { 1 => 'top', 2 => 'right', 3 => 'bottom', 4 => 'left' }
    TRIGGER_MAPPINGS = { 1 => 'click', 2 => 'hover', 3 => 'focus', 4 => 'manual' }

    belongs_to :container
    belongs_to :popup

    validates :container, presence: true
    validates :popup, presence: true
    validates :placement, presence: true
    validates :trigger, presence: true
    validates :x, presence: true
    validates :y, presence: true

    def placement_string
      PLACEMENT_MAPPINGS[placement] || 'right'
    end

    def trigger_string
      TRIGGER_MAPPINGS[trigger] || 'focus'
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fooltip-0.0.13 app/models/fooltip/link.rb