Class: Fae::StaticPagesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/fae/static_pages_controller.rb

Instance Method Summary collapse

Methods included from NavItems

#nav_items

Instance Method Details

#editObject



12
13
14
15
16
# File 'app/controllers/fae/static_pages_controller.rb', line 12

def edit
  build_assocs
  params[:static_page] = true
  render params[:slug]
end

#indexObject



7
8
9
10
# File 'app/controllers/fae/static_pages_controller.rb', line 7

def index
  raise 'Missing blocks method inside StaticPages\' child controller' unless fae_pages
  @items = fae_pages.map { |b| b.instance }
end

#updateObject



18
19
20
21
22
23
24
25
# File 'app/controllers/fae/static_pages_controller.rb', line 18

def update
  if @item.update(item_params)
    redirect_to @index_path, notice: t('fae.save_notice')
  else
    build_assocs
    render template: "#{fae.root_path.gsub('/', '')}/content_blocks/#{params[:slug]}", error: t('fae.save_error')
  end
end