mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-25 22:36:59 -04:00
UI dependency graph cleanup
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
'use strict';
|
||||
define(['app',
|
||||
'marionette',
|
||||
'Settings/Indexers/ItemView',
|
||||
'Settings/Indexers/EditView',
|
||||
'Settings/Indexers/Collection'],
|
||||
function (App, Marionette, IndexerItemView, IndexerEditView, IndexerCollection) {
|
||||
define(
|
||||
[
|
||||
'AppLayout',
|
||||
'marionette',
|
||||
'Settings/Indexers/ItemView',
|
||||
'Settings/Indexers/EditView',
|
||||
'Settings/Indexers/Collection',
|
||||
'underscore'
|
||||
], function (AppLayout, Marionette, IndexerItemView, IndexerEditView, IndexerCollection, _) {
|
||||
return Marionette.CompositeView.extend({
|
||||
itemView : IndexerItemView,
|
||||
itemViewContainer: '#x-indexers',
|
||||
@@ -18,7 +21,7 @@ define(['app',
|
||||
'click .x-add-card': '_openSchemaModal'
|
||||
},
|
||||
|
||||
appendHtml: function(collectionView, itemView, index){
|
||||
appendHtml: function (collectionView, itemView, index) {
|
||||
collectionView.ui.addCard.parent('li').before(itemView.el);
|
||||
},
|
||||
|
||||
@@ -33,13 +36,13 @@ define(['app',
|
||||
var model = _.first(collection.models);
|
||||
|
||||
model.set({
|
||||
id: undefined,
|
||||
name: '',
|
||||
id : undefined,
|
||||
name : '',
|
||||
enable: true
|
||||
});
|
||||
|
||||
var view = new IndexerEditView({ model: model, indexerCollection: self.collection});
|
||||
App.modalRegion.show(view);
|
||||
AppLayout.modalRegion.show(view);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
'use strict';
|
||||
define(['app', 'marionette'], function (App, Marionette) {
|
||||
return Marionette.ItemView.extend({
|
||||
template: 'Settings/Notifications/DeleteTemplate',
|
||||
|
||||
events: {
|
||||
'click .x-confirm-delete': '_removeIndexer'
|
||||
},
|
||||
|
||||
_removeIndexer: function () {
|
||||
this.model.destroy({
|
||||
wait : true,
|
||||
success: function () {
|
||||
App.vent.trigger(App.Commands.CloseModalCommand);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -2,16 +2,17 @@
|
||||
|
||||
define(
|
||||
[
|
||||
'app',
|
||||
'vent',
|
||||
'marionette',
|
||||
'Mixins/AsModelBoundView',
|
||||
'Mixins/AsValidatedView'
|
||||
], function (App, Marionette, AsModelBoundView, AsValidatedView) {
|
||||
'Mixins/AsValidatedView',
|
||||
'underscore'
|
||||
], function (vent, Marionette, AsModelBoundView, AsValidatedView, _) {
|
||||
|
||||
var view = Marionette.ItemView.extend({
|
||||
template: 'Settings/Indexers/EditTemplate',
|
||||
|
||||
ui : {
|
||||
ui: {
|
||||
activity: '.x-activity'
|
||||
},
|
||||
|
||||
@@ -33,7 +34,7 @@ define(
|
||||
if (promise) {
|
||||
promise.done(function () {
|
||||
self.indexerCollection.add(self.model, { merge: true });
|
||||
App.vent.trigger(App.Commands.CloseModalCommand);
|
||||
vent.trigger(vent.Commands.CloseModalCommand);
|
||||
});
|
||||
|
||||
promise.fail(function () {
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
define(
|
||||
[
|
||||
'app',
|
||||
'AppLayout',
|
||||
'marionette',
|
||||
'Settings/Notifications/DeleteView',
|
||||
'Mixins/AsModelBoundView',
|
||||
'Mixins/AsValidatedView'
|
||||
], function (App, Marionette, DeleteView, AsModelBoundView, AsValidatedView) {
|
||||
], function (AppLayout, Marionette, DeleteView, AsModelBoundView, AsValidatedView) {
|
||||
|
||||
var view = Marionette.ItemView.extend({
|
||||
template: 'Settings/Indexers/ItemTemplate',
|
||||
@@ -19,7 +19,7 @@ define(
|
||||
|
||||
_deleteIndexer: function () {
|
||||
var view = new DeleteView({ model: this.model});
|
||||
App.modalRegion.show(view);
|
||||
AppLayout.modalRegion.show(view);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user