Эх сурвалжийг харах

fix #181, add ability to do custom aliases

George S. Baugh 4 жил өмнө
parent
commit
318eb4d3c5

+ 1 - 0
bin/migrate2.pl

@@ -19,6 +19,7 @@ use Trog::SQLite::TagIndex;
 
 # Kill the post index
 unlink "$FindBin::Bin/../data/posts.db";
+$ENV{NOHUP} = 1;
 
 sub uuid { return UUID::Tiny::create_uuid_as_string(UUID::Tiny::UUID_V1, UUID::Tiny::UUID_NS_DNS); }
 

+ 1 - 1
lib/Trog/DataModule.pm

@@ -259,7 +259,7 @@ sub add ($self, @posts) {
     $self->write(\@to_write);
 
     #hup the parent to refresh the routing table IFF we aren't in an interactive session, such as migrate.pl
-    if (!$ENV{PS1}) {
+    if (!$ENV{NOHUP}) {
         my $parent = getppid;
         kill 'HUP', $parent;
     }

+ 11 - 0
www/scripts/post.js

@@ -17,3 +17,14 @@ function add2tags(id) {
     select.appendChild(newOption);
     input.value= '';
 }
+
+function add2aliases(id) {
+    var select = document.getElementById( id + '-alias');
+    var input  = document.getElementById( id + '-customalias');
+    var newOption = document.createElement('option');
+    newOption.value = input.value;
+    newOption.innerText = input.value;
+    newOption.selected = true;
+    select.appendChild(newOption);
+    input.value= '';
+}

+ 10 - 0
www/templates/form_common.tx

@@ -1,3 +1,13 @@
+Post Alias URLs:<br />
+<select class="cooltext" multiple name="aliases" id="<: $post.id :>-alias" >
+    : for $post.aliases -> $alias {
+        <option value="<: $alias :>" selected><: $alias :></option>
+    : }
+</select>
+Add Post Alias:<br />
+<input class="cooltext" type="text" id="<: $post.id :>-customalias" placeholder="/tickle" />
+<button style="float:right;" onclick="add2aliases('<: $post.id :>'); return false;" class="coolbutton" >Add</button>
+
 Content <button class="coolbutton emojiPicker">😎</button>:
 <br /><textarea class="cooltext" name="data" placeholder="Potzrebie"><: $post.data :></textarea>
 <input type="hidden" name="app" value="<: $app :>" />