Sha256: 6db9231040e3e0d862eb85ed3db83b07e8f144cf9e05c7a00860a45eb0302bc3

Contents?: true

Size: 1.1 KB

Versions: 15

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true

module PandaCms
  module Admin
    class BlockContentsController < ApplicationController
      before_action :set_page, only: %i[update]
      before_action :set_block_content, only: %i[update]
      before_action :set_paper_trail_whodunnit, only: %i[update]

      # @type PATCH/PUT
      # @return
      def update
        if @block_content.update(block_content_params)
          render json: @block_content, status: :ok
        else
          render json: @block_content.errors, status: :unprocessable_entity
        end
      end

      private

      # @type private
      # @return PandaCms::Page
      def set_page
        @page = PandaCms::Page.find(params[:page_id])
      end

      # @type private
      # @return PandaCms::BlockContent
      def set_block_content
        @block_content = PandaCms::BlockContent.find(params[:id])
      end

      # Only allow a list of trusted parameters through.
      # @type private
      # @return ActionController::StrongParameters
      def block_content_params
        params.require(:block_content).permit(:content)
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
panda_cms-0.3.6 app/controllers/panda_cms/admin/block_contents_controller.rb
panda_cms-0.3.5 app/controllers/panda_cms/admin/block_contents_controller.rb
panda_cms-0.3.4 app/controllers/panda_cms/admin/block_contents_controller.rb
panda_cms-0.3.3 app/controllers/panda_cms/admin/block_contents_controller.rb
panda_cms-0.3.2 app/controllers/panda_cms/admin/block_contents_controller.rb
panda_cms-0.3.1 app/controllers/panda_cms/admin/block_contents_controller.rb
panda_cms-0.3.0 app/controllers/panda_cms/admin/block_contents_controller.rb
panda_cms-0.2.7 app/controllers/panda_cms/admin/block_contents_controller.rb
panda_cms-0.2.6 app/controllers/panda_cms/admin/block_contents_controller.rb
panda_cms-0.2.5 app/controllers/panda_cms/admin/block_contents_controller.rb
panda_cms-0.2.4 app/controllers/panda_cms/admin/block_contents_controller.rb
panda_cms-0.2.3 app/controllers/panda_cms/admin/block_contents_controller.rb
panda_cms-0.2.2 app/controllers/panda_cms/admin/block_contents_controller.rb
panda_cms-0.2.1 app/controllers/panda_cms/admin/block_contents_controller.rb
panda_cms-0.2.0 app/controllers/panda_cms/admin/block_contents_controller.rb