parent
0916c8b8d1
commit
24c77b4047
@ -1,37 +1,42 @@
|
||||
"use strict";
|
||||
define(['app'], function () {
|
||||
define(
|
||||
[
|
||||
'app'
|
||||
], function () {
|
||||
|
||||
NzbDrone.Config = {
|
||||
Events: {
|
||||
ConfigUpdatedEvent: 'ConfigUpdatedEvent'
|
||||
},
|
||||
Keys : {
|
||||
DefaultQualityProfileId: 'DefaultQualityProfileId'
|
||||
}
|
||||
};
|
||||
NzbDrone.Config = {
|
||||
Events: {
|
||||
ConfigUpdatedEvent: 'ConfigUpdatedEvent'
|
||||
},
|
||||
Keys : {
|
||||
DefaultQualityProfileId: 'DefaultQualityProfileId'
|
||||
}
|
||||
};
|
||||
|
||||
NzbDrone.Config.GetValue = function (key, defaultValue) {
|
||||
NzbDrone.Config.GetValue = function (key, defaultValue) {
|
||||
|
||||
var storeValue = localStorage.getItem(key);
|
||||
var storeValue = localStorage.getItem(key);
|
||||
|
||||
if (!storeValue) {
|
||||
return defaultValue;
|
||||
}
|
||||
if (!storeValue) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
return storeValue.toString();
|
||||
};
|
||||
return storeValue.toString();
|
||||
};
|
||||
|
||||
NzbDrone.Config.SetValue = function (key, value) {
|
||||
NzbDrone.Config.SetValue = function (key, value) {
|
||||
|
||||
console.log('Config: [{0}] => [{1}] '.format(key, value));
|
||||
console.log('Config: [{0}] => [{1}] '.format(key, value));
|
||||
|
||||
if (NzbDrone.Config.GetValue(key) === value.toString()) {
|
||||
return;
|
||||
}
|
||||
if (NzbDrone.Config.GetValue(key) === value.toString()) {
|
||||
return;
|
||||
}
|
||||
|
||||
localStorage.setItem(key, value);
|
||||
NzbDrone.vent.trigger(NzbDrone.Config.Events.ConfigUpdatedEvent, {key: key, value: value});
|
||||
localStorage.setItem(key, value);
|
||||
NzbDrone.vent.trigger(NzbDrone.Config.Events.ConfigUpdatedEvent, {key: key, value: value});
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
});
|
||||
return NzbDrone.Config;
|
||||
|
||||
});
|
||||
|
@ -1,7 +1,7 @@
|
||||
var statusText = $.ajax({
|
||||
type : "GET",
|
||||
url : 'api/system/status',
|
||||
async: false,
|
||||
url : '/api/system/status',
|
||||
async: false
|
||||
}).responseText;
|
||||
|
||||
window.ServerStatus = JSON.parse(statusText);
|
||||
|
@ -1,34 +1,39 @@
|
||||
"use strict";
|
||||
define(['app', 'Shared/Toolbar/Radio/RadioButtonView', 'Config'], function () {
|
||||
NzbDrone.Shared.Toolbar.RadioButtonCollectionView = Backbone.Marionette.CollectionView.extend({
|
||||
className: 'btn-group',
|
||||
itemView : NzbDrone.Shared.Toolbar.RadioButtonView,
|
||||
define(
|
||||
[
|
||||
'app',
|
||||
'Shared/Toolbar/Radio/RadioButtonView',
|
||||
'Config'
|
||||
], function (App, RadioButtonView, Config) {
|
||||
NzbDrone.Shared.Toolbar.RadioButtonCollectionView = Backbone.Marionette.CollectionView.extend({
|
||||
className: 'btn-group',
|
||||
itemView : NzbDrone.Shared.Toolbar.RadioButtonView,
|
||||
|
||||
attributes: {
|
||||
'data-toggle': 'buttons-radio'
|
||||
},
|
||||
attributes: {
|
||||
'data-toggle': 'buttons-radio'
|
||||
},
|
||||
|
||||
initialize: function (options) {
|
||||
this.menu = options.menu;
|
||||
initialize: function (options) {
|
||||
this.menu = options.menu;
|
||||
|
||||
if (this.menu.storeState) {
|
||||
this.setActive();
|
||||
}
|
||||
},
|
||||
if (this.menu.storeState) {
|
||||
this.setActive();
|
||||
}
|
||||
},
|
||||
|
||||
setActive: function () {
|
||||
var storedKey = NzbDrone.Config.GetValue(this.menu.menuKey, this.menu.defaultAction);
|
||||
setActive: function () {
|
||||
var storedKey = Config.GetValue(this.menu.menuKey, this.menu.defaultAction);
|
||||
|
||||
this.collection.each(function (model) {
|
||||
if (model.get('key').toLocaleLowerCase() === storedKey.toLowerCase()) {
|
||||
model.set('active', true);
|
||||
}
|
||||
else {
|
||||
model.set('active, false');
|
||||
}
|
||||
});
|
||||
}
|
||||
this.collection.each(function (model) {
|
||||
if (model.get('key').toLocaleLowerCase() === storedKey.toLowerCase()) {
|
||||
model.set('active', true);
|
||||
}
|
||||
else {
|
||||
model.set('active, false');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
Loading…
Reference in new issue