Sha256: d2a0f460183abb1d38bca8304ef1caebc12daca74cf270c5cb1c86c4b8d744ae

Contents?: true

Size: 878 Bytes

Versions: 7

Compression:

Stored size: 878 Bytes

Contents

module Spree
  module Admin
    module Actions
      class PaymentsDefaultActionsBuilder
        include Spree::Core::Engine.routes.url_helpers

        def build
          root = Root.new
          add_new_payment_action(root)
          root
        end

        private

        def add_new_payment_action(root)
          action =
            ActionBuilder.new('new_payment', ->(resource) { new_admin_order_payment_path(resource) }).
            with_icon_key('add.svg').
            with_style(::Spree::Admin::Actions::ActionStyle::PRIMARY).
            with_id('new_payment_section').
            with_availability_check(
              lambda do |ability, resource|
                ability.can?(:create, ::Spree::Payment) && resource.outstanding_balance?
              end
            ).
            build

          root.add(action)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
spree_backend-4.8.4 app/models/spree/admin/actions/payments_default_actions_builder.rb
spree_backend-4.8.3 app/models/spree/admin/actions/payments_default_actions_builder.rb
spree_backend-4.8.2 app/models/spree/admin/actions/payments_default_actions_builder.rb
spree_backend-4.8.1 app/models/spree/admin/actions/payments_default_actions_builder.rb
spree_backend-4.7.2 app/models/spree/admin/actions/payments_default_actions_builder.rb
spree_backend-4.7.1 app/models/spree/admin/actions/payments_default_actions_builder.rb
spree_backend-4.7.0 app/models/spree/admin/actions/payments_default_actions_builder.rb