From 268f24905e4cc488c80f1d057451b6e528e3ff05 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Tue, 29 Sep 2015 11:10:05 +0200 Subject: Convert tab to 4 spaces in Python codemirror --- js/codeq/python.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'js/codeq') diff --git a/js/codeq/python.js b/js/codeq/python.js index cf2199a..c58d7e6 100644 --- a/js/codeq/python.js +++ b/js/codeq/python.js @@ -217,7 +217,20 @@ jqEditor = jqCode.find('.code_editor'), jqTerminal = jqConsole.find('.console'), jqHints = jqInfo.find('.hints'), - editor = CodeMirror(jqEditor[0], { cursorHeight: 0.85, lineNumbers: true, matchBrackets: true, mode: 'python' }), + editor = CodeMirror(jqEditor[0], { + cursorHeight: 0.85, + lineNumbers: true, + matchBrackets: true, + mode: 'python', + indentUnit: 4, + extraKeys: { + // replace tabs with spaces + Tab: function (cm) { + var spaces = Array(cm.getOption("indentUnit") + 1).join(" "); + cm.replaceSelection(spaces); + } + } + }), activityHandler = makeActivityHandler(editor, problemDef.id), terminal = makePythonTerminalHandler(jqTerminal, editor, problemDef.id, activityHandler), hinter = codeq.makeHinter(jqHints, jqEditor, editor, 'python_hints', problemDef.hint, commonHints, problemDef.plan), -- cgit v1.2.1 From a2c468392673e55425fda9a5a331b86935b07781 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20Smodi=C5=A1?= Date: Tue, 29 Sep 2015 11:53:46 +0200 Subject: Temporary "plan" button fix: look at the presence of Slovene translation to decide whether to activate or not the button. --- js/codeq/prolog.js | 2 +- js/codeq/python.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'js/codeq') diff --git a/js/codeq/prolog.js b/js/codeq/prolog.js index d827139..640aa99 100644 --- a/js/codeq/prolog.js +++ b/js/codeq/prolog.js @@ -272,7 +272,7 @@ if (currentSolution) editor.setValue(currentSolution); // $('#screen_prolog .title').text(problem.slug); // jqDescriptionContent.html(problem.description); - jqBtnPlan.prop('disabled', ((problemDef.plan && problemDef.plan.en) || []).length == 0); + jqBtnPlan.prop('disabled', ((problemDef.plan && problemDef.plan.sl) || []).length == 0); editor.on('change', function (instance, changeObj) { var doc = editor.getDoc(), diff --git a/js/codeq/python.js b/js/codeq/python.js index c58d7e6..4724982 100644 --- a/js/codeq/python.js +++ b/js/codeq/python.js @@ -243,7 +243,7 @@ if (currentSolution) editor.setValue(currentSolution); // $('#screen_python .title').text(problem.slug); // jqDescriptionContent.html(problem.description); - jqBtnPlan.prop('disabled', ((problemDef.plan && problemDef.plan.en) || []).length == 0); + jqBtnPlan.prop('disabled', ((problemDef.plan && problemDef.plan.sl) || []).length == 0); editor.on('change', function (instance, changeObj) { var doc = editor.getDoc(), -- cgit v1.2.1