class Locomotive::Steam::Liquid::Drops::Section
Public Class Methods
new(section, content)
click to toggle source
# File lib/locomotive/steam/liquid/drops/section.rb, line 8 def initialize(section, content) @section = section @content = content if @content.blank? @content = section.definition['default'] || { 'settings' => {}, 'blocks' => [] } end end
Public Instance Methods
anchor_id()
click to toggle source
# File lib/locomotive/steam/liquid/drops/section.rb, line 41 def anchor_id "#{@content['anchor'] || id}-section" end
blocks()
click to toggle source
# File lib/locomotive/steam/liquid/drops/section.rb, line 53 def blocks (@content['blocks'] || []).each_with_index.map do |block, index| SectionBlock.new(@section, block, index) end end
css_class()
click to toggle source
# File lib/locomotive/steam/liquid/drops/section.rb, line 37 def css_class @section.definition['class'] end
editor_setting_data()
click to toggle source
# File lib/locomotive/steam/liquid/drops/section.rb, line 59 def editor_setting_data SectionEditorSettingData.new(@section) end
id()
click to toggle source
FIXME: id acts as the domID to build HTML tags
# File lib/locomotive/steam/liquid/drops/section.rb, line 18 def id @content['id'] end
id=(id)
click to toggle source
# File lib/locomotive/steam/liquid/drops/section.rb, line 22 def id=(id) @content['id'] = id end
locomotive_attributes()
click to toggle source
# File lib/locomotive/steam/liquid/drops/section.rb, line 45 def locomotive_attributes %(data-locomotive-section-id="#{id}" data-locomotive-section-type="#{type}").tap do # let Steam know that we won't need to wrap the section HTML # into an extra DIV layer. @context['is_section_locomotive_attributes_displayed'] = true end end
settings()
click to toggle source
# File lib/locomotive/steam/liquid/drops/section.rb, line 30 def settings @content_proxy ||= SectionContentProxy.new( @content['settings'] || {}, @section.definition['settings'] || [] ) end
type()
click to toggle source
# File lib/locomotive/steam/liquid/drops/section.rb, line 26 def type @section.type end