rjs -> webpack

This commit is contained in:
Keivan Beigi
2015-02-02 17:18:45 -08:00
parent 344f3d66ef
commit 428a1439e5
399 changed files with 11591 additions and 16139 deletions
@@ -1,13 +1,8 @@
'use strict';
var ThingyAddCollectionView = require('../../ThingyAddCollectionView');
var AddItemView = require('./NotificationAddItemView');
define([
'Settings/ThingyAddCollectionView',
'Settings/Notifications/Add/NotificationAddItemView'
], function (ThingyAddCollectionView, AddItemView) {
return ThingyAddCollectionView.extend({
itemView : AddItemView,
itemViewContainer: '.add-notifications .items',
template : 'Settings/Notifications/Add/NotificationAddCollectionViewTemplate'
});
});
module.exports = ThingyAddCollectionView.extend({
itemView : AddItemView,
itemViewContainer : '.add-notifications .items',
template : 'Settings/Notifications/Add/NotificationAddCollectionViewTemplate'
});
@@ -1,60 +1,50 @@
'use strict';
var _ = require('underscore');
var $ = require('jquery');
var AppLayout = require('../../../AppLayout');
var Marionette = require('marionette');
var EditView = require('../Edit/NotificationEditView');
define([
'underscore',
'jquery',
'AppLayout',
'marionette',
'Settings/Notifications/Edit/NotificationEditView'
], function (_, $, AppLayout, Marionette, EditView) {
return Marionette.ItemView.extend({
template : 'Settings/Notifications/Add/NotificationAddItemViewTemplate',
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.model.set({
id : undefined,
onGrab : true,
onDownload : true,
onUpgrade : true
});
var editView = new EditView({ model: this.model, targetCollection: this.targetCollection });
AppLayout.modalRegion.show(editView);
},
_add: function (e) {
if ($(e.target).closest('.btn,.btn-group').length !== 0) {
return;
}
this.model.set({
id : undefined,
onGrab : true,
onDownload : true,
onUpgrade : true
});
var editView = new EditView({ model: this.model, targetCollection: this.targetCollection });
AppLayout.modalRegion.show(editView);
module.exports = Marionette.ItemView.extend({
template : 'Settings/Notifications/Add/NotificationAddItemViewTemplate',
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.model.set({
id : undefined,
onGrab : true,
onDownload : true,
onUpgrade : true
});
var editView = new EditView({
model : this.model,
targetCollection : this.targetCollection
});
AppLayout.modalRegion.show(editView);
},
_add : function(e){
if($(e.target).closest('.btn,.btn-group').length !== 0) {
return;
}
});
});
this.model.set({
id : undefined,
onGrab : true,
onDownload : true,
onUpgrade : true
});
var editView = new EditView({
model : this.model,
targetCollection : this.targetCollection
});
AppLayout.modalRegion.show(editView);
}
});
@@ -1,21 +1,18 @@
'use strict';
var AppLayout = require('../../../AppLayout');
var SchemaCollection = require('../NotificationCollection');
var AddCollectionView = require('./NotificationAddCollectionView');
define([
'AppLayout',
'Settings/Notifications/NotificationCollection',
'Settings/Notifications/Add/NotificationAddCollectionView'
], function (AppLayout, 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 view = new AddCollectionView({ collection: schemaCollection, targetCollection: collection});
AppLayout.modalRegion.show(view);
}
});
});
module.exports = {
open : function(collection){
var schemaCollection = new SchemaCollection();
var originalUrl = schemaCollection.url;
schemaCollection.url = schemaCollection.url + '/schema';
schemaCollection.fetch();
schemaCollection.url = originalUrl;
var view = new AddCollectionView({
collection : schemaCollection,
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/Notifications/Delete/NotificationDeleteViewTemplate',
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/Notifications/Delete/NotificationDeleteViewTemplate',
events : {"click .x-confirm-delete" : '_delete'},
_delete : function(){
this.model.destroy({
wait : true,
success : function(){
vent.trigger(vent.Commands.CloseModalCommand);
}
});
}
});
@@ -1,83 +1,65 @@
'use strict';
define([
'underscore',
'vent',
'AppLayout',
'marionette',
'Settings/Notifications/Delete/NotificationDeleteView',
'Commands/CommandController',
'Mixins/AsModelBoundView',
'Mixins/AsValidatedView',
'Mixins/AsEditModalView',
'Form/FormBuilder',
'Mixins/TagInput'
], 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('../Delete/NotificationDeleteView');
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/TagInput');
require('../Add/NotificationSchemaModal');
module.exports = (function(){
var view = Marionette.ItemView.extend({
template: 'Settings/Notifications/Edit/NotificationEditViewTemplate',
ui: {
template : 'Settings/Notifications/Edit/NotificationEditViewTemplate',
ui : {
onDownloadToggle : '.x-on-download',
onUpgradeSection : '.x-on-upgrade',
tags : '.x-tags'
},
events: {
'click .x-back' : '_back',
'change .x-on-download': '_onDownloadChanged'
events : {
"click .x-back" : '_back',
"change .x-on-download" : '_onDownloadChanged'
},
_deleteView: DeleteView,
initialize: function (options) {
_deleteView : DeleteView,
initialize : function(options){
this.targetCollection = options.targetCollection;
},
onRender: function () {
onRender : function(){
this._onDownloadChanged();
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);
},
_onAfterSaveAndAdd: function () {
this.targetCollection.add(this.model, { merge: true });
require('Settings/Notifications/Add/NotificationSchemaModal').open(this.targetCollection);
_onAfterSaveAndAdd : function(){
this.targetCollection.add(this.model, {merge : true});
require('../Add/NotificationSchemaModal').open(this.targetCollection);
},
_back: function () {
if (this.model.isNew()) {
_back : function(){
if(this.model.isNew()) {
this.model.destroy();
}
require('Settings/Notifications/Add/NotificationSchemaModal').open(this.targetCollection);
require('../Add/NotificationSchemaModal').open(this.targetCollection);
},
_onDownloadChanged: function () {
_onDownloadChanged : function(){
var checked = this.ui.onDownloadToggle.prop('checked');
if (checked) {
if(checked) {
this.ui.onUpgradeSection.show();
}
else {
this.ui.onUpgradeSection.hide();
}
}
});
AsModelBoundView.call(view);
AsValidatedView.call(view);
AsEditModalView.call(view);
return view;
});
}).call(this);
@@ -1,13 +1,7 @@
'use strict';
var Backbone = require('backbone');
var NotificationModel = require('./NotificationModel');
define([
'backbone',
'Settings/Notifications/NotificationModel'
], function (Backbone, NotificationModel) {
return Backbone.Collection.extend({
model: NotificationModel,
url : window.NzbDrone.ApiRoot + '/notification'
});
});
module.exports = Backbone.Collection.extend({
model : NotificationModel,
url : window.NzbDrone.ApiRoot + '/notification'
});
@@ -1,29 +1,17 @@
'use strict';
var Marionette = require('marionette');
var ItemView = require('./NotificationItemView');
var SchemaModal = require('./Add/NotificationSchemaModal');
define([
'marionette',
'Settings/Notifications/NotificationItemView',
'Settings/Notifications/Add/NotificationSchemaModal'
], function (Marionette, ItemView, SchemaModal) {
return Marionette.CompositeView.extend({
itemView : ItemView,
itemViewContainer: '.notification-list',
template : 'Settings/Notifications/NotificationCollectionViewTemplate',
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 : '.notification-list',
template : 'Settings/Notifications/NotificationCollectionViewTemplate',
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/NotificationEditView');
define([
'AppLayout',
'marionette',
'Settings/Notifications/Edit/NotificationEditView'
], function (AppLayout, Marionette, EditView) {
return Marionette.ItemView.extend({
template: 'Settings/Notifications/NotificationItemViewTemplate',
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/Notifications/NotificationItemViewTemplate',
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,9 +1,3 @@
'use strict';
var ProviderSettingsModelBase = require('../ProviderSettingsModelBase');
define([
'Settings/ProviderSettingsModelBase'
], function (ProviderSettingsModelBase) {
return ProviderSettingsModelBase.extend({
});
});
module.exports = ProviderSettingsModelBase.extend({});