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.27 app/controllers/workarea/admin/content_controller.rb
workarea-admin-3.5.26 app/controllers/workarea/admin/content_controller.rb
workarea-admin-3.4.45 app/controllers/workarea/admin/content_controller.rb
workarea-admin-3.5.25 app/controllers/workarea/admin/content_controller.rb
workarea-admin-3.5.23 app/controllers/workarea/admin/content_controller.rb
workarea-admin-3.4.44 app/controllers/workarea/admin/content_controller.rb
workarea-admin-3.5.22 app/controllers/workarea/admin/content_controller.rb
workarea-admin-3.4.43 app/controllers/workarea/admin/content_controller.rb
workarea-admin-3.5.21 app/controllers/workarea/admin/content_controller.rb
workarea-admin-3.4.42 app/controllers/workarea/admin/content_controller.rb
workarea-admin-3.5.20 app/controllers/workarea/admin/content_controller.rb
workarea-admin-3.4.41 app/controllers/workarea/admin/content_controller.rb
workarea-admin-3.5.19 app/controllers/workarea/admin/content_controller.rb
workarea-admin-3.4.40 app/controllers/workarea/admin/content_controller.rb
workarea-admin-3.5.18 app/controllers/workarea/admin/content_controller.rb
workarea-admin-3.4.39 app/controllers/workarea/admin/content_controller.rb
workarea-admin-3.5.17 app/controllers/workarea/admin/content_controller.rb
workarea-admin-3.4.38 app/controllers/workarea/admin/content_controller.rb
workarea-admin-3.5.16 app/controllers/workarea/admin/content_controller.rb
workarea-admin-3.4.37 app/controllers/workarea/admin/content_controller.rb