Class: Locomotive::PagesController
Instance Method Summary
collapse
#require_ssl
#current_site_public_url, #public_page_url, #switch_to_site_url
#sections
#back_to_default_site_locale, #current_content_locale, #localized?, #set_back_office_locale, #set_current_content_locale, #setup_i18n_fallbacks
Instance Method Details
#create ⇒ Object
27
28
29
30
|
# File 'app/controllers/locomotive/pages_controller.rb', line 27
def create
@page = current_site.pages.create(params[:page])
respond_with @page, location: edit_page_path(@page._id)
end
|
#destroy ⇒ Object
43
44
45
46
47
|
# File 'app/controllers/locomotive/pages_controller.rb', line 43
def destroy
@page = current_site.pages.find(params[:id])
@page.destroy
respond_with @page
end
|
#edit ⇒ Object
32
33
34
35
|
# File 'app/controllers/locomotive/pages_controller.rb', line 32
def edit
@page = current_site.pages.find(params[:id])
respond_with @page
end
|
#get_path ⇒ Object
55
56
57
58
59
60
61
62
63
64
|
# File 'app/controllers/locomotive/pages_controller.rb', line 55
def get_path
page = current_site.pages.build(parent: current_site.pages.find(params[:parent_id]), slug: params[:slug].permalink).tap do |p|
p.valid?; p.send(:build_fullpath)
end
render json: {
url: public_page_url(page, locale: current_content_locale),
slug: page.slug,
templatized_parent: page.templatized_from_parent?
}
end
|
#index ⇒ Object
12
13
14
15
|
# File 'app/controllers/locomotive/pages_controller.rb', line 12
def index
@pages = current_site.all_pages_in_once
respond_with(@pages)
end
|
#new ⇒ Object
22
23
24
25
|
# File 'app/controllers/locomotive/pages_controller.rb', line 22
def new
@page = current_site.pages.build
respond_with @page
end
|
#show ⇒ Object
17
18
19
20
|
# File 'app/controllers/locomotive/pages_controller.rb', line 17
def show
@page = current_site.pages.find(params[:id])
respond_with @page
end
|
#sort ⇒ Object
49
50
51
52
53
|
# File 'app/controllers/locomotive/pages_controller.rb', line 49
def sort
@page = current_site.pages.find(params[:id])
@page.sort_children!(params[:children])
respond_with @page
end
|
#update ⇒ Object
37
38
39
40
41
|
# File 'app/controllers/locomotive/pages_controller.rb', line 37
def update
@page = current_site.pages.find(params[:id])
@page.update_attributes(params[:page])
respond_with @page, location: edit_page_path(@page._id)
end
|