Class: Decidim::DecidimAwesome::RichTextColumn

Inherits:
Object
  • Object
show all
Includes:
AttributeObject::Model, TranslatableAttributes
Defined in:
app/models/decidim/decidim_awesome/rich_text_column.rb

Overview

Plain data object representing a single column in the Awesome RichText content block. Not backed by a database table — serialized as part of the content block’s JSONB settings.

Constant Summary collapse

PLACEMENT_OPTIONS =
%w(cover_center cover_top cover_bottom contain_center repeat).freeze

Class Method Summary collapse

Class Method Details

.from_settings(data) ⇒ Object



20
21
22
23
24
25
# File 'app/models/decidim/decidim_awesome/rich_text_column.rb', line 20

def self.from_settings(data)
  return [new] if data.blank?

  items = data.is_a?(Hash) ? data.values : Array(data)
  items.first(Decidim::DecidimAwesome.max_rich_text_columns).map { |attrs| new(attrs) }
end