From 5359ec6a2f6ee717757b00fe8033b0cd1f4da3c9 Mon Sep 17 00:00:00 2001 From: Splines Date: Mon, 13 Nov 2023 20:23:48 +0100 Subject: [PATCH] Show further help link in new tab Also shortened current distinction into different categories as right now it is not needed. --- .../_form_content_further_help.html.erb | 4 ++- app/views/annotations/edit.js.erb | 26 +++++++------------ 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/app/views/annotations/_form_content_further_help.html.erb b/app/views/annotations/_form_content_further_help.html.erb index 9ed247bec..6ff5da1c4 100644 --- a/app/views/annotations/_form_content_further_help.html.erb +++ b/app/views/annotations/_form_content_further_help.html.erb @@ -9,6 +9,8 @@ <% end %> <% unless link_name.blank? %> <%= t('admin.annotation.further_help') %>
- <%= link_name %> + + <%= link_name %> + <% end %> diff --git a/app/views/annotations/edit.js.erb b/app/views/annotations/edit.js.erb index 56af7d60f..59ee85d20 100644 --- a/app/views/annotations/edit.js.erb +++ b/app/views/annotations/edit.js.erb @@ -101,38 +101,32 @@ function note() { function content() { $('#annotation-category-specific').empty() .append('<%= j render partial: "annotations/form_content"%>'); - submitButton.disabled = true; // disable submit button until the content category is selected + // disable submit button until the content category is selected + submitButton.disabled = true; visibleForTeacher(true); postComment(false); var contentCategoryRadios = document.getElementById('content-category-radios'); contentCategoryRadios.addEventListener('click', function (evt) { if (evt.target && event.target.matches("input[type='radio']")) { submitButton.disabled = false; + + // Show further help + // (right now, the same help is display for all the different categories) switch (evt.target.value) { case Subcategory.DEFINITION.name: - definition(); + showFurtherHelp(); break; case Subcategory.ARGUMENT.name: - argument(); + showFurtherHelp(); break; case Subcategory.STRATEGY.name: - strategy(); + showFurtherHelp(); break; } } }); - /* For the moment all three methods do the same, but as it's very likely that - we'll implement different behaviour in the future, I havn't removed the lines - in order to avoid code duplication. */ - function definition() { - $('#content-specific').empty() - .append('<%= j render partial: "annotations/form_content_further_help"%>'); - } - function argument() { - $('#content-specific').empty() - .append('<%= j render partial: "annotations/form_content_further_help"%>'); - } - function strategy() { + + function showFurtherHelp() { $('#content-specific').empty() .append('<%= j render partial: "annotations/form_content_further_help"%>'); }