From 1770de73f1d9b9b25c348fc5eea365ebd00c49c5 Mon Sep 17 00:00:00 2001 From: Valera Rozuvan Date: Fri, 11 Jan 2013 15:54:19 +0200 Subject: [PATCH] Bugfixing. Refactoring. Removed readonly check for text edits. Styling of text edits with jQuery UI. --- .../js/src/graphical_slider_tool/graph.js | 8 ++++ .../js/src/graphical_slider_tool/inputs.js | 44 ++++++------------- 2 files changed, 22 insertions(+), 30 deletions(-) diff --git a/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/graph.js b/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/graph.js index ad25c5f27c..6208f5fc3a 100644 --- a/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/graph.js +++ b/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/graph.js @@ -1286,6 +1286,10 @@ define('Graph', ['logme'], function (logme) { numNotUndefined = 0; for (c1 = 0; c1 < dataSeries.length; c1 += 1) { + if (dataSeries[c1].bars.show === false) { + continue; + } + if (isFinite(parseInt(dataSeries[c1].data[c0][1])) === true) { numNotUndefined += 1; } @@ -1293,6 +1297,10 @@ define('Graph', ['logme'], function (logme) { c3 = 0; for (c1 = 0; c1 < dataSeries.length; c1 += 1) { + if (dataSeries[c1].bars.show === false) { + continue; + } + dataSeries[c1].data[c0][0] -= graphBarWidth * (0.5 * numNotUndefined - c3); if (isFinite(parseInt(dataSeries[c1].data[c0][1])) === true) { diff --git a/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/inputs.js b/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/inputs.js index e48174ddb5..a04ed113ec 100644 --- a/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/inputs.js +++ b/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/inputs.js @@ -26,7 +26,7 @@ define('Inputs', ['logme'], function (logme) { return; function createInput(inputDiv, paramName) { - var paramObj, readOnly; + var paramObj; paramObj = state.getParamObj(paramName); @@ -37,41 +37,25 @@ define('Inputs', ['logme'], function (logme) { return; } - readOnly = false; - if (inputDiv.attr('data-el_readonly').toLowerCase() === 'true') { - readOnly = true; - } - - if (readOnly === true) { - - // In the case of a readonly config option, configure the text - // inputit as read-only, and NOT bind an event to it. - inputDiv.attr('readonly', 'readonly'); - inputDiv.css('background-color', '#D3D3D3'); - - } else { // readonly !== true - - // Bind a function to the 'change' event. Whenever the user changes - // the value of this text input, and presses 'enter' (or clicks - // somewhere else on the page), this event will be triggered, and - // our callback will be called. - inputDiv.bind('change', inputOnChange); - - } + // Bind a function to the 'change' event. Whenever the user changes + // the value of this text input, and presses 'enter' (or clicks + // somewhere else on the page), this event will be triggered, and + // our callback will be called. + inputDiv.bind('change', inputOnChange); inputDiv.val(paramObj.value); // Lets style the input element nicely. We will use the button() // widget for this since there is no native widget for the text // input. - // inputDiv.button().css({ - // 'font': 'inherit', - // 'color': 'inherit', - // 'text-align': 'left', - // 'outline': 'none', - // 'cursor': 'text', - // 'height': '15px' - // }); + inputDiv.button().css({ + 'font': 'inherit', + 'color': 'inherit', + 'text-align': 'left', + 'outline': 'none', + 'cursor': 'text', + 'height': '15px' + }); // Tell the parameter object from state that we are attaching a // text input to it. Next time the parameter will be updated with