Class: OrdinaryCms::Section

Inherits:
Object
  • Object
show all
Includes:
ActionView::Helpers::OutputSafetyHelper, Mongoid::Document
Defined in:
app/models/ordinary_cms/section.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.[](key) ⇒ Object



14
15
16
# File 'app/models/ordinary_cms/section.rb', line 14

def self.[](key)
  find_by name: key
end

Instance Method Details

#render(what = :content) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'app/models/ordinary_cms/section.rb', line 18

def render(what=:content)
  if what == :alias
    ActionController::Base.helpers.(:span, {id: "#{self.name}_title", 'data-mercury' => 'simple'}) {self.alias}
  else
    ActionController::Base.helpers.(
        :div,
        {class: 'section', id: self.name, 'data-mercury' => 'full'}) {raw self.content}
  end

end