From 18064257685f13eb31a0bdd7e98d1bcbd5608018 Mon Sep 17 00:00:00 2001 From: freyavs Date: Mon, 31 Jul 2023 23:46:27 +0200 Subject: [PATCH] remove unused functions from score_item --- app/assets/javascripts/score_item.ts | 50 ---------------------------- app/javascript/packs/score_item.js | 4 +-- 2 files changed, 1 insertion(+), 53 deletions(-) diff --git a/app/assets/javascripts/score_item.ts b/app/assets/javascripts/score_item.ts index ab5aaa6458..52fc6fe5f1 100644 --- a/app/assets/javascripts/score_item.ts +++ b/app/assets/javascripts/score_item.ts @@ -1,23 +1,5 @@ import { fetch } from "util.js"; -export function initInlineEditButton(tableElement: HTMLElement): void { - tableElement.querySelectorAll(".edit-button").forEach(item => { - item.addEventListener("click", e => { - e.preventDefault(); - const clicked = (e.target as HTMLElement).closest("a") as HTMLAnchorElement; - const scoreItemId = clicked.dataset.scoreItem; - const row = document.getElementById(`form-row-${scoreItemId}`); - if (row.classList.contains("hidden")) { - row.classList.remove("hidden"); - clicked.innerHTML = ""; - } else { - row.classList.add("hidden"); - clicked.innerHTML = ""; - } - }); - }); -} - function commonCheckboxInit( element: HTMLElement, selector: string, @@ -72,38 +54,6 @@ function initItemVisibilityCheckboxes(element: HTMLElement): void { }); } -export function initScoreItemPanels(): void { - const $choicePanel = $("#choice-panel"); - const $itemPanel = $("#items-panel"); - - function init(): void { - initPanelLogic(); - // // Bootstrap's automatic collapsing of other elements in the parent breaks - // // when doing manual shows and hides, so we have to do this. - $choicePanel.find(".panel-collapse").on("show.bs.collapse", function () { - $itemPanel.find(".panel-collapse").collapse("hide"); - }); - $itemPanel.find(".panel-collapse").on("show.bs.collapse", function () { - $choicePanel.find(".panel-collapse").collapse("hide"); - }); - } - - function initPanelLogic(): void { - $("#yes-grading").on("click", function () { - $itemPanel.find(".step-circle").html("2"); - $(this) - .closest(".panel") - .find(".answer") - .html($(this).data("answer")); - $itemPanel.removeClass("hidden"); - $itemPanel.find(".panel-collapse").collapse("show"); - window.scrollTo(0, 0); - }); - } - - init(); -} - export function initVisibilityCheckboxes(element: HTMLElement): void { initTotalVisibilityCheckboxes(element); initItemVisibilityCheckboxes(element); diff --git a/app/javascript/packs/score_item.js b/app/javascript/packs/score_item.js index f94f69b853..79aeb544fc 100644 --- a/app/javascript/packs/score_item.js +++ b/app/javascript/packs/score_item.js @@ -1,5 +1,3 @@ -import { initInlineEditButton, initVisibilityCheckboxes, initScoreItemPanels } from "score_item.ts"; +import { initVisibilityCheckboxes } from "score_item.ts"; -window.dodona.initInlineEditButton = initInlineEditButton; window.dodona.initVisibilityCheckboxes = initVisibilityCheckboxes; -window.dodona.initScoreItemPanels = initScoreItemPanels;