mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-29 13:25:13 +02:00
rjs -> webpack
This commit is contained in:
@@ -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);
|
Reference in New Issue
Block a user