Skip to content

Commit

Permalink
Medialist use 'self' instead of '_this'
Browse files Browse the repository at this point in the history
  • Loading branch information
pardo-bsso committed Apr 5, 2013
1 parent 5d96ae7 commit dad67d0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions public/js/views/medialist.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,24 +57,24 @@ window.MediaListView2 = function(options){
var MediaListViewModel = kb.ViewModel.extend({
constructor: function(model) {
kb.ViewModel.prototype.constructor.apply(this, arguments);
var _this = this;
var self = this;
this.editingName = ko.observable(false);
this.nameClick = function () {
this.editingName(true);
}

this.changeFocus = function () {
if(_this.name().length<=0)
if(self.name().length<=0)
return false;
_this.editingName(false);
self.editingName(false);
}

this.filter = ko.observable('');
this.collection = kb.collectionObservable( model.get('collection'), {
view_model: kb.ViewModel,
filters: function(model) {
var filter;
filter = _this.filter();
filter = self.filter();
if (!filter) return false;
var re = new RegExp(filter,"i");
return ( model.get('file').search(re) < 0 &&
Expand All @@ -85,7 +85,7 @@ window.MediaListView2 = function(options){

this.total_time = ko.computed(function(){
//XXX: keep this, it tells KO to update total_time when something happens to the collection
var x = _this.collection();
var x = self.collection();
return model.pretty_duration();
}, model);

Expand Down

0 comments on commit dad67d0

Please sign in to comment.