This commit is contained in:
Thomas Citharel 2015-03-08 02:36:37 +01:00
parent 5e10eee8fc
commit 512ff18015
3 changed files with 19 additions and 1 deletions

View file

@ -465,9 +465,11 @@ class Poche
Tools::redirect();
}
$tags = $this->store->retrieveTagsByEntry($id);
$all_tags = $this->store->retrieveAllTags($this->user->getId());
$tpl_vars = array(
'entry_id' => $id,
'tags' => $tags,
'alltags' => $all_tags,
'entry' => $entry,
);
break;

View file

@ -43,5 +43,19 @@ jQuery(function($) {
}
});
$('.suggestedtag').click(function(){
var input = $("#value");
var value = input.val();
var tag = $(this).text();
var terms = value.split(','); // tags into the <input>
if (jQuery.inArray(tag, terms) == -1 ) { // if the tag hasn't already been added
value += tag + ",";
input.val(value);
}
input.focus();
input[0].selectionStart = input[0].selectionEnd = input.val().length;
});
});

View file

@ -16,7 +16,7 @@
<div class="notags">{% trans "no tags" %}</div>
{% endif %}
<ul>
{% for tag in tags %}<li>{{ tag.value }} <a href="./?action=remove_tag&amp;tag_id={{ tag.id }}&amp;id={{ entry_id }}">✘</a></li>{% endfor %}
{% for tag in tags %}<li><span class="alreadytagged">{{ tag.value }}</span> <a href="./?action=remove_tag&amp;tag_id={{ tag.id }}&amp;id={{ entry_id }}">✘</a></li>{% endfor %}
</ul>
<form method="post" action="./?action=add_tag">
<input type="hidden" name="entry_id" value="{{ entry_id }}" />
@ -25,5 +25,7 @@
<p>{% trans "Start typing for auto complete." %}<br>
{% trans "You can enter multiple tags, separated by commas." %}</p>
</form>
All existing tags :
<ul>{% for eachtag in alltags %}<li class="suggestedtag" style="display: inline-block; margin:10px;">{{ eachtag.value }}</li>{% endfor %}</ul>
<a class="icon icon-reply return" href="./?view=view&id={{ entry_id }}">{% trans "return to article" %}</a>
{% endblock %}