Sha256: 024c68887f82c8da37af54a1c2cbb994af9677d395f911b516522181fa35db50

Contents?: true

Size: 1.18 KB

Versions: 16

Compression:

Stored size: 1.18 KB

Contents

document.addEventListener("spree:load", function() {
  var countryBased = $('#country_based')
  var stateBased = $('#state_based')
  countryBased.click(show_country)
  stateBased.click(show_state)
  if (countryBased.is(':checked')) {
    show_country()
  } else if (stateBased.is(':checked')) {
    show_state()
  } else {
    show_state()
    stateBased.click()
  }
})
// eslint-disable-next-line camelcase
function show_country () {
  $('#state_members :input').each(function () {
    $(this).prop('disabled', true)
  })
  $('#state_members').hide()
  $('#zone_members :input').each(function () {
    $(this).prop('disabled', true)
  })
  $('#zone_members').hide()
  $('#country_members :input').each(function () {
    $(this).prop('disabled', false)
  })
  $('#country_members').show()
}
// eslint-disable-next-line camelcase
function show_state () {
  $('#country_members :input').each(function () {
    $(this).prop('disabled', true)
  })
  $('#country_members').hide()
  $('#zone_members :input').each(function () {
    $(this).prop('disabled', true)
  })
  $('#zone_members').hide()
  $('#state_members :input').each(function () {
    $(this).prop('disabled', false)
  })
  $('#state_members').show()
}

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
spree_backend-4.8.4 app/assets/javascripts/spree/backend/zone.js
spree_backend-4.8.3 app/assets/javascripts/spree/backend/zone.js
spree_backend-4.8.2 app/assets/javascripts/spree/backend/zone.js
spree_backend-4.8.1 app/assets/javascripts/spree/backend/zone.js
spree_backend-4.7.2 app/assets/javascripts/spree/backend/zone.js
spree_backend-4.6.2 app/assets/javascripts/spree/backend/zone.js
spree_backend-4.7.1 app/assets/javascripts/spree/backend/zone.js
spree_backend-4.7.0 app/assets/javascripts/spree/backend/zone.js
spree_backend-4.6.1 app/assets/javascripts/spree/backend/zone.js
spree_backend-4.6.0 app/assets/javascripts/spree/backend/zone.js
spree_backend-4.5.1 app/assets/javascripts/spree/backend/zone.js
spree_backend-4.5.0 app/assets/javascripts/spree/backend/zone.js
spree_backend-4.4.1 app/assets/javascripts/spree/backend/zone.js
spree_backend-4.4.0 app/assets/javascripts/spree/backend/zone.js
spree_backend-4.4.0.rc2 app/assets/javascripts/spree/backend/zone.js
spree_backend-4.4.0.rc1 app/assets/javascripts/spree/backend/zone.js