Sha256: b1e1f0afd855bedef5faecce0a6510759c1f4d12b7ea1093104cafb885ac45b2

Contents?: true

Size: 1 KB

Versions: 99

Compression:

Stored size: 1 KB

Contents

var update_state = function (region, done) {
  'use strict';

  var country = $('span#' + region + 'country .select2').select2('val');
  var state_select = $('span#' + region + 'state select.select2');
  var state_input = $('span#' + region + 'state input.state_name');

  $.get(Spree.routes.states_search + '?country_id=' + country, function (data) {
    var states = data.states;
    if (states.length > 0) {
      state_select.html('');
      var states_with_blank = [{
        name: '',
        id: ''
      }].concat(states);
      $.each(states_with_blank, function (pos, state) {
        var opt = $(document.createElement('option'))
          .prop('value', state.id)
          .html(state.name);
        state_select.append(opt);
      });
      state_select.prop('disabled', false).show();
      state_select.select2();
      state_input.hide().prop('disabled', true);

    } else {
      state_input.prop('disabled', false).show();
      state_select.select2('destroy').hide();
    }

    if(done) done();
  });
};

Version data entries

99 entries across 99 versions & 1 rubygems

Version Path
spree_backend-3.4.6 app/assets/javascripts/spree/backend/address_states.js
spree_backend-3.2.9 app/assets/javascripts/spree/backend/address_states.js
spree_backend-3.1.14 app/assets/javascripts/spree/backend/address_states.js
spree_backend-3.6.6 app/assets/javascripts/spree/backend/address_states.js
spree_backend-3.6.5 app/assets/javascripts/spree/backend/address_states.js
spree_backend-3.6.4 app/assets/javascripts/spree/backend/address_states.js
spree_backend-3.6.3 app/assets/javascripts/spree/backend/address_states.js
spree_backend-3.6.2 app/assets/javascripts/spree/backend/address_states.js
spree_backend-3.6.1 app/assets/javascripts/spree/backend/address_states.js
spree_backend-3.6.0 app/assets/javascripts/spree/backend/address_states.js
spree_backend-3.5.0 app/assets/javascripts/spree/backend/address_states.js
spree_backend-3.3.6 app/assets/javascripts/spree/backend/address_states.js
spree_backend-3.2.8 app/assets/javascripts/spree/backend/address_states.js
spree_backend-3.1.13 app/assets/javascripts/spree/backend/address_states.js
spree_backend-3.6.0.rc1 app/assets/javascripts/spree/backend/address_states.js
spree_backend-3.5.0.rc2 app/assets/javascripts/spree/backend/address_states.js
spree_backend-3.5.0.rc1 app/assets/javascripts/spree/backend/address_states.js
spree_backend-3.4.5 app/assets/javascripts/spree/backend/address_states.js
spree_backend-3.3.5 app/assets/javascripts/spree/backend/address_states.js
spree_backend-3.4.4 app/assets/javascripts/spree/backend/address_states.js