app/assets/javascripts/spine/list.js in spine-rails-0.0.2 vs app/assets/javascripts/spine/list.js in spine-rails-0.0.3
- old
+ new
@@ -7,52 +7,52 @@
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
if (typeof Spine === "undefined" || Spine === null) {
- Spine = require("spine");
+ Spine = require('spine');
}
$ = Spine.$;
Spine.List = (function() {
__extends(List, Spine.Controller);
List.prototype.events = {
- "click .item": "click"
+ 'click .item': 'click'
};
List.prototype.selectFirst = false;
function List() {
this.change = __bind(this.change, this); List.__super__.constructor.apply(this, arguments);
- this.bind("change", this.change);
+ this.bind('change', this.change);
}
List.prototype.template = function() {
return arguments[0];
};
List.prototype.change = function(item) {
if (!item) {
return;
}
this.current = item;
- this.children().removeClass("active");
- return this.children().forItem(this.current).addClass("active");
+ this.children().removeClass('active');
+ return this.children().forItem(this.current).addClass('active');
};
List.prototype.render = function(items) {
if (items) {
this.items = items;
}
this.html(this.template(this.items));
this.change(this.current);
if (this.selectFirst) {
- if (!this.children(".active").length) {
- return this.children(":first").click();
+ if (!this.children('.active').length) {
+ return this.children(':first').click();
}
}
};
List.prototype.children = function(sel) {
return this.el.children(sel);
};
List.prototype.click = function(e) {
var item;
item = $(e.target).item();
- return this.trigger("change", item);
+ return this.trigger('change', item);
};
return List;
})();
if (typeof module !== "undefined" && module !== null) {
module.exports = Spine.List;