Skip to content

Commit

Permalink
Show further help link in new tab
Browse files Browse the repository at this point in the history
Also shortened current distinction into different categories
as right now it is not needed.
  • Loading branch information
Splines committed Nov 13, 2023
1 parent 3e75dbc commit 5359ec6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
4 changes: 3 additions & 1 deletion app/views/annotations/_form_content_further_help.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
<% end %>
<% unless link_name.blank? %>
<%= t('admin.annotation.further_help') %> <br>
<a href="<%= link %>"><%= link_name %></a>
<a href="<%= link %>" target="_blank" rel="noopener noreferrer">
<%= link_name %>
</a>
<% end %>
</div>
26 changes: 10 additions & 16 deletions app/views/annotations/edit.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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"%>');
}
Expand Down

0 comments on commit 5359ec6

Please sign in to comment.