Class: Comable::Admin::PagesController
Instance Method Summary
collapse
#current_ability, #respond_to_export_with
Instance Method Details
#create ⇒ Object
25
26
27
28
29
30
31
32
33
34
|
# File 'app/controllers/comable/admin/pages_controller.rb', line 25
def create
@page = Comable::Page.new(page_params)
@page.slug = @page.normalize_slug(page_params[:slug])
if @page.save
redirect_to comable.admin_page_path(@page), notice: Comable.t('successful')
else
render :new
end
end
|
#destroy ⇒ Object
47
48
49
50
|
# File 'app/controllers/comable/admin/pages_controller.rb', line 47
def destroy
@page.destroy
redirect_to comable.admin_pages_path, notice: Comable.t('successful')
end
|
#edit ⇒ Object
21
22
23
|
# File 'app/controllers/comable/admin/pages_controller.rb', line 21
def edit
set_preview_session
end
|
#index ⇒ Object
8
9
10
11
|
# File 'app/controllers/comable/admin/pages_controller.rb', line 8
def index
@q = Comable::Page.ransack(params[:q])
@pages = @q.result.accessible_by(current_ability).by_newest
end
|
#new ⇒ Object
18
19
|
# File 'app/controllers/comable/admin/pages_controller.rb', line 18
def new
end
|
#show ⇒ Object
13
14
15
16
|
# File 'app/controllers/comable/admin/pages_controller.rb', line 13
def show
edit
render :edit
end
|
#update ⇒ Object
36
37
38
39
40
41
42
43
44
45
|
# File 'app/controllers/comable/admin/pages_controller.rb', line 36
def update
@page.attributes = page_params
@page.slug = @page.normalize_slug(page_params[:slug])
if @page.save
redirect_to comable.admin_page_path(@page), notice: Comable.t('successful')
else
render :edit
end
end
|