Skip to content

Commit 0245f7a

Browse files
committed
update to v1.0.1
1 parent d8ba992 commit 0245f7a

File tree

3 files changed

+383
-340
lines changed

3 files changed

+383
-340
lines changed

lib/assets/javascripts/jquery.atwho/jquery.atwho.js

+23-19
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! jquery.atwho - v1.0.0 %>
1+
/*! jquery.atwho - v1.0.1 %>
22
* Copyright (c) 2015 chord.luo <chord.luo@gmail.com>;
33
* homepage: http://ichord.github.com/At.js
44
* Licensed MIT
@@ -327,14 +327,33 @@ Controller = (function() {
327327
return this.view.render(data.slice(0, this.getOpt('limit')));
328328
};
329329

330+
Controller.arrayToDefaultHash = function(data) {
331+
var item, _i, _len, _results;
332+
if (!$.isArray(data)) {
333+
return data;
334+
}
335+
_results = [];
336+
for (_i = 0, _len = data.length; _i < _len; _i++) {
337+
item = data[_i];
338+
if ($.isPlainObject(item)) {
339+
_results.push(item);
340+
} else {
341+
_results.push({
342+
name: item
343+
});
344+
}
345+
}
346+
return _results;
347+
};
348+
330349
Controller.prototype.lookUp = function(e) {
331350
var query, _callback;
332351
if (!(query = this.catchQuery(e))) {
333352
return;
334353
}
335354
_callback = function(data) {
336355
if (data && data.length > 0) {
337-
return this.renderView(data);
356+
return this.renderView(this.constructor.arrayToDefaultHash(data));
338357
} else {
339358
return this.view.hide();
340359
}
@@ -833,22 +852,7 @@ KEY_CODE = {
833852

834853
DEFAULT_CALLBACKS = {
835854
beforeSave: function(data) {
836-
var item, _i, _len, _results;
837-
if (!$.isArray(data)) {
838-
return data;
839-
}
840-
_results = [];
841-
for (_i = 0, _len = data.length; _i < _len; _i++) {
842-
item = data[_i];
843-
if ($.isPlainObject(item)) {
844-
_results.push(item);
845-
} else {
846-
_results.push({
847-
name: item
848-
});
849-
}
850-
}
851-
return _results;
855+
return Controller.arrayToDefaultHash(data);
852856
},
853857
matcher: function(flag, subtext, should_startWithSpace) {
854858
var match, regexp, _a, _y;
@@ -934,7 +938,7 @@ Api = {
934938
},
935939
isSelecting: function() {
936940
var _ref;
937-
return (_ref = this.controller()) != null ? _ref.view.visiable() : void 0;
941+
return (_ref = this.controller()) != null ? _ref.view.visible() : void 0;
938942
},
939943
setIframe: function(iframe, asRoot) {
940944
this.setupRootElement(iframe, asRoot);

0 commit comments

Comments
 (0)