Skip to content
Snippets Groups Projects
Commit 0f18e15e authored by Isabel Uffinger's avatar Isabel Uffinger
Browse files

Set proglang and grader name as tag

parent 5c15dfc1
No related branches found
No related tags found
No related merge requests found
......@@ -118,6 +118,15 @@ define(['core/ajax',
let searchVal = selectedGrader["html_representation"];
setSelectionSafely("#id_graderselect option[value='" + searchVal + "']");
//setting the proglang and gradername as tag (easiest point to access selected grader name)
let tagInput = document.querySelectorAll('[id^=form_autocomplete_input]')[0];
tagInput.value = result.proglang;
enterKeyEvent(tagInput);
let gradername = document.querySelector("#id_graderselect option[value='" + searchVal + "']").text;
tagInput.value = gradername;
enterKeyEvent(tagInput);
if ('result_spec' in selectedGrader) {
if ('format' in selectedGrader['result_spec']) {
searchVal = selectedGrader['result_spec']['format'];
......@@ -237,3 +246,19 @@ function setSelectionSafely(query) {
if(null !== select)
select.selected = true;
}
function enterKeyEvent(elem) {
var event = new KeyboardEvent("keydown", {
bubbles: true,
cancelBubble: false,
cancelable: true,
charCode: 0,
code: "Enter",
isTrusted: true,
key: "Enter",
keyCode: 13,
repeat: false,
type: "keydown",
which: 13});
elem.dispatchEvent(event);
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment