Rename js admin functions
This commit is contained in:
		
							parent
							
								
									42ce1e575c
								
							
						
					
					
						commit
						fb75ee1c3a
					
				| @ -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(){ | ||||
|  | ||||
| @ -15,11 +15,11 @@ | ||||
|         {%for place in places%} | ||||
|             <section id="{{place['id']}}"> | ||||
|                 <input value="{{place['name']}}"> | ||||
|                 <button onclick="deletePlace(this)">Delete place</button> | ||||
|                 <button onclick="deleteInputPlaces(this)">Delete place</button> | ||||
|             </section> | ||||
|         {%endfor%} | ||||
|         </section> | ||||
|         <button onclick="addNewInputPlaces()">Add new</button> | ||||
|         <button onclick="addInputPlaces()">Add new</button> | ||||
|         <button onclick="saveFormPlaces()">Save changes</button> | ||||
| 
 | ||||
|     </body> | ||||
|  | ||||
| @ -18,11 +18,11 @@ | ||||
|                     {%for question in questionType["questions"]%} | ||||
|                     <section class="question"> | ||||
|                         <input value="{{question['text']}}"> | ||||
|                         <button onclick="deleteEntry(this)">Delete question</button> | ||||
|                         <button onclick="deleteInputQuestions(this)">Delete question</button> | ||||
|                     </section> | ||||
|                     {%endfor%} | ||||
|                 </section> | ||||
|                 <button onclick="addEntry(this)">Add new</button> | ||||
|                 <button onclick="addInputQuestions(this)">Add new</button> | ||||
|             </div> | ||||
|             {%endfor%} | ||||
|         </section> | ||||
|  | ||||
| @ -17,11 +17,11 @@ | ||||
|                 <input class="name_input" value="{{trait['name']}}"> | ||||
|                 <p> Description: </p> | ||||
|                 <input class="desc_input" value="{{trait['desc']}}"> | ||||
|                 <button onclick="deleteTrait(this)">Delete trait</button> | ||||
|                 <button onclick="deleteInputTraits(this)">Delete trait</button> | ||||
|             </section> | ||||
|             {%endfor%} | ||||
|         </section> | ||||
|         <button onclick="addNewInputTraits()">Add new</button> | ||||
|         <button onclick="addInputTraits()">Add new</button> | ||||
|         <button onclick="saveFormTraits()">Save changes</button> | ||||
| 
 | ||||
|         <p>Images are viewable in the npc views</p> | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user