diff --git a/htdocs/settings.js b/htdocs/settings.js
index 278e1c0..bf9a03c 100644
--- a/htdocs/settings.js
+++ b/htdocs/settings.js
@@ -5,13 +5,19 @@ function Input(name, value, options) {
this.label = options && options.label || name;
};
+Input.prototype.getClasses = function() {
+ return ['form-control', 'form-control-sm'];
+}
+
Input.prototype.bootstrapify = function(input) {
- input.addClass('form-control').addClass('form-control-sm');
+ this.getClasses().forEach(input.addClass.bind(input));
return [
'
'
].join('');
@@ -43,8 +49,48 @@ function SoapyGainInput() {
SoapyGainInput.prototype = new Input();
+SoapyGainInput.prototype.getClasses = function() {
+ return [];
+};
+
SoapyGainInput.prototype.render = function(){
- return this.bootstrapify($('Soapy gain settings go here
'));
+ var markup = $(
+ '' +
+ '' +
+ this.options.gains.map(function(g){
+ return '';
+ }).join('')
+ );
+ var el = $(this.bootstrapify(markup))
+ var setMode = function(mode){
+ el.find('.option').hide();
+ el.find('.gain-mode-' + mode).show();
+ };
+ el.on('change', 'select', function(){
+ var mode = $(this).val();
+ setMode(mode);
+ });
+ setMode('auto');
+ return el;
};
function ProfileInput() {