mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-23 22:25:14 -04:00
rjs -> webpack
This commit is contained in:
@@ -1,14 +1,9 @@
|
||||
'use strict';
|
||||
var ThingyAddCollectionView = require('../../ThingyAddCollectionView');
|
||||
var ThingyHeaderGroupView = require('../../ThingyHeaderGroupView');
|
||||
var AddItemView = require('./IndexerAddItemView');
|
||||
|
||||
define([
|
||||
'Settings/ThingyAddCollectionView',
|
||||
'Settings/ThingyHeaderGroupView',
|
||||
'Settings/Indexers/Add/IndexerAddItemView'
|
||||
], function (ThingyAddCollectionView, ThingyHeaderGroupView, AddItemView) {
|
||||
|
||||
return ThingyAddCollectionView.extend({
|
||||
itemView : ThingyHeaderGroupView.extend({ itemView: AddItemView }),
|
||||
itemViewContainer: '.add-indexer .items',
|
||||
template : 'Settings/Indexers/Add/IndexerAddCollectionViewTemplate'
|
||||
});
|
||||
});
|
||||
module.exports = ThingyAddCollectionView.extend({
|
||||
itemView : ThingyHeaderGroupView.extend({itemView : AddItemView}),
|
||||
itemViewContainer : '.add-indexer .items',
|
||||
template : 'Settings/Indexers/Add/IndexerAddCollectionViewTemplate'
|
||||
});
|
||||
@@ -1,54 +1,42 @@
|
||||
'use strict';
|
||||
var _ = require('underscore');
|
||||
var $ = require('jquery');
|
||||
var AppLayout = require('../../../AppLayout');
|
||||
var Marionette = require('marionette');
|
||||
var EditView = require('../Edit/IndexerEditView');
|
||||
|
||||
define([
|
||||
'underscore',
|
||||
'jquery',
|
||||
'AppLayout',
|
||||
'marionette',
|
||||
'Settings/Indexers/Edit/IndexerEditView'
|
||||
], function (_, $, AppLayout, Marionette, EditView) {
|
||||
|
||||
return Marionette.ItemView.extend({
|
||||
template : 'Settings/Indexers/Add/IndexerAddItemViewTemplate',
|
||||
tagName : 'li',
|
||||
className : 'add-thingy-item',
|
||||
|
||||
events: {
|
||||
'click .x-preset': '_addPreset',
|
||||
'click' : '_add'
|
||||
},
|
||||
|
||||
initialize: function (options) {
|
||||
this.targetCollection = options.targetCollection;
|
||||
},
|
||||
|
||||
_addPreset: function (e) {
|
||||
|
||||
var presetName = $(e.target).closest('.x-preset').attr('data-id');
|
||||
var presetData = _.where(this.model.get('presets'), {name: presetName})[0];
|
||||
|
||||
this.model.set(presetData);
|
||||
|
||||
this._openEdit();
|
||||
},
|
||||
|
||||
_add: function (e) {
|
||||
if ($(e.target).closest('.btn,.btn-group').length !== 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._openEdit();
|
||||
},
|
||||
|
||||
_openEdit: function () {
|
||||
this.model.set({
|
||||
id : undefined,
|
||||
enableRss : this.model.get('supportsRss'),
|
||||
enableSearch : this.model.get('supportsSearch')
|
||||
});
|
||||
|
||||
var editView = new EditView({ model: this.model, targetCollection: this.targetCollection });
|
||||
AppLayout.modalRegion.show(editView);
|
||||
module.exports = Marionette.ItemView.extend({
|
||||
template : 'Settings/Indexers/Add/IndexerAddItemViewTemplate',
|
||||
tagName : 'li',
|
||||
className : 'add-thingy-item',
|
||||
events : {
|
||||
"click .x-preset" : '_addPreset',
|
||||
"click" : '_add'
|
||||
},
|
||||
initialize : function(options){
|
||||
this.targetCollection = options.targetCollection;
|
||||
},
|
||||
_addPreset : function(e){
|
||||
var presetName = $(e.target).closest('.x-preset').attr('data-id');
|
||||
var presetData = _.where(this.model.get('presets'), {name : presetName})[0];
|
||||
this.model.set(presetData);
|
||||
this._openEdit();
|
||||
},
|
||||
_add : function(e){
|
||||
if($(e.target).closest('.btn,.btn-group').length !== 0) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
});
|
||||
this._openEdit();
|
||||
},
|
||||
_openEdit : function(){
|
||||
this.model.set({
|
||||
id : undefined,
|
||||
enableRss : this.model.get('supportsRss'),
|
||||
enableSearch : this.model.get('supportsSearch')
|
||||
});
|
||||
var editView = new EditView({
|
||||
model : this.model,
|
||||
targetCollection : this.targetCollection
|
||||
});
|
||||
AppLayout.modalRegion.show(editView);
|
||||
}
|
||||
});
|
||||
@@ -1,36 +1,33 @@
|
||||
'use strict';
|
||||
var _ = require('underscore');
|
||||
var AppLayout = require('../../../AppLayout');
|
||||
var Backbone = require('backbone');
|
||||
var SchemaCollection = require('../IndexerCollection');
|
||||
var AddCollectionView = require('./IndexerAddCollectionView');
|
||||
|
||||
define([
|
||||
'underscore',
|
||||
'AppLayout',
|
||||
'backbone',
|
||||
'Settings/Indexers/IndexerCollection',
|
||||
'Settings/Indexers/Add/IndexerAddCollectionView'
|
||||
], function (_, AppLayout, Backbone, SchemaCollection, AddCollectionView) {
|
||||
return ({
|
||||
|
||||
open: function (collection) {
|
||||
var schemaCollection = new SchemaCollection();
|
||||
var originalUrl = schemaCollection.url;
|
||||
schemaCollection.url = schemaCollection.url + '/schema';
|
||||
schemaCollection.fetch();
|
||||
schemaCollection.url = originalUrl;
|
||||
|
||||
var groupedSchemaCollection = new Backbone.Collection();
|
||||
|
||||
schemaCollection.on('sync', function() {
|
||||
|
||||
var groups = schemaCollection.groupBy(function(model, iterator) { return model.get('protocol'); });
|
||||
|
||||
var modelCollection = _.map(groups, function(values, key, list) {
|
||||
return { 'header': key, collection: values };
|
||||
});
|
||||
|
||||
groupedSchemaCollection.reset(modelCollection);
|
||||
module.exports = {
|
||||
open : function(collection){
|
||||
var schemaCollection = new SchemaCollection();
|
||||
var originalUrl = schemaCollection.url;
|
||||
schemaCollection.url = schemaCollection.url + '/schema';
|
||||
schemaCollection.fetch();
|
||||
schemaCollection.url = originalUrl;
|
||||
var groupedSchemaCollection = new Backbone.Collection();
|
||||
schemaCollection.on('sync', function(){
|
||||
var groups = schemaCollection.groupBy(function(model, iterator){
|
||||
return model.get('protocol');
|
||||
});
|
||||
|
||||
var view = new AddCollectionView({ collection: groupedSchemaCollection, targetCollection: collection });
|
||||
AppLayout.modalRegion.show(view);
|
||||
}
|
||||
});
|
||||
});
|
||||
var modelCollection = _.map(groups, function(values, key, list){
|
||||
return {
|
||||
"header" : key,
|
||||
collection : values
|
||||
};
|
||||
});
|
||||
groupedSchemaCollection.reset(modelCollection);
|
||||
});
|
||||
var view = new AddCollectionView({
|
||||
collection : groupedSchemaCollection,
|
||||
targetCollection : collection
|
||||
});
|
||||
AppLayout.modalRegion.show(view);
|
||||
}
|
||||
};
|
||||
@@ -1,23 +1,15 @@
|
||||
'use strict';
|
||||
var vent = require('../../../vent');
|
||||
var Marionette = require('marionette');
|
||||
|
||||
define([
|
||||
'vent',
|
||||
'marionette'
|
||||
], function (vent, Marionette) {
|
||||
return Marionette.ItemView.extend({
|
||||
template: 'Settings/Indexers/Delete/IndexerDeleteViewTemplate',
|
||||
|
||||
events: {
|
||||
'click .x-confirm-delete': '_delete'
|
||||
},
|
||||
|
||||
_delete: function () {
|
||||
this.model.destroy({
|
||||
wait : true,
|
||||
success: function () {
|
||||
vent.trigger(vent.Commands.CloseModalCommand);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
module.exports = Marionette.ItemView.extend({
|
||||
template : 'Settings/Indexers/Delete/IndexerDeleteViewTemplate',
|
||||
events : {"click .x-confirm-delete" : '_delete'},
|
||||
_delete : function(){
|
||||
this.model.destroy({
|
||||
wait : true,
|
||||
success : function(){
|
||||
vent.trigger(vent.Commands.CloseModalCommand);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -1,55 +1,41 @@
|
||||
'use strict';
|
||||
|
||||
define([
|
||||
'vent',
|
||||
'AppLayout',
|
||||
'marionette',
|
||||
'Settings/Indexers/Delete/IndexerDeleteView',
|
||||
'Commands/CommandController',
|
||||
'Mixins/AsModelBoundView',
|
||||
'Mixins/AsValidatedView',
|
||||
'Mixins/AsEditModalView',
|
||||
'Form/FormBuilder',
|
||||
'Mixins/AutoComplete',
|
||||
'bootstrap'
|
||||
], function (vent, AppLayout, Marionette, DeleteView, CommandController, AsModelBoundView, AsValidatedView, AsEditModalView) {
|
||||
var vent = require('../../../vent');
|
||||
var AppLayout = require('../../../AppLayout');
|
||||
var Marionette = require('marionette');
|
||||
var DeleteView = require('../Delete/IndexerDeleteView');
|
||||
var CommandController = require('../../../Commands/CommandController');
|
||||
var AsModelBoundView = require('../../../Mixins/AsModelBoundView');
|
||||
var AsValidatedView = require('../../../Mixins/AsValidatedView');
|
||||
var AsEditModalView = require('../../../Mixins/AsEditModalView');
|
||||
require('../../../Form/FormBuilder');
|
||||
require('../../../Mixins/AutoComplete');
|
||||
require('bootstrap');
|
||||
require('../Add/IndexerSchemaModal');
|
||||
|
||||
module.exports = (function(){
|
||||
var view = Marionette.ItemView.extend({
|
||||
template: 'Settings/Indexers/Edit/IndexerEditViewTemplate',
|
||||
|
||||
events: {
|
||||
'click .x-back' : '_back'
|
||||
},
|
||||
|
||||
_deleteView: DeleteView,
|
||||
|
||||
initialize: function (options) {
|
||||
template : 'Settings/Indexers/Edit/IndexerEditViewTemplate',
|
||||
events : {"click .x-back" : '_back'},
|
||||
_deleteView : DeleteView,
|
||||
initialize : function(options){
|
||||
this.targetCollection = options.targetCollection;
|
||||
},
|
||||
|
||||
_onAfterSave: function () {
|
||||
this.targetCollection.add(this.model, { merge: true });
|
||||
_onAfterSave : function(){
|
||||
this.targetCollection.add(this.model, {merge : true});
|
||||
vent.trigger(vent.Commands.CloseModalCommand);
|
||||
},
|
||||
|
||||
_onAfterSaveAndAdd: function () {
|
||||
this.targetCollection.add(this.model, { merge: true });
|
||||
|
||||
require('Settings/Indexers/Add/IndexerSchemaModal').open(this.targetCollection);
|
||||
_onAfterSaveAndAdd : function(){
|
||||
this.targetCollection.add(this.model, {merge : true});
|
||||
require('../Add/IndexerSchemaModal').open(this.targetCollection);
|
||||
},
|
||||
|
||||
_back: function () {
|
||||
if (this.model.isNew()) {
|
||||
_back : function(){
|
||||
if(this.model.isNew()) {
|
||||
this.model.destroy();
|
||||
}
|
||||
|
||||
require('Settings/Indexers/Add/IndexerSchemaModal').open(this.targetCollection);
|
||||
require('../Add/IndexerSchemaModal').open(this.targetCollection);
|
||||
}
|
||||
});
|
||||
|
||||
AsModelBoundView.call(view);
|
||||
AsValidatedView.call(view);
|
||||
AsEditModalView.call(view);
|
||||
|
||||
return view;
|
||||
});
|
||||
}).call(this);
|
||||
@@ -1,31 +1,20 @@
|
||||
'use strict';
|
||||
var Backbone = require('backbone');
|
||||
var IndexerModel = require('./IndexerModel');
|
||||
|
||||
define([
|
||||
'backbone',
|
||||
'Settings/Indexers/IndexerModel'
|
||||
], function (Backbone, IndexerModel) {
|
||||
|
||||
return Backbone.Collection.extend({
|
||||
model: IndexerModel,
|
||||
url : window.NzbDrone.ApiRoot + '/indexer',
|
||||
|
||||
comparator : function(left, right, collection) {
|
||||
|
||||
var result = 0;
|
||||
|
||||
if (left.get('protocol')) {
|
||||
result = -left.get('protocol').localeCompare(right.get('protocol'));
|
||||
}
|
||||
|
||||
if (result === 0 && left.get('name')) {
|
||||
result = left.get('name').localeCompare(right.get('name'));
|
||||
}
|
||||
|
||||
if (result === 0) {
|
||||
result = left.get('implementation').localeCompare(right.get('implementation'));
|
||||
}
|
||||
|
||||
return result;
|
||||
module.exports = Backbone.Collection.extend({
|
||||
model : IndexerModel,
|
||||
url : window.NzbDrone.ApiRoot + '/indexer',
|
||||
comparator : function(left, right, collection){
|
||||
var result = 0;
|
||||
if(left.get('protocol')) {
|
||||
result = -left.get('protocol').localeCompare(right.get('protocol'));
|
||||
}
|
||||
});
|
||||
});
|
||||
if(result === 0 && left.get('name')) {
|
||||
result = left.get('name').localeCompare(right.get('name'));
|
||||
}
|
||||
if(result === 0) {
|
||||
result = left.get('implementation').localeCompare(right.get('implementation'));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
});
|
||||
@@ -1,29 +1,17 @@
|
||||
'use strict';
|
||||
var Marionette = require('marionette');
|
||||
var ItemView = require('./IndexerItemView');
|
||||
var SchemaModal = require('./Add/IndexerSchemaModal');
|
||||
|
||||
define([
|
||||
'marionette',
|
||||
'Settings/Indexers/IndexerItemView',
|
||||
'Settings/Indexers/Add/IndexerSchemaModal'
|
||||
], function (Marionette, ItemView, SchemaModal) {
|
||||
return Marionette.CompositeView.extend({
|
||||
itemView : ItemView,
|
||||
itemViewContainer: '.indexer-list',
|
||||
template : 'Settings/Indexers/IndexerCollectionViewTemplate',
|
||||
|
||||
ui: {
|
||||
'addCard': '.x-add-card'
|
||||
},
|
||||
|
||||
events: {
|
||||
'click .x-add-card': '_openSchemaModal'
|
||||
},
|
||||
|
||||
appendHtml: function (collectionView, itemView, index) {
|
||||
collectionView.ui.addCard.parent('li').before(itemView.el);
|
||||
},
|
||||
|
||||
_openSchemaModal: function () {
|
||||
SchemaModal.open(this.collection);
|
||||
}
|
||||
});
|
||||
});
|
||||
module.exports = Marionette.CompositeView.extend({
|
||||
itemView : ItemView,
|
||||
itemViewContainer : '.indexer-list',
|
||||
template : 'Settings/Indexers/IndexerCollectionViewTemplate',
|
||||
ui : {"addCard" : '.x-add-card'},
|
||||
events : {"click .x-add-card" : '_openSchemaModal'},
|
||||
appendHtml : function(collectionView, itemView, index){
|
||||
collectionView.ui.addCard.parent('li').before(itemView.el);
|
||||
},
|
||||
_openSchemaModal : function(){
|
||||
SchemaModal.open(this.collection);
|
||||
}
|
||||
});
|
||||
@@ -1,26 +1,19 @@
|
||||
'use strict';
|
||||
var AppLayout = require('../../AppLayout');
|
||||
var Marionette = require('marionette');
|
||||
var EditView = require('./Edit/IndexerEditView');
|
||||
|
||||
define([
|
||||
'AppLayout',
|
||||
'marionette',
|
||||
'Settings/Indexers/Edit/IndexerEditView'
|
||||
], function (AppLayout, Marionette, EditView) {
|
||||
|
||||
return Marionette.ItemView.extend({
|
||||
template: 'Settings/Indexers/IndexerItemViewTemplate',
|
||||
tagName : 'li',
|
||||
|
||||
events: {
|
||||
'click' : '_edit'
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
this.listenTo(this.model, 'sync', this.render);
|
||||
},
|
||||
|
||||
_edit: function () {
|
||||
var view = new EditView({ model: this.model, targetCollection: this.model.collection });
|
||||
AppLayout.modalRegion.show(view);
|
||||
}
|
||||
});
|
||||
});
|
||||
module.exports = Marionette.ItemView.extend({
|
||||
template : 'Settings/Indexers/IndexerItemViewTemplate',
|
||||
tagName : 'li',
|
||||
events : {"click" : '_edit'},
|
||||
initialize : function(){
|
||||
this.listenTo(this.model, 'sync', this.render);
|
||||
},
|
||||
_edit : function(){
|
||||
var view = new EditView({
|
||||
model : this.model,
|
||||
targetCollection : this.model.collection
|
||||
});
|
||||
AppLayout.modalRegion.show(view);
|
||||
}
|
||||
});
|
||||
@@ -1,35 +1,26 @@
|
||||
'use strict';
|
||||
var Marionette = require('marionette');
|
||||
var IndexerCollection = require('./IndexerCollection');
|
||||
var CollectionView = require('./IndexerCollectionView');
|
||||
var OptionsView = require('./Options/IndexerOptionsView');
|
||||
var RestrictionCollection = require('./Restriction/RestrictionCollection');
|
||||
var RestrictionCollectionView = require('./Restriction/RestrictionCollectionView');
|
||||
|
||||
define([
|
||||
'marionette',
|
||||
'Settings/Indexers/IndexerCollection',
|
||||
'Settings/Indexers/IndexerCollectionView',
|
||||
'Settings/Indexers/Options/IndexerOptionsView',
|
||||
'Settings/Indexers/Restriction/RestrictionCollection',
|
||||
'Settings/Indexers/Restriction/RestrictionCollectionView'
|
||||
], function (Marionette, IndexerCollection, CollectionView, OptionsView, RestrictionCollection, RestrictionCollectionView) {
|
||||
|
||||
return Marionette.Layout.extend({
|
||||
template: 'Settings/Indexers/IndexerLayoutTemplate',
|
||||
|
||||
regions: {
|
||||
indexers : '#x-indexers-region',
|
||||
indexerOptions : '#x-indexer-options-region',
|
||||
restriction : '#x-restriction-region'
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
this.indexersCollection = new IndexerCollection();
|
||||
this.indexersCollection.fetch();
|
||||
|
||||
this.restrictionCollection = new RestrictionCollection();
|
||||
this.restrictionCollection.fetch();
|
||||
},
|
||||
|
||||
onShow: function () {
|
||||
this.indexers.show(new CollectionView({ collection: this.indexersCollection }));
|
||||
this.indexerOptions.show(new OptionsView({ model: this.model }));
|
||||
this.restriction.show(new RestrictionCollectionView({ collection: this.restrictionCollection }));
|
||||
}
|
||||
});
|
||||
});
|
||||
module.exports = Marionette.Layout.extend({
|
||||
template : 'Settings/Indexers/IndexerLayoutTemplate',
|
||||
regions : {
|
||||
indexers : '#x-indexers-region',
|
||||
indexerOptions : '#x-indexer-options-region',
|
||||
restriction : '#x-restriction-region'
|
||||
},
|
||||
initialize : function(){
|
||||
this.indexersCollection = new IndexerCollection();
|
||||
this.indexersCollection.fetch();
|
||||
this.restrictionCollection = new RestrictionCollection();
|
||||
this.restrictionCollection.fetch();
|
||||
},
|
||||
onShow : function(){
|
||||
this.indexers.show(new CollectionView({collection : this.indexersCollection}));
|
||||
this.indexerOptions.show(new OptionsView({model : this.model}));
|
||||
this.restriction.show(new RestrictionCollectionView({collection : this.restrictionCollection}));
|
||||
}
|
||||
});
|
||||
@@ -1,9 +1,3 @@
|
||||
'use strict';
|
||||
var ProviderSettingsModelBase = require('../ProviderSettingsModelBase');
|
||||
|
||||
define([
|
||||
'Settings/ProviderSettingsModelBase'
|
||||
], function (ProviderSettingsModelBase) {
|
||||
return ProviderSettingsModelBase.extend({
|
||||
|
||||
});
|
||||
});
|
||||
module.exports = ProviderSettingsModelBase.extend({});
|
||||
@@ -1,11 +1,7 @@
|
||||
'use strict';
|
||||
var SettingsModelBase = require('../SettingsModelBase');
|
||||
|
||||
define([
|
||||
'Settings/SettingsModelBase'
|
||||
], function (SettingsModelBase) {
|
||||
return SettingsModelBase.extend({
|
||||
url : window.NzbDrone.ApiRoot + '/config/indexer',
|
||||
successMessage: 'Indexer settings saved',
|
||||
errorMessage : 'Failed to save indexer settings'
|
||||
});
|
||||
});
|
||||
module.exports = SettingsModelBase.extend({
|
||||
url : window.NzbDrone.ApiRoot + '/config/indexer',
|
||||
successMessage : 'Indexer settings saved',
|
||||
errorMessage : 'Failed to save indexer settings'
|
||||
});
|
||||
@@ -1,17 +1,10 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'marionette',
|
||||
'Mixins/AsModelBoundView',
|
||||
'Mixins/AsValidatedView'
|
||||
], function (Marionette, AsModelBoundView, AsValidatedView) {
|
||||
var Marionette = require('marionette');
|
||||
var AsModelBoundView = require('../../../Mixins/AsModelBoundView');
|
||||
var AsValidatedView = require('../../../Mixins/AsValidatedView');
|
||||
|
||||
var view = Marionette.ItemView.extend({
|
||||
template: 'Settings/Indexers/Options/IndexerOptionsViewTemplate'
|
||||
});
|
||||
|
||||
AsModelBoundView.call(view);
|
||||
AsValidatedView.call(view);
|
||||
|
||||
return view;
|
||||
});
|
||||
module.exports = (function(){
|
||||
var view = Marionette.ItemView.extend({template : 'Settings/Indexers/Options/IndexerOptionsViewTemplate'});
|
||||
AsModelBoundView.call(view);
|
||||
AsValidatedView.call(view);
|
||||
return view;
|
||||
}).call(this);
|
||||
@@ -1,11 +1,7 @@
|
||||
'use strict';
|
||||
define([
|
||||
'backbone',
|
||||
'Settings/Indexers/Restriction/RestrictionModel'
|
||||
], function (Backbone, RestrictionModel) {
|
||||
var Backbone = require('backbone');
|
||||
var RestrictionModel = require('./RestrictionModel');
|
||||
|
||||
return Backbone.Collection.extend({
|
||||
model : RestrictionModel,
|
||||
url : window.NzbDrone.ApiRoot + '/Restriction'
|
||||
});
|
||||
});
|
||||
module.exports = Backbone.Collection.extend({
|
||||
model : RestrictionModel,
|
||||
url : window.NzbDrone.ApiRoot + '/Restriction'
|
||||
});
|
||||
@@ -1,27 +1,21 @@
|
||||
'use strict';
|
||||
define([
|
||||
'AppLayout',
|
||||
'marionette',
|
||||
'Settings/Indexers/Restriction/RestrictionItemView',
|
||||
'Settings/Indexers/Restriction/RestrictionEditView',
|
||||
'Tags/TagHelpers',
|
||||
'bootstrap'
|
||||
], function (AppLayout, Marionette, RestrictionItemView, EditView) {
|
||||
var AppLayout = require('../../../AppLayout');
|
||||
var Marionette = require('marionette');
|
||||
var RestrictionItemView = require('./RestrictionItemView');
|
||||
var EditView = require('./RestrictionEditView');
|
||||
require('../../../Tags/TagHelpers');
|
||||
require('bootstrap');
|
||||
|
||||
return Marionette.CompositeView.extend({
|
||||
template : 'Settings/Indexers/Restriction/RestrictionCollectionViewTemplate',
|
||||
itemViewContainer : '.x-rows',
|
||||
itemView : RestrictionItemView,
|
||||
|
||||
events: {
|
||||
'click .x-add' : '_addMapping'
|
||||
},
|
||||
|
||||
_addMapping: function() {
|
||||
var model = this.collection.create({ tags: [] });
|
||||
|
||||
var view = new EditView({ model: model, targetCollection: this.collection});
|
||||
AppLayout.modalRegion.show(view);
|
||||
}
|
||||
});
|
||||
});
|
||||
module.exports = Marionette.CompositeView.extend({
|
||||
template : 'Settings/Indexers/Restriction/RestrictionCollectionViewTemplate',
|
||||
itemViewContainer : '.x-rows',
|
||||
itemView : RestrictionItemView,
|
||||
events : {"click .x-add" : '_addMapping'},
|
||||
_addMapping : function(){
|
||||
var model = this.collection.create({tags : []});
|
||||
var view = new EditView({
|
||||
model : model,
|
||||
targetCollection : this.collection
|
||||
});
|
||||
AppLayout.modalRegion.show(view);
|
||||
}
|
||||
});
|
||||
@@ -1,23 +1,15 @@
|
||||
'use strict';
|
||||
var vent = require('../../../vent');
|
||||
var Marionette = require('marionette');
|
||||
|
||||
define([
|
||||
'vent',
|
||||
'marionette'
|
||||
], function (vent, Marionette) {
|
||||
return Marionette.ItemView.extend({
|
||||
template: 'Settings/Indexers/Restriction/RestrictionDeleteViewTemplate',
|
||||
|
||||
events: {
|
||||
'click .x-confirm-delete': '_delete'
|
||||
},
|
||||
|
||||
_delete: function () {
|
||||
this.model.destroy({
|
||||
wait : true,
|
||||
success: function () {
|
||||
vent.trigger(vent.Commands.CloseModalCommand);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
module.exports = Marionette.ItemView.extend({
|
||||
template : 'Settings/Indexers/Restriction/RestrictionDeleteViewTemplate',
|
||||
events : {'click .x-confirm-delete' : '_delete'},
|
||||
_delete : function(){
|
||||
this.model.destroy({
|
||||
wait : true,
|
||||
success : function(){
|
||||
vent.trigger(vent.Commands.CloseModalCommand);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -1,61 +1,49 @@
|
||||
'use strict';
|
||||
|
||||
define([
|
||||
'underscore',
|
||||
'vent',
|
||||
'AppLayout',
|
||||
'marionette',
|
||||
'Settings/Indexers/Restriction/RestrictionDeleteView',
|
||||
'Commands/CommandController',
|
||||
'Mixins/AsModelBoundView',
|
||||
'Mixins/AsValidatedView',
|
||||
'Mixins/AsEditModalView',
|
||||
'Mixins/TagInput',
|
||||
'bootstrap',
|
||||
'bootstrap.tagsinput'
|
||||
], function (_, vent, AppLayout, Marionette, DeleteView, CommandController, AsModelBoundView, AsValidatedView, AsEditModalView) {
|
||||
var _ = require('underscore');
|
||||
var vent = require('../../../vent');
|
||||
var AppLayout = require('../../../AppLayout');
|
||||
var Marionette = require('marionette');
|
||||
var DeleteView = require('./RestrictionDeleteView');
|
||||
var CommandController = require('../../../Commands/CommandController');
|
||||
var AsModelBoundView = require('../../../Mixins/AsModelBoundView');
|
||||
var AsValidatedView = require('../../../Mixins/AsValidatedView');
|
||||
var AsEditModalView = require('../../../Mixins/AsEditModalView');
|
||||
require('../../../Mixins/TagInput');
|
||||
require('bootstrap');
|
||||
require('bootstrap.tagsinput');
|
||||
|
||||
module.exports = (function(){
|
||||
var view = Marionette.ItemView.extend({
|
||||
template : 'Settings/Indexers/Restriction/RestrictionEditViewTemplate',
|
||||
|
||||
ui : {
|
||||
template : 'Settings/Indexers/Restriction/RestrictionEditViewTemplate',
|
||||
ui : {
|
||||
required : '.x-required',
|
||||
ignored : '.x-ignored',
|
||||
tags : '.x-tags'
|
||||
},
|
||||
|
||||
_deleteView: DeleteView,
|
||||
|
||||
initialize : function (options) {
|
||||
_deleteView : DeleteView,
|
||||
initialize : function(options){
|
||||
this.targetCollection = options.targetCollection;
|
||||
},
|
||||
|
||||
onRender : function () {
|
||||
onRender : function(){
|
||||
this.ui.required.tagsinput({
|
||||
trimValue : true,
|
||||
tagClass : 'label label-success'
|
||||
});
|
||||
|
||||
this.ui.ignored.tagsinput({
|
||||
trimValue : true,
|
||||
tagClass : 'label label-danger'
|
||||
});
|
||||
|
||||
this.ui.tags.tagInput({
|
||||
model : this.model,
|
||||
property : 'tags'
|
||||
});
|
||||
},
|
||||
|
||||
_onAfterSave : function () {
|
||||
this.targetCollection.add(this.model, { merge : true });
|
||||
_onAfterSave : function(){
|
||||
this.targetCollection.add(this.model, {merge : true});
|
||||
vent.trigger(vent.Commands.CloseModalCommand);
|
||||
}
|
||||
});
|
||||
|
||||
AsModelBoundView.call(view);
|
||||
AsValidatedView.call(view);
|
||||
AsEditModalView.call(view);
|
||||
|
||||
return view;
|
||||
});
|
||||
}).call(this);
|
||||
@@ -1,30 +1,20 @@
|
||||
'use strict';
|
||||
var AppLayout = require('../../../AppLayout');
|
||||
var Marionette = require('marionette');
|
||||
var EditView = require('./RestrictionEditView');
|
||||
|
||||
define([
|
||||
'AppLayout',
|
||||
'marionette',
|
||||
'Settings/Indexers/Restriction/RestrictionEditView'
|
||||
], function (AppLayout, Marionette, EditView) {
|
||||
|
||||
return Marionette.ItemView.extend({
|
||||
template : 'Settings/Indexers/Restriction/RestrictionItemViewTemplate',
|
||||
className : 'row',
|
||||
|
||||
ui: {
|
||||
tags: '.x-tags'
|
||||
},
|
||||
|
||||
events: {
|
||||
'click .x-edit' : '_edit'
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
this.listenTo(this.model, 'sync', this.render);
|
||||
},
|
||||
|
||||
_edit: function() {
|
||||
var view = new EditView({ model: this.model, targetCollection: this.model.collection});
|
||||
AppLayout.modalRegion.show(view);
|
||||
}
|
||||
});
|
||||
});
|
||||
module.exports = Marionette.ItemView.extend({
|
||||
template : 'Settings/Indexers/Restriction/RestrictionItemViewTemplate',
|
||||
className : 'row',
|
||||
ui : {tags : '.x-tags'},
|
||||
events : {"click .x-edit" : '_edit'},
|
||||
initialize : function(){
|
||||
this.listenTo(this.model, 'sync', this.render);
|
||||
},
|
||||
_edit : function(){
|
||||
var view = new EditView({
|
||||
model : this.model,
|
||||
targetCollection : this.model.collection
|
||||
});
|
||||
AppLayout.modalRegion.show(view);
|
||||
}
|
||||
});
|
||||
@@ -1,10 +1,4 @@
|
||||
'use strict';
|
||||
var $ = require('jquery');
|
||||
var DeepModel = require('backbone.deepmodel');
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'backbone.deepmodel'
|
||||
], function ($, DeepModel) {
|
||||
return DeepModel.DeepModel.extend({
|
||||
|
||||
});
|
||||
});
|
||||
module.exports = DeepModel.DeepModel.extend({});
|
||||
Reference in New Issue
Block a user