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.3.6 app/models/panda_cms/block.rb
panda_cms-0.3.5 app/models/panda_cms/block.rb
panda_cms-0.3.4 app/models/panda_cms/block.rb
panda_cms-0.3.3 app/models/panda_cms/block.rb
panda_cms-0.3.2 app/models/panda_cms/block.rb
panda_cms-0.3.1 app/models/panda_cms/block.rb
panda_cms-0.3.0 app/models/panda_cms/block.rb
panda_cms-0.2.7 app/models/panda_cms/block.rb
panda_cms-0.2.6 app/models/panda_cms/block.rb
panda_cms-0.2.5 app/models/panda_cms/block.rb
panda_cms-0.2.4 app/models/panda_cms/block.rb
panda_cms-0.2.3 app/models/panda_cms/block.rb
panda_cms-0.2.2 app/models/panda_cms/block.rb
panda_cms-0.2.1 app/models/panda_cms/block.rb
panda_cms-0.2.0 app/models/panda_cms/block.rb