Show the input messages and set focus correct on input required.

This commit is contained in:
Ralf Teusner
2015-10-21 17:17:11 +02:00
parent 6a1eb391ff
commit 889d7562f9
2 changed files with 7 additions and 5 deletions

View File

@ -1160,7 +1160,7 @@ $(function() {
}
switch(msg.cmd) {
case 'input':
showPrompt();
showPrompt(msg);
break;
case 'write':
printWebsocketOutput(msg);
@ -1249,11 +1249,13 @@ $(function() {
executeWebsocketCommand(msg);
};
var showPrompt = function() {
if (prompt.isPresent() && prompt.hasClass('hidden')) {
var showPrompt = function(msg) {
var label = $('#prompt .input-group-addon');
label.text(msg.data || label.data('prompt'));
if (prompt.isPresent() && prompt.hasClass('hidden')) {
prompt.removeClass('hidden');
}
prompt.focus();
$('#prompt input').focus();
}
var hidePrompt = function() {

View File

@ -39,7 +39,7 @@
#output-col1
// todo set to full width if turtle isnt used
#prompt.input-group.hidden
span.input-group-addon = t('exercises.editor.input')
span.input-group-addon data-prompt=t('exercises.editor.input') = t('exercises.editor.input')
input#prompt-input.form-control type='text'
span.input-group-btn
button#prompt-submit.btn.btn-primary type="button" = t('exercises.editor.send')