George S. Baugh 4 rokov pred
rodič
commit
49e0a5c86f

+ 15 - 5
lib/Trog/Routes/HTML.pm

@@ -813,8 +813,10 @@ sub posts ($query, $render_cb, $direct=0) {
         @posts = ($query->{user_obj});
         $user_visibility = $query->{user_obj}->{visibility};
     } else {
-        my @me = _post_helper({ author => $query->{user} }, ['about'], $query->{acls});
-        $user_visibility = $me[0]->{visibility};
+        if ($query->{user}) {
+            my @me = _post_helper({ author => $query->{user} }, ['about'], $query->{acls});
+            $user_visibility = $me[0]->{visibility};
+        }
         @posts = _post_helper($query, $tags, $query->{acls});
     }
 
@@ -827,7 +829,7 @@ sub posts ($query, $render_cb, $direct=0) {
         my $user = shift(@posts);
         my $id = delete $query->{id};
         $query->{author} = $user->{user};
-        @posts = _post_helper($query, [], $query->{acls});
+        @posts = _post_helper($query, $tags, $query->{acls});
         @posts = grep { $_->{id} ne $id } @posts;
         unshift @posts, $user;
     }
@@ -938,9 +940,17 @@ sub posts ($query, $render_cb, $direct=0) {
     state $data = Trog::Data->new($conf);
     my @tags_all = $data->tags();
     #Filter out the visibilities and special series tags
-    @tags_all = grep { my $subj = $_; scalar(grep { $_ eq $subj } qw{public private unlisted admin series about}) == 0 } @tags_all;
+    @tags_all = grep { my $subj = $_; scalar(grep { $_ eq $subj } qw{public private unlisted admin series about topbar}) == 0 } @tags_all;
 
-    @posts = map { my @et = List::MoreUtils::singleton(@{$_->{tags}}, @tags_all); $_->{extra_tags} = \@et; $_ } @posts;
+    use Data::Dumper;
+    print Dumper(\@tags_all);
+
+    @posts = map {
+        my $subject = $_;
+        my @et = grep { my $subj = $_; grep { $subj eq $_ } @tags_all } @{$subject->{tags}};
+        $_->{extra_tags} = \@et;
+        $_
+    } @posts;
     my @et = List::MoreUtils::singleton(@$tags, @tags_all);
 
     my $content = $processor->render('posts.tx', {

+ 17 - 0
www/styles/screen.css

@@ -356,6 +356,7 @@ p.posteditortitle {
     background-repeat: no-repeat;
     background-position: center;
     background-size: contain;
+    margin-top: .5rem;
 }
 
 .profile {
@@ -431,3 +432,19 @@ pre {
     border-style: solid;
     border-color: #400 #700 #700 #400;
 }
+
+a.tag {
+    margin: .25rem 0rem .25rem 0rem;
+    padding: 0rem .5rem 0rem .5rem;
+    border-radius: 1rem;
+    background: #e4e4e4;
+    border-width: 1px;
+    border-style: solid;
+    border-color: grey;
+    text-decoration: none;
+    text-shadow 0 0 2px grey;
+}
+
+.postData {
+    margin-top: .5rem;
+}

+ 2 - 1
www/templates/forms/blog.tx

@@ -1,12 +1,13 @@
 <div class="post <: $style :>">
     :if ( !$post.addpost ) {
         : include "post_title.tx";
+        : include "post_tags.tx";
 
         : if ( !$post.video_href && !$post.is_image && !$post.is_video && !$post.is_profile && $post.preview ) {
             <div style="background-image:url(<: $post.preview :>);" class="responsive preview"></div>
         : }
 
-        <div id="postData-<: $post.id :>">
+        <div class="postData" id="postData-<: $post.id :>">
             <: render_it($post.data) | mark_raw  :>
         </div>
     : }

+ 3 - 2
www/templates/forms/file.tx

@@ -13,6 +13,7 @@
         </a>
     : } else {
         : include "post_title.tx";
+        : include "post_tags.tx";
 
         : if ( $post.is_video ) {
             <video preload="none" class="responsive" controls poster="<: $post.preview :>" >
@@ -34,9 +35,9 @@
 
         : if( $post.data ) {
             : if ($post.is_video || $post.is_image) {
-                <div id="postData" class="responsive-text">
+                <div class="postData" id="postData" class="responsive-text">
             : } else {
-                <div id="postData">
+                <div class="postData" id="postData">
             : }
             : if ( $style != 'media' ) {
                 <: render_it($post.data) | mark_raw  :>

+ 2 - 1
www/templates/forms/microblog.tx

@@ -2,6 +2,7 @@
 
     :if ( !$post.addpost ) {
         : include "post_title.tx";
+        : include "post_tags.tx";
 
         : if ( !$post.video_href && !$post.is_image && !$post.is_video && !$post.is_profile && $post.preview ) {
             <div style="background-image:url(<: $post.preview :>);" class="responsive preview"></div>
@@ -20,7 +21,7 @@
         : }
 
         : if ( !!$post.data ) {
-            <div id="postData-<: $post.id :>">
+            <div class="postData" id="postData-<: $post.id :>">
                 <: render_it($post.data) | mark_raw  :>
             </div>
         : }

+ 2 - 1
www/templates/forms/series.tx

@@ -13,13 +13,14 @@
         </a>
     : } else {
         : include "post_title.tx";
+        : include "post_tags.tx";
 
         : if ( !$post.video_href && !$post.is_image && !$post.is_video && !$post.is_profile && $post.preview ) {
             <div style="background-image:url(<: $post.preview :>);" class="responsive preview"></div>
         : }
 
         : if( $post.data ) {
-            <div id="postData">
+            <div class="postData" id="postData">
                 <: render_it($post.data) | mark_raw  :>
             </div>
         : }

+ 5 - 0
www/templates/post_tags.tx

@@ -0,0 +1,5 @@
+<span id="<: $post.id :>-tags">
+: for $post.extra_tags -> $tag {
+    <a href="?tag=<: $tag :>" class="tag"><: $tag :></a>
+: }
+</span>