added button state for files which no actions are available for
This commit is contained in:
@ -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());
|
||||
|
@ -24,6 +24,11 @@ button i.fa-spin {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#dummy {
|
||||
display: none;
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
#editor-buttons {
|
||||
background-color: #008CBA;
|
||||
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-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'))
|
||||
|
@ -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
|
||||
|
@ -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: <a href="%{address}" target="_blank">%{address}</a>.'
|
||||
render: Anzeigen
|
||||
run: Ausführen
|
||||
|
@ -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: <a href="%{address}" target="_blank">%{address}</a>.'
|
||||
render: Render
|
||||
run: Run
|
||||
|
Reference in New Issue
Block a user