Class: PagesController
Instance Method Summary
collapse
#current_navable, #current_navable=, #current_user, #point_navigation_to, #redirect_www_subdomain, #set_locale
Instance Method Details
#create ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'app/controllers/pages_controller.rb', line 40
def create
if secure_parent
@association = secure_parent.child_pages
authorize! :create_page_for, secure_parent
else
@association = Page
authorize! :create, Page
end
@new_page = @association.create( title: I18n.t(:new_page) )
@new_page.author = current_user
@new_page.save
redirect_to @new_page
end
|
#show ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'app/controllers/pages_controller.rb', line 8
def show
if @page
current_user.try(:update_last_seen_activity, "sieht sich Informationen an: #{@page.title}", @page)
if @page.redirect_to
target = @page.redirect_to
target.merge!({protocol: "https://"}) if target.kind_of?(Hash) && Rails.env.production?
redirect_to target
return
end
@blog_entries = @page.blog_entries.limit(10)
@title = @page.title
@navable = @page
@page = @page.becomes(Page) end
metric_logger.log_event @page.attributes, type: :show_page
respond_with @page
end
|
#update ⇒ Object
34
35
36
37
38
|
# File 'app/controllers/pages_controller.rb', line 34
def update
params[:blog_post] ||= params[:page] @page.update_attributes params[ :page ]
respond_with_bip(@page)
end
|