mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-21 22:05:43 -04:00
UI Cleanup - Updated Settings subtree.
This commit is contained in:
@@ -5,46 +5,58 @@ var Marionette = require('marionette');
|
||||
var EditView = require('../Edit/NotificationEditView');
|
||||
|
||||
module.exports = Marionette.ItemView.extend({
|
||||
template : 'Settings/Notifications/Add/NotificationAddItemViewTemplate',
|
||||
tagName : 'li',
|
||||
className : 'add-thingy-item',
|
||||
events : {
|
||||
"click .x-preset" : '_addPreset',
|
||||
"click" : '_add'
|
||||
template : 'Settings/Notifications/Add/NotificationAddItemViewTemplate',
|
||||
tagName : 'li',
|
||||
className : 'add-thingy-item',
|
||||
|
||||
events : {
|
||||
'click .x-preset' : '_addPreset',
|
||||
'click' : '_add'
|
||||
},
|
||||
initialize : function(options){
|
||||
|
||||
initialize : function(options) {
|
||||
this.targetCollection = options.targetCollection;
|
||||
},
|
||||
_addPreset : function(e){
|
||||
|
||||
_addPreset : function(e) {
|
||||
var presetName = $(e.target).closest('.x-preset').attr('data-id');
|
||||
var presetData = _.where(this.model.get('presets'), {name : presetName})[0];
|
||||
|
||||
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) {
|
||||
|
||||
_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);
|
||||
}
|
||||
});
|
||||
@@ -3,7 +3,7 @@ var SchemaCollection = require('../NotificationCollection');
|
||||
var AddCollectionView = require('./NotificationAddCollectionView');
|
||||
|
||||
module.exports = {
|
||||
open : function(collection){
|
||||
open : function(collection) {
|
||||
var schemaCollection = new SchemaCollection();
|
||||
var originalUrl = schemaCollection.url;
|
||||
schemaCollection.url = schemaCollection.url + '/schema';
|
||||
|
||||
@@ -3,11 +3,14 @@ var Marionette = require('marionette');
|
||||
|
||||
module.exports = Marionette.ItemView.extend({
|
||||
template : 'Settings/Notifications/Delete/NotificationDeleteViewTemplate',
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
var vent = require('vent');
|
||||
var vent = require('vent');
|
||||
var Marionette = require('marionette');
|
||||
var DeleteView = require('../Delete/NotificationDeleteView');
|
||||
var AsModelBoundView = require('../../../Mixins/AsModelBoundView');
|
||||
@@ -7,55 +7,66 @@ var AsEditModalView = require('../../../Mixins/AsEditModalView');
|
||||
require('../../../Form/FormBuilder');
|
||||
require('../../../Mixins/TagInput');
|
||||
|
||||
module.exports = (function(){
|
||||
var view = Marionette.ItemView.extend({
|
||||
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'
|
||||
},
|
||||
_deleteView : DeleteView,
|
||||
initialize : function(options){
|
||||
this.targetCollection = options.targetCollection;
|
||||
},
|
||||
onRender : function(){
|
||||
this._onDownloadChanged();
|
||||
this.ui.tags.tagInput({
|
||||
model : this.model,
|
||||
property : 'tags'
|
||||
});
|
||||
},
|
||||
_onAfterSave : function(){
|
||||
this.targetCollection.add(this.model, {merge : true});
|
||||
vent.trigger(vent.Commands.CloseModalCommand);
|
||||
},
|
||||
_onAfterSaveAndAdd : function(){
|
||||
this.targetCollection.add(this.model, {merge : true});
|
||||
require('../Add/NotificationSchemaModal').open(this.targetCollection);
|
||||
},
|
||||
_back : function(){
|
||||
if(this.model.isNew()) {
|
||||
this.model.destroy();
|
||||
}
|
||||
require('../Add/NotificationSchemaModal').open(this.targetCollection);
|
||||
},
|
||||
_onDownloadChanged : function(){
|
||||
var checked = this.ui.onDownloadToggle.prop('checked');
|
||||
if(checked) {
|
||||
this.ui.onUpgradeSection.show();
|
||||
}
|
||||
else {
|
||||
this.ui.onUpgradeSection.hide();
|
||||
}
|
||||
var view = Marionette.ItemView.extend({
|
||||
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'
|
||||
},
|
||||
|
||||
_deleteView : DeleteView,
|
||||
|
||||
initialize : function(options) {
|
||||
this.targetCollection = options.targetCollection;
|
||||
},
|
||||
|
||||
onRender : function() {
|
||||
this._onDownloadChanged();
|
||||
this.ui.tags.tagInput({
|
||||
model : this.model,
|
||||
property : 'tags'
|
||||
});
|
||||
},
|
||||
|
||||
_onAfterSave : function() {
|
||||
this.targetCollection.add(this.model, { merge : true });
|
||||
vent.trigger(vent.Commands.CloseModalCommand);
|
||||
},
|
||||
|
||||
_onAfterSaveAndAdd : function() {
|
||||
this.targetCollection.add(this.model, { merge : true });
|
||||
|
||||
require('../Add/NotificationSchemaModal').open(this.targetCollection);
|
||||
},
|
||||
|
||||
_back : function() {
|
||||
if (this.model.isNew()) {
|
||||
this.model.destroy();
|
||||
}
|
||||
});
|
||||
AsModelBoundView.call(view);
|
||||
AsValidatedView.call(view);
|
||||
AsEditModalView.call(view);
|
||||
return view;
|
||||
}).call(this);
|
||||
|
||||
require('../Add/NotificationSchemaModal').open(this.targetCollection);
|
||||
},
|
||||
|
||||
_onDownloadChanged : function() {
|
||||
var checked = this.ui.onDownloadToggle.prop('checked');
|
||||
|
||||
if (checked) {
|
||||
this.ui.onUpgradeSection.show();
|
||||
} else {
|
||||
this.ui.onUpgradeSection.hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
AsModelBoundView.call(view);
|
||||
AsValidatedView.call(view);
|
||||
AsEditModalView.call(view);
|
||||
|
||||
module.exports = view;
|
||||
@@ -1,4 +1,4 @@
|
||||
<div class="modal-content">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
{{#if id}}
|
||||
|
||||
@@ -6,12 +6,20 @@ 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){
|
||||
|
||||
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(){
|
||||
|
||||
_openSchemaModal : function() {
|
||||
SchemaModal.open(this.collection);
|
||||
}
|
||||
});
|
||||
@@ -3,13 +3,18 @@ var Marionette = require('marionette');
|
||||
var EditView = require('./Edit/NotificationEditView');
|
||||
|
||||
module.exports = Marionette.ItemView.extend({
|
||||
template : 'Settings/Notifications/NotificationItemViewTemplate',
|
||||
tagName : 'li',
|
||||
events : {"click" : '_edit'},
|
||||
initialize : function(){
|
||||
template : 'Settings/Notifications/NotificationItemViewTemplate',
|
||||
tagName : 'li',
|
||||
|
||||
events : {
|
||||
'click' : '_edit'
|
||||
},
|
||||
|
||||
initialize : function() {
|
||||
this.listenTo(this.model, 'sync', this.render);
|
||||
},
|
||||
_edit : function(){
|
||||
|
||||
_edit : function() {
|
||||
var view = new EditView({
|
||||
model : this.model,
|
||||
targetCollection : this.model.collection
|
||||
|
||||
Reference in New Issue
Block a user