Class: Quadro::PagesController
Instance Method Summary
collapse
#after_sign_in_path_for, #after_sign_out_path_for
Instance Method Details
#create ⇒ Object
11
12
13
14
15
16
17
18
|
# File 'app/controllers/quadro/pages_controller.rb', line 11
def create
page.author = current_user
if page.save
flash[:notice] = t('quadro.flash.created')
else
flash[:alert] = t('quadro.flash.not_created')
end
end
|
#destroy ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
|
# File 'app/controllers/quadro/pages_controller.rb', line 28
def destroy
unless page.is_root?
if page.destroy
flash[:notice] = t('quadro.flash.deleted')
else
flash[:alert] = t('quadro.flash.not_deleted')
end
else
flash[:alert] = t('quadro.flash.could_not_be_deleted')
end
end
|
40
41
42
43
44
45
46
47
48
49
|
# File 'app/controllers/quadro/pages_controller.rb', line 40
def form
interaction.ip_address = request.remote_ip
interaction.user_agent = request.user_agent
interaction.content = params[:form]
if interaction.save
flash[:notice] = t('quadro.flash.created')
else
flash[:alert] = t('quadro.flash.not_created')
end
end
|
#publish ⇒ Object
51
52
53
54
55
56
57
|
# File 'app/controllers/quadro/pages_controller.rb', line 51
def publish
if page.publish!
flash[:notice] = t('quadro.flash.published')
else
flash[:alert] = t('quadro.flash.not_published')
end
end
|
#unpublish ⇒ Object
59
60
61
62
63
64
65
|
# File 'app/controllers/quadro/pages_controller.rb', line 59
def unpublish
if page.unpublish!
flash[:notice] = t('quadro.flash.unpublished')
else
flash[:alert] = t('quadro.flash.not_unpublished')
end
end
|
#update ⇒ Object
20
21
22
23
24
25
26
|
# File 'app/controllers/quadro/pages_controller.rb', line 20
def update
if page.update_attributes(page_params)
flash[:notice] = t('quadro.flash.updated')
else
flash[:alert] = t('quadro.flash.not_updated')
end
end
|