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;
}
});
+ $('.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;
+
+ });
+
});
<div class="notags">{% trans "no tags" %}</div>
{% endif %}
<ul>
-{% for tag in tags %}<li>{{ tag.value }} <a href="./?action=remove_tag&tag_id={{ tag.id }}&id={{ entry_id }}">✘</a></li>{% endfor %}
+{% for tag in tags %}<li><span class="alreadytagged">{{ tag.value }}</span> <a href="./?action=remove_tag&tag_id={{ tag.id }}&id={{ entry_id }}">✘</a></li>{% endfor %}
</ul>
<form method="post" action="./?action=add_tag">
<input type="hidden" name="entry_id" value="{{ entry_id }}" />
<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 %}