]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
implement #1122 1.9.1alpha1
authorThomas Citharel <tcit@tcit.fr>
Sun, 8 Mar 2015 01:36:37 +0000 (02:36 +0100)
committerThomas Citharel <tcit@tcit.fr>
Sun, 8 Mar 2015 01:36:37 +0000 (02:36 +0100)
inc/poche/Poche.class.php
themes/_global/js/autoCompleteTags.js
themes/baggy/edit-tags.twig

index c6c91c4a631e2622b783f922af56d135ab0438ed..bf323c49ce3c98f901ee8f7ca9c034ad67fc6f6f 100755 (executable)
@@ -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;
index 90bc982c2080ed61fe42e92b7707dd1f70d3231c..986e71d15a22d236609b047b64ad0e7b1e1b1aa8 100755 (executable)
@@ -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;
+
+  });
+
 
 });
index 15f15560fa52941268203eee7b5cafbbb833d451..ae6684f2a00170d9d71d2a58105d3168e1794cb4 100755 (executable)
@@ -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 %}