From f532115b331f5ef894561b83656f4aa6e778c722 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Luis=20Di=20Biase?= Date: Tue, 21 May 2013 00:27:54 -0300 Subject: [PATCH] From custom code to underscore supported on Backbone 1.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Luis Di Biase --- public/js/views/conf.js | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/public/js/views/conf.js b/public/js/views/conf.js index fcefd36..af42043 100644 --- a/public/js/views/conf.js +++ b/public/js/views/conf.js @@ -2,8 +2,8 @@ window.ConfView = Backbone.View.extend({ el: $("#content"), initialize: function () { this.render(); - this.configModel = this.filter('type', 'config'); - this.defaultModel = this.filter('type','defaults'); + this.configModel = this.collection.findWhere({ type: 'config' }); + this.defaultModel = this.collection.findWhere({ type: 'defaults' }); }, render: function () { $(this.el).html(template.confview({ config: this.collection.toJSON() })); @@ -60,12 +60,5 @@ window.ConfView = Backbone.View.extend({ $('input#'+selector, this.el).val(default_model[res[0]][res[1]][res[2]]); } return false; - }, - - /* XXX FIXME Newer Backbone versions (>1.0) bind underscore to use it against collections*/ - filter: function(prop, value) { return this.collection.find( function(item) { - if (item.get(prop) == value) - return true; - }) - }, + } });