Class: Qbrick::Cms::PagesController
Instance Method Summary
collapse
#default_url_options, #reset_remembered_locale, #set_content_locale
Instance Method Details
#create ⇒ Object
22
23
24
25
26
27
28
29
30
31
|
# File 'app/controllers/qbrick/cms/pages_controller.rb', line 22
def create
@page = Qbrick::Page.create(page_params)
if @page.valid?
flash[:success] = t('layouts.qbrick.cms.flash.success', subject: Qbrick::Page.model_name.human)
respond_with @page, location: qbrick.edit_cms_page_path(@page)
else
render 'new'
end
end
|
#destroy ⇒ Object
50
51
52
53
|
# File 'app/controllers/qbrick/cms/pages_controller.rb', line 50
def destroy
@page = Qbrick::Page.find(params[:id])
@page.destroy
end
|
#edit ⇒ Object
33
34
35
36
37
38
|
# File 'app/controllers/qbrick/cms/pages_controller.rb', line 33
def edit
@page = Qbrick::Page.find(params[:id])
@page.published ||= Qbrick::PublishState::UNPUBLISHED
@page.bricks.each(&:valid?)
respond_with @page
end
|
#index ⇒ Object
6
7
8
9
|
# File 'app/controllers/qbrick/cms/pages_controller.rb', line 6
def index
@pages = Qbrick::Page.roots
respond_with @pages
end
|
#mirror ⇒ Object
59
60
61
62
63
|
# File 'app/controllers/qbrick/cms/pages_controller.rb', line 59
def mirror
@page = Qbrick::Page.find(params[:page_id])
mirror_page if page_can_be_mirrored?
respond_to :js, :html
end
|
#show ⇒ Object
11
12
13
14
|
# File 'app/controllers/qbrick/cms/pages_controller.rb', line 11
def show
@page = Qbrick::Page.find(params[:id])
respond_with @page
end
|
#sort ⇒ Object
55
56
57
|
# File 'app/controllers/qbrick/cms/pages_controller.rb', line 55
def sort
Qbrick::PageTree.update(params[:page_tree])
end
|
#update ⇒ Object
40
41
42
43
44
45
46
47
48
|
# File 'app/controllers/qbrick/cms/pages_controller.rb', line 40
def update
@page = Qbrick::Page.find(params[:id])
if @page.update_attributes(page_params)
flash[:success] = t('layouts.qbrick.cms.flash.success', subject: Qbrick::Page.model_name.human)
respond_with @page, location: qbrick.edit_cms_page_path(@page)
else
render 'edit'
end
end
|