mirror of
https://github.com/wallabag/wallabag.git
synced 2025-01-05 22:38:41 +00:00
implement #1122
This commit is contained in:
parent
5e10eee8fc
commit
512ff18015
3 changed files with 19 additions and 1 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
|
|
@ -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&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 }}" />
|
||||
|
@ -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 %}
|
||||
|
|
Loading…
Reference in a new issue