diff --git a/app/assets/javascripts/editor.js b/app/assets/javascripts/editor.js index de92a552..33b57d8d 100644 --- a/app/assets/javascripts/editor.js +++ b/app/assets/javascripts/editor.js @@ -156,6 +156,10 @@ $(function() { jqxhr.fail(ajaxError); }; + var fileActionsAvailable = function() { + return isActiveFileRenderable() || isActiveFileRunnable() || isActiveFileStoppable() || isActiveFileTestable(); + }; + var findOrCreateOutputElement = function(index) { if ($('#output-' + index).isPresent()) { return $('#output-' + index); @@ -644,6 +648,8 @@ $(function() { $('#dropdown-run').toggleClass('disabled', !isActiveFileRunnable() || running); $('#dropdown-stop').toggleClass('disabled', !isActiveFileStoppable()); $('#dropdown-test').toggleClass('disabled', !isActiveFileTestable()); + $('#dummy').toggle(!fileActionsAvailable()); + $('#editor-buttons .dropdown-toggle').toggle(fileActionsAvailable()); $('#render').toggle(isActiveFileRenderable()); $('#run').toggle(isActiveFileRunnable() && !running); $('#stop').toggle(isActiveFileStoppable()); diff --git a/app/assets/stylesheets/editor.css.scss b/app/assets/stylesheets/editor.css.scss index a713234a..73042bd3 100644 --- a/app/assets/stylesheets/editor.css.scss +++ b/app/assets/stylesheets/editor.css.scss @@ -24,6 +24,11 @@ button i.fa-spin { display: none; } +#dummy { + display: none; + width: 100% !important; +} + #editor-buttons { background-color: #008CBA; margin-top: 1em; diff --git a/app/views/exercises/_editor.html.slim b/app/views/exercises/_editor.html.slim index 589a2786..9217105b 100644 --- a/app/views/exercises/_editor.html.slim +++ b/app/views/exercises/_editor.html.slim @@ -7,6 +7,7 @@ = render('editor_button', data: {:'data-message-confirm' => t('exercises.editor.confirm_start_over'), :'data-url' => exercise_path(exercise)}, icon: 'fa fa-history', id: 'start-over', label: t('exercises.editor.start_over')) = render('editor_button', data: {:'data-message-success' => t('submissions.create.success'), :'data-placement' => 'top', :'data-tooltip' => true}, icon: 'fa fa-save', id: 'save', label: t('exercises.editor.save'), title: t('.tooltips.save')) .btn-group + = render('editor_button', disabled: true, icon: 'fa fa-ban', id: 'dummy', label: t('exercises.editor.dummy')) = render('editor_button', icon: 'fa fa-desktop', id: 'render', label: t('exercises.editor.render')) = render('editor_button', data: {:'data-message-failure' => t('exercises.editor.run_failure'), :'data-message-network' => t('exercises.editor.network'), :'data-message-success' => t('exercises.editor.run_success'), :'data-placement' => 'top', :'data-tooltip' => true}, icon: 'fa fa-play', id: 'run', label: t('exercises.editor.run'), title: t('shared.tooltips.shortcut', shortcut: 'ALT + r')) = render('editor_button', data: {:'data-placement' => 'top', :'data-tooltip' => true}, icon: 'fa fa-stop', id: 'stop', label: t('exercises.editor.stop'), title: t('shared.tooltips.shortcut', shortcut: 'ALT + r')) diff --git a/app/views/exercises/_editor_button.html.slim b/app/views/exercises/_editor_button.html.slim index e7be2aba..cc03c1a9 100644 --- a/app/views/exercises/_editor_button.html.slim +++ b/app/views/exercises/_editor_button.html.slim @@ -1,4 +1,4 @@ -button.btn class=local_assigns.fetch(:classes, 'btn-primary') *local_assigns.fetch(:data, {}) id=id title=local_assigns[:title] type='button' +button.btn class=local_assigns.fetch(:classes, 'btn-primary') *local_assigns.fetch(:data, {}) disabled=local_assigns.fetch(:disabled, false) id=id title=local_assigns[:title] type='button' i.fa.fa-circle-o-notch.fa-spin i class=icon = label diff --git a/config/locales/de.yml b/config/locales/de.yml index 900ae98e..96088497 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -168,6 +168,7 @@ de: create_file: Neue Datei destroy_file: Datei löschen download: Herunterladen + dummy: Keine Aktion network: 'Während Ihr Code läuft, ist Port %{port} unter folgender Adresse erreichbar: %{address}.' render: Anzeigen run: Ausführen diff --git a/config/locales/en.yml b/config/locales/en.yml index 94662a8f..b3f5b32a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -168,6 +168,7 @@ en: create_file: New File destroy_file: Delete File download: Download + dummy: No Action network: 'While your code is running, port %{port} is accessible using the following address: %{address}.' render: Render run: Run