Sha256: 28594349d1bc2bbda641a4fe5ea69579460c038fb15a315851f05ae7bdb7a402

Contents?: true

Size: 797 Bytes

Versions: 1

Compression:

Stored size: 797 Bytes

Contents

Rails.application.config.after_initialize do
  Rails.application.config.spree_backend.actions[:user].add(
    Spree::Admin::Actions::ActionBuilder.new('seven.sms', -> (resource) {
      include Spree::Core::Engine.routes.url_helpers

      user = Spree::User.find_by(id: resource.id)
      ship_address = user.ship_address
      bill_address = user.bill_address
      ship_phone = ship_address && ship_address['phone'] ? ship_address['phone'] : ''
      bill_phone = bill_address && bill_address['phone'] ? bill_address['phone'] : ''
      to = ship_phone ? ship_phone : bill_phone

      return admin_seven_sms_url(to: to, only_path: true)
    }).
      with_icon_key('envelope.svg').
      with_style(Spree::Admin::Actions::ActionStyle::SECONDARY).
      with_method(:post).
      build
  )
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spree_seven-0.0.1 config/initializers/users.rb