Class: Locomotive::PagesController
Instance Method Summary
collapse
#current_site_public_url, #public_page_url
Instance Method Details
#create ⇒ Object
20
21
22
23
24
|
# File 'app/controllers/locomotive/pages_controller.rb', line 20
def create
authorize Page
@page = service.create(page_params)
respond_with @page, location: -> { edit_page_path(current_site, @page) }
end
|
#destroy ⇒ Object
38
39
40
41
42
|
# File 'app/controllers/locomotive/pages_controller.rb', line 38
def destroy
authorize @page
service.destroy(@page)
respond_with @page, location: editable_elements_path(current_site, current_site.pages.root.first)
end
|
#edit ⇒ Object
26
27
28
29
30
|
# File 'app/controllers/locomotive/pages_controller.rb', line 26
def edit
authorize @page
@page.find_layout
respond_with @page
end
|
#new ⇒ Object
14
15
16
17
18
|
# File 'app/controllers/locomotive/pages_controller.rb', line 14
def new
authorize Page
@page = current_site.pages.build
respond_with @page
end
|
#sort ⇒ Object
44
45
46
47
48
|
# File 'app/controllers/locomotive/pages_controller.rb', line 44
def sort
authorize @page, :update?
service.sort(@page, params.require(:children))
respond_with @page, location: edit_page_path(current_site, @page)
end
|
#update ⇒ Object
32
33
34
35
36
|
# File 'app/controllers/locomotive/pages_controller.rb', line 32
def update
authorize @page
service.update(@page, page_params)
respond_with @page, location: edit_page_path(current_site, @page)
end
|