Sha256: c43ce17f052f6026710ce57a649ae4c5710c8c05ce410555d71e21085fe7978e

Contents?: true

Size: 818 Bytes

Versions: 6

Compression:

Stored size: 818 Bytes

Contents

module Spina
  module Admin
    class ResourcesController < AdminController

      before_action :set_resource, only: [:show, :edit, :update]

      def show        
        add_breadcrumb @resource.label
      end

      def edit        
        add_breadcrumb @resource.label, spina.admin_resource_path(@resource)
        add_breadcrumb t('spina.edit')
      end

      def update        
        if @resource.update(resource_params)
          redirect_to spina.admin_resource_path(@resource)
        else
          render :edit
        end
      end

      private

        def resource_params
          params.require(:resource).permit(:label, :view_template, :order_by, :parent_page_id)
        end

        def set_resource
          @resource = Resource.find(params[:id])          
        end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
spina-1.2.0 app/controllers/spina/admin/resources_controller.rb
spina-1.1.4 app/controllers/spina/admin/resources_controller.rb
spina-1.1.3 app/controllers/spina/admin/resources_controller.rb
spina-1.1.2 app/controllers/spina/admin/resources_controller.rb
spina-1.1.1 app/controllers/spina/admin/resources_controller.rb
spina-1.1.0 app/controllers/spina/admin/resources_controller.rb