Class: PagesController

Inherits:
CmsRailsController show all
Defined in:
app/controllers/pages_controller.rb

Instance Method Summary collapse

Methods inherited from CmsRailsController

#current_user, #find_page, #is_login!, #menu

Instance Method Details

#createObject



12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/pages_controller.rb', line 12

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

#indexObject



3
4
# File 'app/controllers/pages_controller.rb', line 3

def index
end

#newObject



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

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