Sha256: 3332b32654efa3f9af59c68deb6390cc8c4bb8415915a1ae3b29076e0dc2226d

Contents?: true

Size: 1.31 KB

Versions: 1

Compression:

Stored size: 1.31 KB

Contents

I"2(function() {
  (function($) {
    $.fn.china_city = function() {
      return this.each(function() {
        var selects;
        selects = $(this).find('.city-select');
        return selects.change(function() {
          var $this, customfunc, next_selects;
          $this = $(this);
          next_selects = selects.slice(selects.index(this) + 1);
          customfunc = $this.data("customfunc") ? $this.data("customfunc") : false;
          $("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]));
              }
              if (customfunc) {
                eval(customfunc);
              }
              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

1 entries across 1 versions & 1 rubygems

Version Path
china_city_custom-0.0.7 spec/dummy/tmp/cache/assets/sprockets/v3.0/U5/U5toC7YdNOr8xK6mGj50xNHEBuJx0BfRkIM-KZKBUU0.cache