Procházet zdrojové kódy

Fix #52: not pretty, but good enough for now

George S. Baugh před 5 roky
rodič
revize
de9013b57a
2 změnil soubory, kde provedl 14 přidání a 1 odebrání
  1. 10 0
      www/scripts/post.js
  2. 4 1
      www/templates/tags.tx

+ 10 - 0
www/scripts/post.js

@@ -6,3 +6,13 @@ function switchMenu(obj) {
         el.style.display = '';
     }
 }
+
+function add2tags(id) {
+    var select = document.getElementById( id + '-tags');
+    var input  = document.getElementById( id + '-customtag');
+    var newOption = document.createElement('option');
+    newOption.value = input.value;
+    newOption.innerText = input.value;
+    newOption.selected = true;
+    select.appendChild(newOption);
+}

+ 4 - 1
www/templates/tags.tx

@@ -1,6 +1,9 @@
 Tags:<br />
-<select class="cooltext" multiple name="tags">
+<select class="cooltext" multiple name="tags" id="<: $post.id :>-tags" >
     : for $post.tags -> $tag {
         <option value="<: $tag :>" selected><: $tag :></option>
     : }
 </select>
+Add Custom Tag:<br />
+<input class="cooltext" type="text" id="<: $post.id :>-customtag" placeholder="MyTag" />
+<button style="float:right;" onclick="add2tags('<: $post.id :>'); return false;" class="coolbutton" >Add</button>