Add more actions to show exercise

This commit is contained in:
Sebastian Serth
2020-05-05 15:34:17 +02:00
parent d4a3c78b95
commit d07b4f436e
2 changed files with 381 additions and 367 deletions

View File

@ -9,7 +9,6 @@ $(document).on('turbolinks:load', function() {
var file_types;
var configureEditors = function () {
_.each(['modePath', 'themePath', 'workerPath'], function (attribute) {
ace.config.set(attribute, ACE_FILES_PATH);
@ -34,8 +33,7 @@ $(document).on('turbolinks:load', function() {
var textarea = $('textarea[id="exercise_files_attributes_' + index + '_content"]');
var content = textarea.val();
if (content != undefined)
{
if (content != undefined) {
editor.getSession().setValue(content);
editor.getSession().on('change', function () {
textarea.val(editor.getSession().getValue());
@ -377,8 +375,12 @@ $(document).on('turbolinks:load', function() {
overrideTextareaTabBehavior();
} else if ($('#files.jstree').isPresent()) {
var fileTypeSelect = $('#code_ocean_file_file_type_id');
fileTypeSelect.on("change", function() {updateFileTemplates(fileTypeSelect.val())});
fileTypeSelect.on("change", function () {
updateFileTemplates(fileTypeSelect.val())
});
updateFileTemplates(fileTypeSelect.val());
} else if ($('.export-start').isPresent()) {
observeExportButtons();
}
toggleCodeHeight();
if (window.hljs) {

View File

@ -7,7 +7,17 @@
h1
= @exercise
.btn-group.float-right
= render('shared/edit_button', object: @exercise)
button.btn.btn-secondary.float-right.dropdown-toggle data-toggle='dropdown' type='button'
ul.dropdown-menu.dropdown-menu-right role='menu'
li = link_to(t('exercises.index.implement'), implement_exercise_path(@exercise), 'data-turbolinks' => "false", class: 'dropdown-item text-dark') if policy(@exercise).implement?
li = link_to(t('shared.statistics'), statistics_exercise_path(@exercise), 'data-turbolinks' => "false", class: 'dropdown-item text-dark') if policy(@exercise).statistics?
li = link_to(t('activerecord.models.user_exercise_feedback.other'), feedback_exercise_path(@exercise), class: 'dropdown-item text-dark') if policy(@exercise).feedback?
li = link_to(t('activerecord.models.request_for_comment.other'), requests_for_comments_exercise_path(@exercise), class: 'dropdown-item text-dark') if policy(@exercise).requests_for_comments?
li = link_to(t('shared.destroy'), @exercise, data: {confirm: t('shared.confirm_destroy')}, method: :delete, class: 'dropdown-item text-dark') if policy(@exercise).destroy?
li = link_to(t('exercises.index.clone'), clone_exercise_path(@exercise), data: {confirm: t('shared.confirm_destroy')}, method: :post, class: 'dropdown-item text-dark') if policy(@exercise).clone?
li = link_to(t('exercises.export_codeharbor.label'), '', class: 'dropdown-item export-start text-dark', data: {'exercise-id' => @exercise.id}) if policy(@exercise).export_external_confirm?
= row(label: 'exercise.title', value: @exercise.title)
= row(label: 'exercise.user', value: link_to_if(policy(@exercise.author).show?, @exercise.author, @exercise.author))
@ -42,3 +52,5 @@ ul.list-unstyled#files
- if policy(file).destroy?
.clearfix = link_to(t('shared.destroy'), file, class:'btn btn-warning btn-sm float-right', data: {confirm: t('shared.confirm_destroy')}, method: :delete)
= render('shared/file', file: file)
= render('shared/modal', id: 'export-modal', title: t('exercises.export_codeharbor.dialogtitle'), template: 'exercises/_export_dialogcontent')