bunch o things

This commit is contained in:
gauthiier
2019-12-26 12:46:45 +01:00
parent ef62052984
commit 9c8f5b0e5e
7 changed files with 299 additions and 44 deletions
-27
View File
@@ -26,31 +26,4 @@ $(document).ready(function(){
});
});
$('#new').click(function(e) {
var v = $(this).text();
console.log(v)
if(v == "NEW") {
var form = $(this).parent("form");
form.append('<input name="tag" type="text" id="edit-tag" value="...">');
form.append('<textarea name="desc" id="edit-desc">...</textarea>');
$(this).text("ADD");
} else if (v == "ADD") {
if($("#edit-tag").val() === "..." & $("#edit-desc").text() === "...") {
$(this).text("NEW");
$("#edit-tag").remove()
$("#edit-desc").remove()
return;
}
var form = $(this).parent("form");
var g = form.serialize() + "&action=new";
$.post('/tags', g, function(d) {
if(d === 'ok') {
location.reload();
}
});
$(this).text("NEW");
$("#edit-tag").remove()
$("#edit-desc").remove()
}
});
});
+2
View File
@@ -8,6 +8,8 @@
</head>
<body>
<h1>Selection [tags]</h1>
<h2><a href="/search" target="_blank">SEARCH</a></h2>
<h2><a href="/tags_w_lists" target="_blank">TAGS_W_LISTS</a></h2>
<form class="tag_item">
<button id="new">NEW</button>
</form>
+3 -1
View File
@@ -9,7 +9,9 @@
<body>
<h1>Selection [tags w lists]</h1>
<hr>
<button id="commit">commit</button>
<h2><a href="/search" target="_blank">SEARCH</a></h2>
<h2><a href="/tags" target="_blank">TAGS</a></h2>
<!-- <button id="commit">commit</button> -->
<div id="all">
{% for v in tags %}
<hr>