From c9b7cf40f398002e516839eb2c6b503e75849ae1 Mon Sep 17 00:00:00 2001 From: Dominic Clifton Date: Mon, 13 Oct 2014 18:47:13 +0100 Subject: [PATCH] When a mode has no ranges assigned the info panel should not show enabled/disabled state. --- tabs/auxiliary_configuration.js | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/tabs/auxiliary_configuration.js b/tabs/auxiliary_configuration.js index 34cd6506..48d1c825 100644 --- a/tabs/auxiliary_configuration.js +++ b/tabs/auxiliary_configuration.js @@ -1,6 +1,5 @@ 'use strict'; -// TODO: rework box_highlight & update_ui to accept flexible amount of aux channels TABS.auxiliary_configuration = {}; TABS.auxiliary_configuration.initialize = function (callback) { GUI.active_tab_ref = this; @@ -124,13 +123,6 @@ TABS.auxiliary_configuration.initialize = function (callback) { var modeId = AUX_CONFIG_IDS[modeIndex]; var newMode = createMode(modeIndex, modeId); modeTableBodyElement.append(newMode); - - // FIXME check mode ranges to see if each ID is used, it's used add the 'off' class to the corresponding mode element - /* - if (AUX_CONFIG_values[modeIndex] > 0) { - $('.mode .name').eq(modeIndex).data('modeElement').addClass('off'); - } - */ // generate ranges from the supplied AUX names and MODE_RANGE data for (var modeRangeIndex = 0; modeRangeIndex < MODE_RANGES.length; modeRangeIndex++) { @@ -282,12 +274,12 @@ TABS.auxiliary_configuration.initialize = function (callback) { function update_ui() { for (var i = 0; i < AUX_CONFIG.length; i++) { - // FIXME if the mode is unused, skip it - /* - if (AUX_CONFIG_values[i] == 0) { + var modeElement = $('#mode-' + i); + if (modeElement.find(' .range').length == 0) { + // if the mode is unused, skip it + modeElement.removeClass('off').removeClass('on'); continue; } - */ if (bit_check(CONFIG.mode, i)) { $('.mode .name').eq(i).data('modeElement').addClass('on').removeClass('off');