diff --git a/htdocs/settings.js b/htdocs/settings.js index 732e795..55abf45 100644 --- a/htdocs/settings.js +++ b/htdocs/settings.js @@ -68,16 +68,44 @@ function SdrDevice(el) { this.data = JSON.parse(decodeURIComponent(el.data('config'))); this.inputs = {}; this.render(); + + var self = this; + el.on('click', '.fieldselector .btn', function() { + var key = el.find('.fieldselector select').val(); + self.data[key] = false; + self.render(); + }); }; SdrDevice.prototype.render = function() { var self = this; + self.el.empty(); $.each(this.data, function(key, value) { var inputClass = Input.mappings[key] || TextInput; var input = new inputClass(key, value); self.inputs[key] = input; - self.el.append(input.render()) + self.el.append(input.render()); }); + self.el.append(this.renderFieldSelector()); +}; + +SdrDevice.prototype.renderFieldSelector = function() { + var self = this; + return '
' + + '

Add new configuration options

' + + '
' + + '
' + + '
' + + '
Add to config
' + + '
' + + '
' + + '

'; }; $.fn.sdrdevice = function() { @@ -113,5 +141,5 @@ $(function(){ }); }); - console.info($(".sdrdevice").sdrdevice()); + $(".sdrdevice").sdrdevice(); }); \ No newline at end of file