Class: OrdinaryCms::PagesController

Inherits:
ApplicationController show all
Includes:
SmartPagesRender
Defined in:
app/controllers/ordinary_cms/pages_controller.rb

Instance Method Summary collapse

Methods included from SmartPagesRender

#smart_render

Instance Method Details

#showObject



10
11
12
# File 'app/controllers/ordinary_cms/pages_controller.rb', line 10

def show
  smart_render(@page.slug)
end

#updateObject



14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/ordinary_cms/pages_controller.rb', line 14

def update
  sections_keys = params[:content].keys - [:undefined]
  sections_keys.each do |key|
    section_name = key.gsub '_title', ''
    attr = (section_name == key) ? 'content' : 'alias'
    section = @page.section(section_name)
    section.update_attributes attr => params[:content][key][:value] unless section.nil?
  end
  render text: ''
end