Sha256: 055e31984d1f20525cea624f8a231920af48a2bc2c858a8a95ed06daf1829cc5

Contents?: true

Size: 1.01 KB

Versions: 35

Compression:

Stored size: 1.01 KB

Contents

module PandaCms
  class Block < ApplicationRecord
    self.table_name = "panda_cms_blocks"

    belongs_to :template, foreign_key: :panda_cms_template_id, class_name: "PandaCms::Template", inverse_of: :blocks, optional: true
    has_many :block_contents, foreign_key: :panda_cms_block_id, class_name: "PandaCms::BlockContent", inverse_of: :block

    validates :kind, presence: true
    validates :name, presence: true
    validates :key, presence: true, uniqueness: {scope: :panda_cms_template_id, case_sensitive: false}

    # Validation for presence on template intentionally skipped to allow global elements

    # NB: Commented out values are not yet implemented
    enum :kind, {
      plain_text: "plain_text",
      rich_text: "rich_text",
      iframe: "iframe",
      list: "list"
      # image: "image",
      # video: "video",
      # audio: "audio",
      # file: "file",
      # code: "code",
      # iframe: "iframe",
      # quote: "quote",
      # list: "list"
      # table: "table",
      # form: "form"
    }
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
panda_cms-0.5.10 app/models/panda_cms/block.rb
panda_cms-0.5.9 app/models/panda_cms/block.rb
panda_cms-0.5.8 app/models/panda_cms/block.rb
panda_cms-0.5.7 app/models/panda_cms/block.rb
panda_cms-0.5.6 app/models/panda_cms/block.rb
panda_cms-0.5.5 app/models/panda_cms/block.rb
panda_cms-0.5.4 app/models/panda_cms/block.rb
panda_cms-0.5.3 app/models/panda_cms/block.rb
panda_cms-0.5.2 app/models/panda_cms/block.rb
panda_cms-0.5.1 app/models/panda_cms/block.rb
panda_cms-0.5.0 app/models/panda_cms/block.rb
panda_cms-0.3.15 app/models/panda_cms/block.rb
panda_cms-0.3.14 app/models/panda_cms/block.rb
panda_cms-0.3.13 app/models/panda_cms/block.rb
panda_cms-0.3.12 app/models/panda_cms/block.rb
panda_cms-0.3.11 app/models/panda_cms/block.rb
panda_cms-0.3.10 app/models/panda_cms/block.rb
panda_cms-0.3.9 app/models/panda_cms/block.rb
panda_cms-0.3.8 app/models/panda_cms/block.rb
panda_cms-0.3.7 app/models/panda_cms/block.rb