mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-29 05:16:34 +02:00
Fixed: Add tag when text box loses focus
This commit is contained in:
@@ -18,7 +18,14 @@ define([
|
||||
_deleteView: DeleteView,
|
||||
|
||||
ui: {
|
||||
tags : '.x-tags'
|
||||
tags : '.x-tags',
|
||||
usenetDelay : '.x-usenet-delay',
|
||||
torrentDelay : '.x-torrent-delay',
|
||||
protocol : '.x-protocol'
|
||||
},
|
||||
|
||||
events: {
|
||||
'change .x-protocol' : '_updateModel'
|
||||
},
|
||||
|
||||
initialize: function (options) {
|
||||
@@ -32,11 +39,83 @@ define([
|
||||
property : 'tags'
|
||||
});
|
||||
}
|
||||
|
||||
this._toggleControls();
|
||||
},
|
||||
|
||||
_onAfterSave: function () {
|
||||
this.targetCollection.add(this.model, { merge: true });
|
||||
vent.trigger(vent.Commands.CloseModalCommand);
|
||||
},
|
||||
|
||||
_updateModel: function () {
|
||||
var protocol = this.ui.protocol.val();
|
||||
|
||||
if (protocol === 'preferUsenet') {
|
||||
this.model.set({
|
||||
enableUsenet : true,
|
||||
enableTorrent : true,
|
||||
preferredProtocol : 'usenet'
|
||||
});
|
||||
}
|
||||
|
||||
if (protocol === 'preferTorrent') {
|
||||
this.model.set({
|
||||
enableUsenet : true,
|
||||
enableTorrent : true,
|
||||
preferredProtocol : 'torrent'
|
||||
});
|
||||
}
|
||||
|
||||
if (protocol === 'onlyUsenet') {
|
||||
this.model.set({
|
||||
enableUsenet : true,
|
||||
enableTorrent : false,
|
||||
preferredProtocol : 'usenet'
|
||||
});
|
||||
}
|
||||
|
||||
if (protocol === 'onlyTorrent') {
|
||||
this.model.set({
|
||||
enableUsenet : false,
|
||||
enableTorrent : true,
|
||||
preferredProtocol : 'torrent'
|
||||
});
|
||||
}
|
||||
|
||||
this._toggleControls();
|
||||
},
|
||||
|
||||
_toggleControls: function () {
|
||||
var enableUsenet = this.model.get('enableUsenet');
|
||||
var enableTorrent = this.model.get('enableTorrent');
|
||||
var preferred = this.model.get('preferredProtocol');
|
||||
|
||||
if (preferred === 'usenet') {
|
||||
this.ui.protocol.val('preferUsenet');
|
||||
}
|
||||
|
||||
else {
|
||||
this.ui.protocol.val('preferTorrent');
|
||||
}
|
||||
|
||||
if (enableUsenet) {
|
||||
this.ui.usenetDelay.show();
|
||||
}
|
||||
|
||||
else {
|
||||
this.ui.protocol.val('onlyTorrent');
|
||||
this.ui.usenetDelay.hide();
|
||||
}
|
||||
|
||||
if (enableTorrent) {
|
||||
this.ui.torrentDelay.show();
|
||||
}
|
||||
|
||||
else {
|
||||
this.ui.protocol.val('onlyUsenet');
|
||||
this.ui.torrentDelay.hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user