[add] edit tags page

This commit is contained in:
Nicolas Lœuillet 2013-12-06 14:03:14 +01:00
parent 2e2ebe5ec7
commit 6cab59c340
4 changed files with 29 additions and 1 deletions

View File

@ -430,6 +430,13 @@ class Poche
);
Tools::logm('config view');
break;
case 'edit-tags':
# tags
$tags = $this->store->retrieveTagsByEntry($id);
$tpl_vars = array(
'tags' => $tags,
);
break;
case 'tags':
$tags = $this->store->retrieveAllTags();
$tpl_vars = array(

View File

@ -106,6 +106,9 @@ class Tools
case 'tags':
$tpl_file = 'tags.twig';
break;
case 'edit-tags':
$tpl_file = 'edit-tags.twig';
break;
case 'view':
$tpl_file = 'view.twig';
break;

View File

@ -0,0 +1,18 @@
{% extends "layout.twig" %}
{% block title %}edit tags{% endblock %}
{% block menu %}
{% include '_menu.twig' %}
{% endblock %}
{% block content %}
{% if tags is empty %}
no tags
{% endif %}
<ul>
{% for tag in tags %}<li>{{ tag.value }} <a href="#">✘</a></li>{% endfor %}
</ul>
<form method="post" action="#">
<label for="value">New tags: </label><input type="text" id="value" name="value" required="required" />
{% trans "you can type several tags, separated by comma" %}<br />
<input type="submit" value="add tags" />
</form>
{% endblock %}

View File

@ -21,7 +21,7 @@
<h1>{{ entry.title|raw }}</h1>
</header>
<aside class="tags">
tags: {% for tag in tags %}<a href="#">{{ tag.value }}</a> {% endfor %}<a href="#" title="{% trans "edit tags" %}">✎</a>
tags: {% for tag in tags %}<a href="#">{{ tag.value }}</a> {% endfor %}<a href="./?&amp;view=edit-tags&amp;id={{ entry.id|e }}" title="{% trans "edit tags" %}">✎</a>
</aside>
<article>
{{ content | raw }}