jquery-atwho-rails 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -334,6 +334,10 @@
334
334
  watching :function() {
335
335
  return $(this.id).is(":visible");
336
336
  },
337
+ freshItems : function() {
338
+ this.items = $(this.id).find('#'+this.id.slice(1)+'-ul li');
339
+ this.cur_li_idx = 0;
340
+ },
337
341
  evalTpl: function(tpl,map) {
338
342
  if(_isNil(tpl)) return;
339
343
  el = tpl.replace(/\$\{([^\}]*)\}/g,function(tag,key,pos){
@@ -360,6 +364,7 @@
360
364
  show: function(){
361
365
  if (!this.watching())
362
366
  $view = $(this.id).show();
367
+ this.freshItems();
363
368
  this.rePosition($view);
364
369
  },
365
370
  hide: function() {
@@ -379,19 +384,18 @@
379
384
  clear: function(clear_all) {
380
385
  if (clear_all == true)
381
386
  this._cache = {};
382
- this.items = [];
383
387
  $(this.id).find('ul').empty();
384
388
  },
385
389
  update: function(list,cacheable) {
386
390
  if (!$.isArray(list)) return false;
387
391
  if (cacheable != false) At.cache(At.keyword.text,list);
388
392
 
389
- $ul = $(this.id).find('ul');
390
393
  this.clear();
391
- $.merge(this.items,list);
392
394
  var tpl = At.getOpt('tpl');
393
- var self = this;
394
395
  var list = _unique(list,At.searchWord());
396
+
397
+ var self = this;
398
+ $ul = $(this.id).find('ul');
395
399
  $.each(list.splice(0, At.getOpt('limit')), function(i,item) {
396
400
  if (!$.isPlainObject(item)) {
397
401
  item = {'id':i,'name':item};
@@ -1,7 +1,7 @@
1
1
  module Jquery
2
2
  module Atwho
3
3
  module Rails
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jquery-atwho-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: