Sha256: dc730b09ac621328dbedab21688c0ef542d2b53a6ee045fd75a681b81a8fca79

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

I"€(function() {
  (function($) {
    $.fn.china_city = function() {
      return this.each(function() {
        var selects;
        selects = $(this).find('.city-select');
        return selects.change(function() {
          var $this, next_selects;
          $this = $(this);
          next_selects = selects.slice(selects.index(this) + 1);
          $("option:gt(0)", next_selects).remove();
          if (next_selects.first()[0] && $this.val() && !$this.val().match(/--.*--/)) {
            return $.get("/china_city/" + ($(this).val()), function(data) {
              var i, len, option;
              if (data.data != null) {
                data = data.data;
              }
              for (i = 0, len = data.length; i < len; i++) {
                option = data[i];
                next_selects.first()[0].options.add(new Option(option[0], option[1]));
              }
              return next_selects.trigger('china_city:load_data_completed');
            });
          }
        });
      });
    };
    return $(document).on('ready page:load', function() {
      return $('.city-group').china_city();
    });
  })(jQuery);

}).call(this);
:ET

Version data entries

2 entries across 1 versions & 1 rubygems

Version Path
china_city-0.0.5 spec/dummy/tmp/cache/assets/development/sprockets/v3.0/yfSD1_a3OmAIvwrd8FClKiLUtkaSRa8PgFFlq5GIlTc.cache
china_city-0.0.5 spec/dummy/tmp/cache/assets/test/sprockets/v3.0/yfSD1_a3OmAIvwrd8FClKiLUtkaSRa8PgFFlq5GIlTc.cache