Class: Workarea::Admin::ContentPagesController
Instance Method Summary
collapse
#current_user, #find_sort, #wrap_in_view_model, wrap_in_view_model
Methods included from Publishing
#allow_publishing!, #allow_publishing?, #set_publishing_options
Methods included from Visiting
#most_visited
Instance Method Details
#destroy ⇒ Object
36
37
38
39
40
|
# File 'app/controllers/workarea/admin/content_pages_controller.rb', line 36
def destroy
@page.destroy
flash[:success] = t('workarea.admin.content_pages.flash_messages.removed')
redirect_to content_pages_path
end
|
#edit ⇒ Object
22
23
24
|
# File 'app/controllers/workarea/admin/content_pages_controller.rb', line 22
def edit
@page = Admin::PageViewModel.new(@page)
end
|
#index ⇒ Object
10
11
12
13
14
15
16
|
# File 'app/controllers/workarea/admin/content_pages_controller.rb', line 10
def index
search = Search::AdminPages.new(
params.merge(autocomplete: request.xhr?)
)
@search = Admin::SearchViewModel.new(search, view_model_options)
end
|
#show ⇒ Object
18
19
20
|
# File 'app/controllers/workarea/admin/content_pages_controller.rb', line 18
def show
@page = Admin::PageViewModel.new(@page)
end
|
#update ⇒ Object
26
27
28
29
30
31
32
33
34
|
# File 'app/controllers/workarea/admin/content_pages_controller.rb', line 26
def update
if @page.update_attributes(params[:page])
flash[:success] = t('workarea.admin.content_pages.flash_messages.saved')
redirect_to content_page_path(@page)
else
@page = Admin::PageViewModel.new(@page)
render :edit, status: :unprocessable_entity
end
end
|