Merge pull request #5493 from luisramos0/display_on_4_managers

Make display_on attribute available for managers to change in shipping and payment methods
This commit is contained in:
Luis Ramos
2020-05-26 09:57:56 +01:00
committed by GitHub
4 changed files with 14 additions and 13 deletions

View File

@@ -17,11 +17,11 @@
= label_tag nil, t(:environment)
.omega.eight.columns
= collection_select(:payment_method, :environment, Rails.configuration.database_configuration.keys.sort, :to_s, :titleize, {}, {id: 'gtwy-env', class: 'select2 fullwidth'})
.row
.alpha.three.columns
= label_tag nil, t(:display)
.omega.eight.columns
= select(:payment_method, :display_on, Spree::PaymentMethod::DISPLAY.collect { |display| [t(display), display == :both ? nil : display.to_s] }, {}, {class: 'select2 fullwidth'})
.row
.alpha.three.columns
= label_tag nil, t(:display)
.omega.eight.columns
= select(:payment_method, :display_on, Spree::PaymentMethod::DISPLAY.collect { |display| [t(display), display == :both ? nil : display.to_s] }, {}, {class: 'select2 fullwidth'})
.row
.alpha.three.columns
= label_tag nil, t(:active)

View File

@@ -15,13 +15,12 @@
.omega.eight.columns
= f.text_area :description, class: 'fullwidth', rows: 2, placeholder: t(:spree_admin_eg_collect_your_order)
= error_message_on :shipping_method, :description
- if spree_current_user.admin?
.row
.alpha.three.columns
= f.label :display_on, t(:display)
.omega.eight.columns
= select(:shipping_method, :display_on, [[t(".both"), nil], [t(".back_end"), "back_end"]], {}, {class: 'select2 fullwidth'})
= error_message_on :shipping_method, :display_on
.row
.alpha.three.columns
= f.label :display_on, t(:display)
.omega.eight.columns
= select(:shipping_method, :display_on, [[t(".both"), nil], [t(".back_end"), "back_end"]], {}, {class: 'select2 fullwidth'})
= error_message_on :shipping_method, :display_on
.row
.alpha.three.columns

View File

@@ -158,6 +158,8 @@ feature '
it "creates payment methods" do
visit spree.new_admin_payment_method_path
fill_in 'payment_method_name', with: 'Cheque payment method'
expect(page).to have_field 'payment_method_description'
expect(page).to have_select 'payment_method_display_on'
check "payment_method_distributor_ids_#{distributor1.id}"
find(:css, "tags-input .tags input").set "local\n"

View File

@@ -108,7 +108,7 @@ feature 'shipping methods' do
# Show the correct fields
expect(page).to have_field 'shipping_method_name'
expect(page).to have_field 'shipping_method_description'
expect(page).not_to have_select 'shipping_method_display_on'
expect(page).to have_select 'shipping_method_display_on'
expect(page).to have_css 'div#shipping_method_zones_field'
expect(page).to have_field 'shipping_method_require_ship_address_true', checked: true