1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-12 11:15:43 +02:00

toolbar now saves its state for radio buttons.

This commit is contained in:
kay.one 2013-04-25 23:00:55 -07:00
parent 76c383dfdd
commit cf9f8b3f8a
5 changed files with 30 additions and 5 deletions

View File

@ -9,8 +9,7 @@ define(['app'], function () {
if (value !== undefined) {
NzbDrone.Config.SetValue(key, value);
}
else{
else {
return NzbDrone.Config.GetValue(key, 1);
}
};
@ -40,6 +39,8 @@ define(['app'], function () {
cookie = {};
}
console.log('Config: [{0}] => [{1}] '.format(key, value));
cookie[key] = value;
NzbDrone.Config.SetCookie(cookie);
};

View File

@ -111,6 +111,9 @@
<script src="/templates.js"></script>
<script src="/Instrumentation/StringFormat.js"></script>
<script src="/Mixins/backbone.marionette.templates.js"></script>
<script src="/Mixins/backbone.ajax.js"></script>
<script src="/Mixins/tablesorter.extensions.js"></script>

View File

@ -0,0 +1,11 @@
"use strict";
String.prototype.format = function () {
var args = arguments;
return this.replace(/{(\d+)}/g, function (match, number) {
if (typeof args[number] !== 'undefined') {
return args[number];
} else {
return match;
}
});
};

View File

@ -40,7 +40,6 @@ define(['app'], function () {
},
initialize: function () {
console.log('menu');
this.setElement($('#main-menu-region'));
}
});

View File

@ -1,15 +1,20 @@
"use strict";
define(['app'], function () {
define(['app', 'Config'], function () {
NzbDrone.Shared.Toolbar.RadioButtonView = Backbone.Marionette.ItemView.extend({
template : 'Shared/Toolbar/ButtonTemplate',
className: 'btn',
events: {
'click': 'invokeCallback'
'click': 'onClick'
},
initialize: function () {
this.storageKey = this.model.get('menuKey') + ':' + this.model.get('key');
},
onRender: function () {
if (this.model.get('active')) {
this.$el.addClass('active');
@ -17,6 +22,12 @@ define(['app'], function () {
}
},
onClick: function () {
NzbDrone.Config.SetValue(this.model.get('menuKey'), this.model.get('key'));
this.invokeCallback();
},
invokeCallback: function () {
if (!this.model.ownerContext) {