Class: PagesController

Inherits:
ApplicationController
  • Object
show all
Includes:
Cms::Rails::RenderPage
Defined in:
app/controllers/pages_controller.rb

Instance Method Summary collapse

Methods included from Cms::Rails::RenderPage

#child_exist!, #cms_render_menu, #cms_render_navigation, #cms_render_page, #find_child, #is_basic_page!, #menu, #select_page

Instance Method Details

#createObject



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

def create
  params[:page][:name] = params[:page][:name].humanize
  page = Page.create(page_params)
  if page.save and create_type(page).save
    redirection(page.name.parameterize.underscore)
  else
    redirect_to new_page_path(type: params[:type])
  end
end

#indexObject



6
7
# File 'app/controllers/pages_controller.rb', line 6

def index
end

#newObject



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

def new
  flash[:notice] = 'Select a especific type of page' if params[:type].nil?
  @page = Page.new
  @position = give_position
end