Sha256: 76840b8177a1aba71ee06233175b713fb4855f7b4fe28db303c47be7807ae36b
Contents?: true
Size: 1.02 KB
Versions: 59
Compression:
Stored size: 1.02 KB
Contents
// eslint-disable-next-line camelcase, no-unused-vars function update_state (region, done) { 'use strict' var country = $('span#' + region + 'country .select2').select2('val') var stateSelect = $('span#' + region + 'state select.select2') var stateInput = $('span#' + region + 'state input.state_name') $.get(Spree.routes.states_search + '?country_id=' + country, function (data) { var states = data.states if (states.length > 0) { stateSelect.html('') var statesWithBlank = [{ name: '', id: '' }].concat(states) $.each(statesWithBlank, function (pos, state) { var opt = $(document.createElement('option')) .prop('value', state.id) .html(state.name) stateSelect.append(opt) }) stateSelect.prop('disabled', false).show() stateSelect.select2() stateInput.hide().prop('disabled', true) } else { stateInput.prop('disabled', false).show() stateSelect.select2('destroy').hide() } if (done) done() }) };
Version data entries
59 entries across 59 versions & 2 rubygems