Class: Breeze::PagesController
Instance Method Summary
collapse
#authenticate_if, #current_member_email
Instance Method Details
#create ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'app/controllers/breeze/pages_controller.rb', line 29
def create
name = params[:name]
if( name.blank? )
flash.alert = "Must enter name"
redirect_to pages_url
else
@page = Page.new_page(name , params[:type])
@page.add_save(current_member_email)
template = PageStyle.find_by_type(@page.type).section_template
if(template)
section = @page.new_section(template)
section.add_save(current_member_email)
redirect_to section_url(section.id) , notice: "Page was successfully created."
else
redirect_to page_url(@page.id) , notice: "Page was successfully created. Choose first section"
end
end
end
|
#destroy ⇒ Object
48
49
50
51
|
# File 'app/controllers/breeze/pages_controller.rb', line 48
def destroy
@page.delete_save!(current_member_email)
redirect_to pages_url, notice: "Page #{@page.name} was removed."
end
|
#index ⇒ Object
6
7
8
9
10
11
12
13
|
# File 'app/controllers/breeze/pages_controller.rb', line 6
def index
if(! params[:type].blank?)
@pages = Page.find_all(:type, params[:type])
else
@pages = Page.all
end
@page_styles = PageStyle.all
end
|
#show ⇒ Object
15
16
17
|
# File 'app/controllers/breeze/pages_controller.rb', line 15
def show
end
|
#update ⇒ Object
19
20
21
22
23
24
25
26
27
|
# File 'app/controllers/breeze/pages_controller.rb', line 19
def update
if( !params[:name].blank? && (params[:name] != @page.name))
@page.set_name params[:name]
end
@page.update_present_options( params[:options])
@page.edit_save(current_member_email)
message = "Saved"
redirect_to page_url(@page) , notice: message
end
|