UI Cleanup - Updated Settings subtree.

This commit is contained in:
Taloth Saldono
2015-02-14 00:37:11 +01:00
parent b69ea349ce
commit 019525dd9d
72 changed files with 1458 additions and 1039 deletions

View File

@@ -9,14 +9,20 @@ module.exports = Marionette.CompositeView.extend({
template : 'Settings/DownloadClient/RemotePathMapping/RemotePathMappingCollectionViewTemplate',
itemViewContainer : '.x-rows',
itemView : RemotePathMappingItemView,
events : {"click .x-add" : '_addMapping'},
_addMapping : function(){
events : {
'click .x-add' : '_addMapping'
},
_addMapping : function() {
var model = new RemotePathMappingModel();
model.collection = this.collection;
var view = new EditView({
model : model,
targetCollection : this.collection
});
AppLayout.modalRegion.show(view);
}
});

View File

@@ -3,11 +3,15 @@ var Marionette = require('marionette');
module.exports = Marionette.ItemView.extend({
template : 'Settings/DownloadClient/RemotePathMapping/RemotePathMappingDeleteViewTemplate',
events : {"click .x-confirm-delete" : '_delete'},
_delete : function(){
events : {
'click .x-confirm-delete' : '_delete'
},
_delete : function() {
this.model.destroy({
wait : true,
success : function(){
success : function() {
vent.trigger(vent.Commands.CloseModalCommand);
}
});

View File

@@ -10,30 +10,36 @@ var AsEditModalView = require('../../../Mixins/AsEditModalView');
require('../../../Mixins/FileBrowser');
require('bootstrap');
module.exports = (function(){
var view = Marionette.ItemView.extend({
template : 'Settings/DownloadClient/RemotePathMapping/RemotePathMappingEditViewTemplate',
ui : {
path : '.x-path',
modalBody : '.modal-body'
},
_deleteView : DeleteView,
initialize : function(options){
this.targetCollection = options.targetCollection;
},
onShow : function(){
if(this.ui.path.length > 0) {
this.ui.modalBody.addClass('modal-overflow');
}
this.ui.path.fileBrowser();
},
_onAfterSave : function(){
this.targetCollection.add(this.model, {merge : true});
vent.trigger(vent.Commands.CloseModalCommand);
var view = Marionette.ItemView.extend({
template : 'Settings/DownloadClient/RemotePathMapping/RemotePathMappingEditViewTemplate',
ui : {
path : '.x-path',
modalBody : '.modal-body'
},
_deleteView : DeleteView,
initialize : function(options) {
this.targetCollection = options.targetCollection;
},
onShow : function() {
if (this.ui.path.length > 0) {
this.ui.modalBody.addClass('modal-overflow');
}
});
AsModelBoundView.call(view);
AsValidatedView.call(view);
AsEditModalView.call(view);
return view;
}).call(this);
this.ui.path.fileBrowser();
},
_onAfterSave : function() {
this.targetCollection.add(this.model, { merge : true });
vent.trigger(vent.Commands.CloseModalCommand);
}
});
AsModelBoundView.call(view);
AsValidatedView.call(view);
AsEditModalView.call(view);
module.exports = view;

View File

@@ -3,17 +3,23 @@ var Marionette = require('marionette');
var EditView = require('./RemotePathMappingEditView');
module.exports = Marionette.ItemView.extend({
template : 'Settings/DownloadClient/RemotePathMapping/RemotePathMappingItemViewTemplate',
className : 'row',
events : {"click .x-edit" : '_editMapping'},
initialize : function(){
template : 'Settings/DownloadClient/RemotePathMapping/RemotePathMappingItemViewTemplate',
className : 'row',
events : {
'click .x-edit' : '_editMapping'
},
initialize : function() {
this.listenTo(this.model, 'sync', this.render);
},
_editMapping : function(){
_editMapping : function() {
var view = new EditView({
model : this.model,
targetCollection : this.model.collection
});
AppLayout.modalRegion.show(view);
}
});