Class: Integral::Backend::PagesController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- BaseController
- Integral::Backend::PagesController
- Defined in:
- app/controllers/integral/backend/pages_controller.rb
Overview
Pages controller
Instance Method Summary collapse
-
#activities ⇒ Object
GET /:id/activities.
-
#activity ⇒ Object
GET /:id/activities/:id.
-
#create ⇒ Object
POST / Page creation.
-
#current_policy ⇒ BasePolicy
Current authorization policy.
-
#destroy ⇒ Object
DELETE /:id.
-
#edit ⇒ Object
GET /:id/edit Page edit form.
-
#index ⇒ Object
GET / Lists all pages.
-
#new ⇒ Object
GET /new Page creation form.
-
#update ⇒ Object
PUT /:id Updating an page.
Instance Method Details
#activities ⇒ Object
GET /:id/activities
75 76 77 |
# File 'app/controllers/integral/backend/pages_controller.rb', line 75 def activities respond_with_activities(:edit_backend_page_url) end |
#activity ⇒ Object
GET /:id/activities/:id
80 81 82 83 84 85 86 87 |
# File 'app/controllers/integral/backend/pages_controller.rb', line 80 def activity Version I18n.t('integral.navigation.activity'), :activities_backend_page_url I18n.t('integral.actions.view') @activity = PageVersion.find(params[:activity_id]).decorate end |
#create ⇒ Object
POST / Page creation
36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/integral/backend/pages_controller.rb', line 36 def create @page = Page.new(page_params) if @page.save respond_successfully(('creation_success'), edit_backend_page_path(@page)) else respond_failure(('creation_failure'), @page, :new) end end |
#current_policy ⇒ BasePolicy
Returns current authorization policy.
90 91 92 93 |
# File 'app/controllers/integral/backend/pages_controller.rb', line 90 def current_policy return policy(@page) if @page policy(Integral::Page.new) end |
#destroy ⇒ Object
DELETE /:id
64 65 66 67 68 69 70 71 72 |
# File 'app/controllers/integral/backend/pages_controller.rb', line 64 def destroy if @page.destroy respond_successfully(('delete_success'), backend_pages_path) else = @page.errors..to_sentence flash[:error] = "#{('delete_failure')} - #{}" redirect_to backend_pages_path end end |
#edit ⇒ Object
GET /:id/edit Page edit form
48 49 50 51 |
# File 'app/controllers/integral/backend/pages_controller.rb', line 48 def edit # add_breadcrumb @page.title, backend_page_url(@page) I18n.t('integral.navigation.edit'), :edit_backend_page_path end |
#index ⇒ Object
GET / Lists all pages
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/integral/backend/pages_controller.rb', line 10 def index respond_to do |format| format.html do set_grid(Integral::Grids::PagesGrid) end format.json do if params[:gridview].present? set_grid(Integral::Grids::PagesGrid) render json: { content: render_to_string(partial: 'integral/backend/pages/grid', locals: { grid: @grid }) } else respond_to_record_selector(Integral::Page) end end end end |
#new ⇒ Object
GET /new Page creation form
29 30 31 32 |
# File 'app/controllers/integral/backend/pages_controller.rb', line 29 def new I18n.t('integral.navigation.new'), :new_backend_page_path @page = Page.new end |
#update ⇒ Object
PUT /:id Updating an page
55 56 57 58 59 60 61 |
# File 'app/controllers/integral/backend/pages_controller.rb', line 55 def update if @page.update(page_params) respond_successfully(('edit_success'), edit_backend_page_path(@page)) else respond_failure(('edit_failure'), @page, :edit) end end |