Sha256: ae03849a619ad3531c0de7132c5e658f4b56832d52c8d95a005897083fc95409

Contents?: true

Size: 847 Bytes

Versions: 10

Compression:

Stored size: 847 Bytes

Contents

module Hyrax
  class ContentBlocksController < ApplicationController
    load_and_authorize_resource except: :index
    before_action :load_featured_researchers, only: :index
    authorize_resource only: :index

    def index; end

    def create
      @content_block.save
      redirect_back fallback_location: hyrax.content_blocks_path
    end

    def update
      @content_block.update(update_params)
      redirect_back fallback_location: hyrax.content_blocks_path
    end

    protected

      def create_params
        params.require(:content_block).permit([:name, :value, :external_key])
      end

      def update_params
        params.require(:content_block).permit([:value, :external_key])
      end

      def load_featured_researchers
        @content_blocks = ContentBlock.recent_researchers.page(params[:page])
      end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
hyrax-1.1.1 app/controllers/hyrax/content_blocks_controller.rb
hyrax-1.1.0 app/controllers/hyrax/content_blocks_controller.rb
hyrax-1.0.5 app/controllers/hyrax/content_blocks_controller.rb
hyrax-1.0.4 app/controllers/hyrax/content_blocks_controller.rb
hyrax-1.0.3 app/controllers/hyrax/content_blocks_controller.rb
hyrax-1.0.2 app/controllers/hyrax/content_blocks_controller.rb
hyrax-1.0.1 app/controllers/hyrax/content_blocks_controller.rb
hyrax-1.0.0.rc2 app/controllers/hyrax/content_blocks_controller.rb
hyrax-1.0.0.rc1 app/controllers/hyrax/content_blocks_controller.rb
test_hyrax-0.0.1.alpha app/controllers/hyrax/content_blocks_controller.rb