Added mono space font, cleaner UI for rename preview

This commit is contained in:
Mark McDowall 2013-11-27 01:19:44 -08:00
parent e42ac25657
commit f349f1177e
15 changed files with 165 additions and 33 deletions

View file

@ -19,11 +19,14 @@ define(
},
ui: {
pathInfo: '.x-path-info'
pathInfo : '.x-path-info',
renameAll : '.x-rename-all',
checkboxIcon: '.x-rename-all-button i'
},
events: {
'click .x-organize': '_organizeFiles'
'click .x-organize' : '_organizeFiles',
'change .x-rename-all': '_toggleAll'
},
initialize: function (options) {
@ -36,6 +39,7 @@ define(
this.collection = new RenamePreviewCollection(viewOptions);
this.listenTo(this.collection, 'sync', this._showPreviews);
this.listenTo(this.collection, 'rename:select', this._itemRenameChanged);
this.collection.fetch();
},
@ -51,6 +55,7 @@ define(
return;
}
this.ui.pathInfo.show();
this.collection.invoke('set', { rename: true });
this.renamePreviews.show(new RenamePreviewCollectionView({ collection: this.collection }));
},
@ -88,6 +93,37 @@ define(
}
vent.trigger(vent.Commands.CloseModalCommand);
},
_setCheckedState: function (checked) {
if (checked) {
this.ui.checkboxIcon.addClass('icon-check');
this.ui.checkboxIcon.removeClass('icon-check-empty');
}
else {
this.ui.checkboxIcon.addClass('icon-check-empty');
this.ui.checkboxIcon.removeClass('icon-check');
}
},
_toggleAll: function () {
var checked = this.ui.renameAll.prop('checked');
this._setCheckedState(checked);
this.collection.each(function (model) {
model.trigger('rename:select', model, checked);
});
},
_itemRenameChanged: function (model, checked) {
var allChecked = this.collection.all(function (m) {
return m.get('rename');
});
if (!checked || allChecked) {
this._setCheckedState(checked);
}
}
});
});