Sha256: 95678c274d12ec1be75cdf45d5d79461c0440daf896d68c75de23d5dc592ee4d

Contents?: true

Size: 886 Bytes

Versions: 6

Compression:

Stored size: 886 Bytes

Contents

module Gaku
  module Admin
    class TemplatesController < Admin::BaseController

      load_and_authorize_resource class: Template

      respond_to :js, :html

      inherit_resources

      before_action :count, only: %i(create destroy index)

      def create
        super do |format|
          format.html { redirect_to :back }
        end
      end

      def update
        super do |format|
          format.html { redirect_to :back }
        end
      end

      def download
        @template = Template.find(params[:id])
        send_file @template.file.path
      end

      protected

      def resource_params
        return [] if request.get?
        [params.require(:template).permit(attributes)]
      end

      private

      def count
        @count = Template.count
      end

      def attributes
        %i(name context locked file)
      end

    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
gaku_core-0.0.3 app/controllers/gaku/admin/templates_controller.rb
gaku-0.0.3 core/app/controllers/gaku/admin/templates_controller.rb
gaku-0.0.2 core/app/controllers/gaku/admin/templates_controller.rb
gaku_core-0.0.2 app/controllers/gaku/admin/templates_controller.rb
gaku-0.0.1 core/app/controllers/gaku/admin/templates_controller.rb
gaku_core-0.0.1 app/controllers/gaku/admin/templates_controller.rb