Sha256: 70a895d71ad482190f344a579889b3e0edbb52495752f18f293f2f407c14b48d

Contents?: true

Size: 919 Bytes

Versions: 7

Compression:

Stored size: 919 Bytes

Contents

# frozen_string_literal: true

module Spree
  module Admin
    class BoltsController < Spree::Admin::BaseController
      before_action :bolt_configuration

      def show; end

      def edit; end

      def update
        if @bolt_configuration.update(bolt_configuration_params)
          flash[:success] = t('spree.admin.bolt.updated_successfully')
          redirect_to admin_bolt_path
        else
          flash[:error] = @bolt_configuration.errors.full_messages.to_sentence
          render :edit
        end
      end

      private

      def bolt_configuration
        @bolt_configuration = SolidusBolt::BoltConfiguration.fetch
      end

      def bolt_configuration_params
        params
          .require(:solidus_bolt_bolt_configuration)
          .permit(
            :environment,
            :api_key,
            :signing_secret,
            :publishable_key
          )
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
solidus_bolt-0.7.2 app/controllers/spree/admin/bolts_controller.rb
solidus_bolt-0.7.1 app/controllers/spree/admin/bolts_controller.rb
solidus_bolt-0.7.0 app/controllers/spree/admin/bolts_controller.rb
solidus_bolt-0.6.0 app/controllers/spree/admin/bolts_controller.rb
solidus_bolt-0.5.0 app/controllers/spree/admin/bolts_controller.rb
solidus_bolt-0.4.0 app/controllers/spree/admin/bolts_controller.rb
solidus_bolt-0.3.0 app/controllers/spree/admin/bolts_controller.rb