2013-03-07 11:01:18 +03:00
|
|
|
'use strict';
|
|
|
|
|
2013-06-25 10:21:10 +03:00
|
|
|
define(['marionette', 'Mixins/AsModelBoundView', 'jquery.knob'], function (Marionette, AsModelBoundView) {
|
2013-03-07 11:01:18 +03:00
|
|
|
|
2013-06-25 10:21:10 +03:00
|
|
|
var view = Marionette.ItemView.extend({
|
2013-03-30 02:28:58 +03:00
|
|
|
template : 'Settings/Quality/Size/QualitySizeTemplate',
|
2013-06-25 10:21:10 +03:00
|
|
|
tagName : 'li',
|
2013-03-07 11:01:18 +03:00
|
|
|
|
|
|
|
ui: {
|
2013-06-25 10:21:10 +03:00
|
|
|
knob : '.x-knob',
|
2013-06-28 11:20:15 +03:00
|
|
|
thirtyMinuteSize: '.x-size-thirty',
|
|
|
|
sixtyMinuteSize : '.x-size-sixty'
|
2013-03-07 11:01:18 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
events: {
|
2013-06-28 18:09:30 +03:00
|
|
|
'change .x-knob': '_changeMaxSize'
|
2013-03-07 11:01:18 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
initialize: function (options) {
|
|
|
|
this.qualityProfileCollection = options.qualityProfiles;
|
|
|
|
},
|
|
|
|
|
|
|
|
onRender: function () {
|
2013-06-25 10:21:10 +03:00
|
|
|
this.ui.knob.knob({
|
2013-06-28 11:20:15 +03:00
|
|
|
min : 0,
|
|
|
|
max : 200,
|
2013-07-02 07:52:41 +03:00
|
|
|
step : 1,
|
2013-06-28 11:20:15 +03:00
|
|
|
cursor : 25,
|
|
|
|
width : 150,
|
|
|
|
stopper : true,
|
|
|
|
displayInput : false
|
2013-03-07 11:01:18 +03:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2013-06-28 20:25:09 +03: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-03-07 11:01:18 +03:00
|
|
|
|
2013-06-28 20:25:09 +03:00
|
|
|
if (parseInt(maxSize) === 0) {
|
|
|
|
thirty = 'No Limit';
|
|
|
|
sixty = 'No Limit';
|
|
|
|
}
|
|
|
|
|
|
|
|
this.ui.thirtyMinuteSize.html(thirty);
|
|
|
|
this.ui.sixtyMinuteSize.html(sixty);
|
2013-03-07 11:01:18 +03:00
|
|
|
}
|
|
|
|
});
|
2013-06-25 10:21:10 +03:00
|
|
|
|
|
|
|
return AsModelBoundView.call(view);
|
2013-03-07 11:01:18 +03:00
|
|
|
});
|