Sha256: c63ace247ca9208e2400ac7ff204abccf8622da3e6effe7f8ef4c90d499f8a9b
Contents?: true
Size: 1.93 KB
Versions: 19
Compression:
Stored size: 1.93 KB
Contents
(function() { var base, bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; (base = Backbone.Poised).List || (base.List = {}); Backbone.Poised.List.Searchfield = (function(superClass) { extend(Searchfield, superClass); function Searchfield() { this.render = bind(this.render, this); this.filterList = bind(this.filterList, this); return Searchfield.__super__.constructor.apply(this, arguments); } Searchfield.prototype.tagName = 'li'; Searchfield.prototype.className = 'search-box'; Searchfield.prototype.template = _.template("<input type='search' placeholder='<%= placeholder %>'>"); Searchfield.prototype.initialize = function(options) { if (options == null) { options = {}; } Searchfield.__super__.initialize.apply(this, arguments); return this.options = _.chain(options).pick('placeholder').value(); }; Searchfield.prototype.events = { 'input input': 'filterList' }; Searchfield.prototype.filterList = function(e) { clearTimeout(this.filterInputTimeout); return this.filterInputTimeout = delay(250, (function(_this) { return function() { return _this.trigger('filter', $(e.target).val() || '', {}); }; })(this)); }; Searchfield.prototype.render = function() { var placeholder; placeholder = this.options.placeholder || this.loadLocale('search.placeholder'); this.$el.html(this.template({ placeholder: placeholder })); return this; }; return Searchfield; })(Backbone.Poised.View); }).call(this);
Version data entries
19 entries across 19 versions & 1 rubygems