Sha256: e7b8247fd2b8e068a66514785c316314a72660f8176a50926615565b25d87401

Contents?: true

Size: 1.33 KB

Versions: 62

Compression:

Stored size: 1.33 KB

Contents

module Workarea
  class Admin::ContentController < Admin::ApplicationController
    required_permissions :store

    before_action :check_publishing_authorization
    before_action :find_content, except: :index
    after_action :track_index_filters, only: :index

    def index
      @content = Admin::ContentViewModel.wrap(
        Workarea::Content.system,
        view_model_options
      )
    end

    def show
      unless @content.system?
        redirect_to edit_content_path(@content)
      end

      @content = Admin::ContentViewModel.new(@content, view_model_options)
    end

    def edit
      @content = Admin::ContentViewModel.new(@content, view_model_options)
    end

    def preview
      @content = Admin::ContentViewModel.new(@content, view_model_options)
    end

    def advanced
      @content = Admin::ContentViewModel.wrap(@content, view_model_options)
    end

    def update
      @content.attributes = params[:content]

      if @content.save
        flash[:success] = t('workarea.admin.create_content_pages.flash_messages.saved')
        redirect_to return_to || edit_content_path(@content)
      else
        @content = Admin::ContentViewModel.new(@content)
        render :advanced, status: :unprocessable_entity
      end
    end

    private

    def find_content
      @content = Content.find(params[:id])
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-admin-3.5.15 app/controllers/workarea/admin/content_controller.rb
workarea-admin-3.4.36 app/controllers/workarea/admin/content_controller.rb
workarea-admin-3.5.14 app/controllers/workarea/admin/content_controller.rb
workarea-admin-3.4.35 app/controllers/workarea/admin/content_controller.rb
workarea-admin-3.5.13 app/controllers/workarea/admin/content_controller.rb
workarea-admin-3.4.34 app/controllers/workarea/admin/content_controller.rb
workarea-admin-3.5.12 app/controllers/workarea/admin/content_controller.rb
workarea-admin-3.4.33 app/controllers/workarea/admin/content_controller.rb
workarea-admin-3.5.11 app/controllers/workarea/admin/content_controller.rb
workarea-admin-3.5.10 app/controllers/workarea/admin/content_controller.rb
workarea-admin-3.4.32 app/controllers/workarea/admin/content_controller.rb
workarea-admin-3.5.9 app/controllers/workarea/admin/content_controller.rb
workarea-admin-3.4.31 app/controllers/workarea/admin/content_controller.rb
workarea-admin-3.5.8 app/controllers/workarea/admin/content_controller.rb
workarea-admin-3.4.30 app/controllers/workarea/admin/content_controller.rb
workarea-admin-3.5.7 app/controllers/workarea/admin/content_controller.rb
workarea-admin-3.4.29 app/controllers/workarea/admin/content_controller.rb
workarea-admin-3.5.6 app/controllers/workarea/admin/content_controller.rb
workarea-admin-3.4.28 app/controllers/workarea/admin/content_controller.rb
workarea-admin-3.5.5 app/controllers/workarea/admin/content_controller.rb