Class: Breeze::PagesController
Instance Method Summary
collapse
#authenticate_if, #current_member_email
Instance Method Details
#create ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'app/controllers/breeze/pages_controller.rb', line 36
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
55
56
57
58
|
# File 'app/controllers/breeze/pages_controller.rb', line 55
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
28
29
30
31
32
33
34
|
# File 'app/controllers/breeze/pages_controller.rb', line 19
def update
if( !params[:name].blank? && (params[:name] != @page.name))
@page.set_name params[:name]
@page.edit_save(current_member_email)
message = "Page renamed"
end
options = params[:option]
if options
@page.option_definitions.each do |option|
@page.set_option(option.name, options[option.name])
end
@page.edit_save(current_member_email)
message = "Options saved"
end
redirect_to page_url(@page) , notice: message
end
|