From fb75ee1c3abc9621766abf7f22d8b5ffd220d6f9 Mon Sep 17 00:00:00 2001
From: Thomas Rubini <74205383+ThomasRubini@users.noreply.github.com>
Date: Wed, 29 Mar 2023 09:53:57 +0200
Subject: [PATCH] Rename js admin functions
---
truthinquiry/static/js/admin.js | 18 +++++++-----------
truthinquiry/templates/admin/places.html | 4 ++--
truthinquiry/templates/admin/questions.html | 4 ++--
truthinquiry/templates/admin/traits.html | 4 ++--
4 files changed, 13 insertions(+), 17 deletions(-)
diff --git a/truthinquiry/static/js/admin.js b/truthinquiry/static/js/admin.js
index d8e30cb..4e4ac8d 100644
--- a/truthinquiry/static/js/admin.js
+++ b/truthinquiry/static/js/admin.js
@@ -1,18 +1,18 @@
//functions for places.html
-function addNewInputPlaces(){
+function addInputPlaces(){
let newPlace = places.lastElementChild.cloneNode(true);
newPlace.id = "";
newPlace.querySelector("input").value = "";
places.appendChild(newPlace);
}
-function deletePlace(buttonNode){
+function deleteInputPlaces(buttonNode){
let placeNode = buttonNode.parentNode;
placeNode.parentNode.removeChild(placeNode);
}
-function saveForm(){
+function saveFormPlaces(){
let data = [];
for(let section of places.querySelectorAll("section")){
let place = {};
@@ -27,7 +27,7 @@ function saveForm(){
//functions for traits.html
-function addNewInputTraits(){
+function addInputTraits(){
let newTrait = traits.lastElementChild.cloneNode(true);
newTrait.id = "";
newTrait.querySelector(".name_input").value = "";
@@ -35,7 +35,7 @@ function addNewInputTraits(){
traits.appendChild(newTrait);
}
-function deleteTrait(buttonNode){
+function deleteInputTraits(buttonNode){
let traitNode = buttonNode.parentNode;
traitNode.parentNode.removeChild(traitNode);
}
@@ -59,7 +59,7 @@ function saveFormTraits(){
-function addEntry(button){
+function addInputQuestions(button){
let questionTypeContent = button.parentNode.querySelector(".questionTypeContent");
let newQuestion = questionTypeContent.querySelector(".question").cloneNode(true);
newQuestion.id = "";
@@ -67,7 +67,7 @@ function addEntry(button){
questionTypeContent.appendChild(newQuestion);
}
-function deleteEntry(buttonNode){
+function deleteInputQuestions(buttonNode){
let placeNode = buttonNode.parentNode;
placeNode.parentNode.removeChild(placeNode);
}
@@ -88,10 +88,6 @@ function saveFormQuestions(){
makeAPIRequest("admin/setQuestions", {"questions": data, "lang": "FR"}, {"content": "json"})
}
-function changeLang(){
-
-}
-
//functions for npc.html
function saveFormNpc(){
diff --git a/truthinquiry/templates/admin/places.html b/truthinquiry/templates/admin/places.html
index 8b8d648..2b091b9 100644
--- a/truthinquiry/templates/admin/places.html
+++ b/truthinquiry/templates/admin/places.html
@@ -15,11 +15,11 @@
{%for place in places%}
{%endfor%}
-
+