2013-03-07 08:01:18 +00:00
|
|
|
|
'use strict';
|
|
|
|
|
|
2013-07-25 03:57:34 +00:00
|
|
|
|
define(['marionette', 'Mixins/AsModelBoundView', 'filesize', 'jquery.knob' ], function (Marionette, AsModelBoundView, Filesize) {
|
2013-03-07 08:01:18 +00:00
|
|
|
|
|
2013-06-25 07:21:10 +00:00
|
|
|
|
var view = Marionette.ItemView.extend({
|
2013-03-29 23:28:58 +00:00
|
|
|
|
template : 'Settings/Quality/Size/QualitySizeTemplate',
|
2013-06-25 07:21:10 +00:00
|
|
|
|
tagName : 'li',
|
2013-03-07 08:01:18 +00:00
|
|
|
|
|
|
|
|
|
ui: {
|
2013-06-25 07:21:10 +00:00
|
|
|
|
knob : '.x-knob',
|
2013-06-28 08:20:15 +00:00
|
|
|
|
thirtyMinuteSize: '.x-size-thirty',
|
|
|
|
|
sixtyMinuteSize : '.x-size-sixty'
|
2013-03-07 08:01:18 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
events: {
|
2013-06-28 15:09:30 +00:00
|
|
|
|
'change .x-knob': '_changeMaxSize'
|
2013-03-07 08:01:18 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
initialize: function (options) {
|
|
|
|
|
this.qualityProfileCollection = options.qualityProfiles;
|
2013-07-25 03:57:34 +00:00
|
|
|
|
this.filesize = Filesize;
|
2013-03-07 08:01:18 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onRender: function () {
|
2013-06-25 07:21:10 +00:00
|
|
|
|
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-03-07 08:01:18 +00:00
|
|
|
|
});
|
2013-07-25 03:57:34 +00:00
|
|
|
|
|
|
|
|
|
this._changeMaxSize();
|
2013-03-07 08:01:18 +00:00
|
|
|
|
},
|
|
|
|
|
|
2013-06-28 17:25:09 +00:00
|
|
|
|
_changeMaxSize: function () {
|
|
|
|
|
var maxSize = this.model.get('maxSize');
|
|
|
|
|
var bytes = maxSize * 1024 * 1024;
|
2013-07-25 03:57:34 +00:00
|
|
|
|
var thirty = Filesize(bytes * 30, 1, false);
|
|
|
|
|
var sixty = Filesize(bytes * 60, 1, false);
|
2013-03-07 08:01:18 +00:00
|
|
|
|
|
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);
|
2013-03-07 08:01:18 +00:00
|
|
|
|
}
|
|
|
|
|
});
|
2013-06-25 07:21:10 +00:00
|
|
|
|
|
|
|
|
|
return AsModelBoundView.call(view);
|
2013-03-07 08:01:18 +00:00
|
|
|
|
});
|