From 5b55bf40b3a44aafb4b6574bdda92b73df17c649 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20R=C3=B6ger?= <jonas.roeger@tu-dortmund.de> Date: Fri, 18 Oct 2019 13:44:26 +0200 Subject: [PATCH] Added bugreport dialog frontend --- html/index.html | 16 ++++++++++++++++ html/static/main.js | 24 ++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/html/index.html b/html/index.html index 6a3e356..3990237 100644 --- a/html/index.html +++ b/html/index.html @@ -14,6 +14,7 @@ {{ range.Challenges}} colnum.set("{{.Name}}",{col: "{{.DepCount}}", row: "{{.Row}}"}); {{end}} + var bugreportCategories = ["Main Page" {{ range.Challenges }},"{{.Name}}"{{end}}]; function start(){ {{if .IsUser}}{{else}}document.getElementById("loginbutton").click();{{end}} {{ if .IsUser }} @@ -63,6 +64,7 @@ colnum.set("{{.Name}}",{col: "{{.DepCount}}", row: "{{.Row}}"}); <dialog id="detailview"> <span class="mdi mdi-close closebtn" id="detailclosebutton"></span> <h1 id="detailtitle"></h1> + <input type="button" id="bugreport"></input> <h3 class="detailmeta"> <div class="flexcell flex-left"> <a id="challuri" class="challengelink" style="display: none;">Zur Challenge!</a> @@ -89,4 +91,18 @@ colnum.set("{{.Name}}",{col: "{{.DepCount}}", row: "{{.Row}}"}); <span id="checkloading" class="loadingbar" style="display: none;"></span> </dialog> + <dialog id="bugreportview"> + <span class="mdi mdi-close closebtn" id="bugreportclosebutton"></span> + <h1>Report Bug</h1> + <div id="bugreportform"> + <select id="bugreportcategory" ></select> + <input type="text" placeholder="Das soll so ja nicht" id="subjectinput" class="firamono flexcell" style="width: 30vw;"/> + </br> + <textarea placeholder="Alles kaputt..." id="contentinput" class="firamono flexcell" style="height: 30vh; width: 30vw; resize: none;"></textarea> + </br> + <input class="button" type="submit" id="bugreportbutton" value="Send report" style="float: right"/> + </div> + <span id="bugloading" class="loadingbar" style="display: none;"></span> + </dialog> + {{ template "footer" . }} diff --git a/html/static/main.js b/html/static/main.js index b399631..07d0ffb 100755 --- a/html/static/main.js +++ b/html/static/main.js @@ -7,6 +7,9 @@ let solutioneventlistenerfunc = function () { let flaginputeventlistenerfunc = function () { }; +// Used for selection dialog in bugreport +let selCategory = document.getElementById("bugreportcategory"); + function addChallEventListener(title, points) { let elem = document.getElementById(title); elem.addEventListener("click", function () { @@ -113,6 +116,7 @@ function addChallEventListener(title, points) { } }); + selCategory.value = title; showDialog(detView); }); @@ -312,5 +316,25 @@ function connectElements(svg, startElem, endElem, color) { svg1.innerHTML = ""; // noinspection JSUnresolvedVariable flagsubmitbutton.addEventListener("click", flagsubmiteventlistenerfunc); + let btnBugreport = document.getElementById("bugreport"); + let dlgBugreport = document.getElementById("bugreportview"); + let btnBugreportClose = document.getElementById("bugreportclosebutton"); + btnBugreportClose.addEventListener("click", function () { + dlgBugreport.close(); + }); + dialogPolyfill.registerDialog(dlgBugreport); + btnBugreport.addEventListener("click", function() { + showDialog(dlgBugreport); + loadBugReportView(); + }); + + // Add categories to bugreport selection + bugreportCategories.forEach(function(elem) { + var opt = document.createElement("option"); + opt.value= elem; + opt.innerHTML = elem; + selCategory.appendChild(opt); + }); + start(); })(); -- GitLab