Merge pull request #103 from ThomasRubini/trait_delete
This commit is contained in:
commit
d90987ca39
@ -108,7 +108,7 @@ def set_traits():
|
|||||||
# delete
|
# delete
|
||||||
for db_trait in db_traits:
|
for db_trait in db_traits:
|
||||||
if db_trait not in modified_db_traits:
|
if db_trait not in modified_db_traits:
|
||||||
db.session.remove()
|
db.session.delete(db_trait)
|
||||||
|
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
<input class="name_input" value="{{trait['name']}}">
|
<input class="name_input" value="{{trait['name']}}">
|
||||||
<p> Description: </p>
|
<p> Description: </p>
|
||||||
<input class="desc_input" value="{{trait['desc']}}">
|
<input class="desc_input" value="{{trait['desc']}}">
|
||||||
|
<button onclick="deleteTrait(this)">Delete trait</button>
|
||||||
</section>
|
</section>
|
||||||
{%endfor%}
|
{%endfor%}
|
||||||
</section>
|
</section>
|
||||||
@ -26,6 +27,11 @@ function addNewInput(){
|
|||||||
traits.appendChild(newTrait);
|
traits.appendChild(newTrait);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function deleteTrait(buttonNode){
|
||||||
|
let traitNode = buttonNode.parentNode;
|
||||||
|
traitNode.parentNode.removeChild(traitNode);
|
||||||
|
}
|
||||||
|
|
||||||
function saveForm(){
|
function saveForm(){
|
||||||
let data = [];
|
let data = [];
|
||||||
for(let section of traits.querySelectorAll("section")){
|
for(let section of traits.querySelectorAll("section")){
|
||||||
|
Loading…
Reference in New Issue
Block a user