Class: Homeland::Wiki::Admin::PagesController
- Inherits:
-
Admin::ApplicationController
- Object
- Admin::ApplicationController
- Homeland::Wiki::Admin::PagesController
- Defined in:
- app/controllers/homeland/wiki/admin/pages_controller.rb
Instance Method Summary collapse
Instance Method Details
#destroy ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'app/controllers/homeland/wiki/admin/pages_controller.rb', line 26 def destroy if @page.deleted_at.present? @page.delete else @page.destroy end redirect_to(admin_pages_path) end |
#edit ⇒ Object
9 10 |
# File 'app/controllers/homeland/wiki/admin/pages_controller.rb', line 9 def edit end |
#index ⇒ Object
5 6 7 |
# File 'app/controllers/homeland/wiki/admin/pages_controller.rb', line 5 def index @pages = Page.unscoped.order(id: :desc).page(params[:page]) end |
#update ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/homeland/wiki/admin/pages_controller.rb', line 12 def update @page.title = params[:page][:title] @page.body = params[:page][:body] @page.slug = params[:page][:slug] @page.locked = params[:page][:locked] @page.user_id = current_user.id if @page.save redirect_to(admin_pages_path, notice: 'Page was successfully updated.') else render action: 'edit' end end |