added button state for files which no actions are available for
This commit is contained in:
@ -156,6 +156,10 @@ $(function() {
|
|||||||
jqxhr.fail(ajaxError);
|
jqxhr.fail(ajaxError);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var fileActionsAvailable = function() {
|
||||||
|
return isActiveFileRenderable() || isActiveFileRunnable() || isActiveFileStoppable() || isActiveFileTestable();
|
||||||
|
};
|
||||||
|
|
||||||
var findOrCreateOutputElement = function(index) {
|
var findOrCreateOutputElement = function(index) {
|
||||||
if ($('#output-' + index).isPresent()) {
|
if ($('#output-' + index).isPresent()) {
|
||||||
return $('#output-' + index);
|
return $('#output-' + index);
|
||||||
@ -644,6 +648,8 @@ $(function() {
|
|||||||
$('#dropdown-run').toggleClass('disabled', !isActiveFileRunnable() || running);
|
$('#dropdown-run').toggleClass('disabled', !isActiveFileRunnable() || running);
|
||||||
$('#dropdown-stop').toggleClass('disabled', !isActiveFileStoppable());
|
$('#dropdown-stop').toggleClass('disabled', !isActiveFileStoppable());
|
||||||
$('#dropdown-test').toggleClass('disabled', !isActiveFileTestable());
|
$('#dropdown-test').toggleClass('disabled', !isActiveFileTestable());
|
||||||
|
$('#dummy').toggle(!fileActionsAvailable());
|
||||||
|
$('#editor-buttons .dropdown-toggle').toggle(fileActionsAvailable());
|
||||||
$('#render').toggle(isActiveFileRenderable());
|
$('#render').toggle(isActiveFileRenderable());
|
||||||
$('#run').toggle(isActiveFileRunnable() && !running);
|
$('#run').toggle(isActiveFileRunnable() && !running);
|
||||||
$('#stop').toggle(isActiveFileStoppable());
|
$('#stop').toggle(isActiveFileStoppable());
|
||||||
|
@ -24,6 +24,11 @@ button i.fa-spin {
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#dummy {
|
||||||
|
display: none;
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
|
||||||
#editor-buttons {
|
#editor-buttons {
|
||||||
background-color: #008CBA;
|
background-color: #008CBA;
|
||||||
margin-top: 1em;
|
margin-top: 1em;
|
||||||
|
@ -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-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'))
|
= 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
|
.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', 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-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'))
|
= 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'))
|
||||||
|
@ -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.fa.fa-circle-o-notch.fa-spin
|
||||||
i class=icon
|
i class=icon
|
||||||
= label
|
= label
|
||||||
|
@ -168,6 +168,7 @@ de:
|
|||||||
create_file: Neue Datei
|
create_file: Neue Datei
|
||||||
destroy_file: Datei löschen
|
destroy_file: Datei löschen
|
||||||
download: Herunterladen
|
download: Herunterladen
|
||||||
|
dummy: Keine Aktion
|
||||||
network: 'Während Ihr Code läuft, ist Port %{port} unter folgender Adresse erreichbar: <a href="%{address}" target="_blank">%{address}</a>.'
|
network: 'Während Ihr Code läuft, ist Port %{port} unter folgender Adresse erreichbar: <a href="%{address}" target="_blank">%{address}</a>.'
|
||||||
render: Anzeigen
|
render: Anzeigen
|
||||||
run: Ausführen
|
run: Ausführen
|
||||||
|
@ -168,6 +168,7 @@ en:
|
|||||||
create_file: New File
|
create_file: New File
|
||||||
destroy_file: Delete File
|
destroy_file: Delete File
|
||||||
download: Download
|
download: Download
|
||||||
|
dummy: No Action
|
||||||
network: 'While your code is running, port %{port} is accessible using the following address: <a href="%{address}" target="_blank">%{address}</a>.'
|
network: 'While your code is running, port %{port} is accessible using the following address: <a href="%{address}" target="_blank">%{address}</a>.'
|
||||||
render: Render
|
render: Render
|
||||||
run: Run
|
run: Run
|
||||||
|
Reference in New Issue
Block a user