Ajout des tags

This commit is contained in:
Rick 2020-10-20 13:02:13 +02:00
parent dc9d398409
commit 018dae05af
Signed by: Rick
GPG key ID: 9570A7DB7CB2F436
3 changed files with 24 additions and 2 deletions

9
app.py
View file

@ -59,12 +59,19 @@ def bizutage():
titre = Markup.escape(request.values["titre"])
desc = Markup.escape(request.values["desc"])
categorie = Markup.escape(request.values["categories"])
tagsList = request.values["tags"].split(';')
tags = []
for i in tagsList:
i.strip()
i = Markup.escape(i)
if i not in tags:
tags.append(i)
nouvLien = {"titre": titre,
"url": lien,
"desc": desc,
"categorie": categorie,
"tags": []
"tags": tags
}
ret = manip.ajoutLienJson(nouvLien)

View file

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="fr">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="/static/styles/base.css">
@ -25,13 +25,22 @@
<option value="musique">Musique</option>
<option value="autres" selected>Autre</option>
</select>
<label for="tags">Séparez vos tags avec ; </label>
<textarea name="tags" id="tag" cols="30" rows="10"></textarea>
<!-- <input type="text" name="tag" id="tag" placeholder="Tag">
<input type="button" onClick="addTag()" value="Ajouter tag"> -->
<input type="submit" value="Envoyer">
</form>
<!-- <div id="listTag">
</div> -->
{% if erreur %}
<p id="erreur">{{ erreur }}</p>
{% elif reussi %}
<p id="reussi">{{ reussi }}</p>
{% endif %}
<!-- <script src="/static/test.js"></script> -->
</body>
</html>

View file

@ -31,6 +31,12 @@
<p><a href="{{lien.url}}">{{lien.url}}</a></p>
<hr>
<p>{{lien.desc}}</p>
<p>Tags:</p>
<ul>
{% for tag in lien.tags %}
<li>{{tag}}</li>
{% endfor %}
</ul>
</div>
{% endfor %}
<footer>