1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2024-12-26 01:27:00 +00:00
Lidarr/UI/Settings/Quality/Size/QualitySizeView.js

53 lines
1.5 KiB
JavaScript
Raw Normal View History

'use strict';
define(['marionette', 'Mixins/AsModelBoundView', 'jquery.knob'], function (Marionette, AsModelBoundView) {
var view = Marionette.ItemView.extend({
template : 'Settings/Quality/Size/QualitySizeTemplate',
tagName : 'li',
ui: {
knob : '.x-knob',
2013-06-28 08:20:15 +00:00
thirtyMinuteSize: '.x-size-thirty',
sixtyMinuteSize : '.x-size-sixty'
},
events: {
2013-06-28 15:09:30 +00:00
'change .x-knob': '_changeMaxSize'
},
initialize: function (options) {
this.qualityProfileCollection = options.qualityProfiles;
},
onRender: function () {
this.ui.knob.knob({
2013-06-28 08:20:15 +00:00
min : 0,
max : 200,
2013-07-02 04:52:41 +00:00
step : 1,
2013-06-28 08:20:15 +00:00
cursor : 25,
width : 150,
stopper : true,
displayInput : false
});
},
2013-06-28 17:25:09 +00:00
_changeMaxSize: function () {
var maxSize = this.model.get('maxSize');
var bytes = maxSize * 1024 * 1024;
var thirty = (bytes * 30).bytes(1);
var sixty = (bytes * 60).bytes(1);
2013-06-28 17:25:09 +00:00
if (parseInt(maxSize) === 0) {
thirty = 'No Limit';
sixty = 'No Limit';
}
this.ui.thirtyMinuteSize.html(thirty);
this.ui.sixtyMinuteSize.html(sixty);
}
});
return AsModelBoundView.call(view);
});