changeset 743:916075bd0356

server_side: display tags in static blogs
author souliane <souliane@mailoo.org>
date Sat, 21 Nov 2015 17:03:46 +0100
parents d123e27fc386
children 03ccd68a6dab
files src/server/blog.py themes/default/static_blog.html themes/default/styles/blog.css
diffstat 3 files changed, 36 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/server/blog.py	Sat Nov 21 14:34:36 2015 +0100
+++ b/src/server/blog.py	Sat Nov 21 17:03:46 2015 +0100
@@ -35,6 +35,7 @@
 import re
 import os
 
+from sat_frontends.quick_frontend import quick_blog
 from libervia.server.html_tools import sanitizeHtml, convertNewLinesToXHTML
 from libervia.server.constants import Const as C
 
@@ -468,6 +469,7 @@
             self.author = '&nbsp;'
             self.url = (u"%s/%s" % (base_url, entry['id']))
             self.title = self.getText(entry, 'title')
+            self.tags = quick_blog.mbdata2tags(entry)
 
             count_text = lambda count: D_('comments') if count > 1 else D_('comment')
 
--- a/themes/default/static_blog.html	Sat Nov 21 14:34:36 2015 +0100
+++ b/themes/default/static_blog.html	Sat Nov 21 17:03:46 2015 +0100
@@ -39,8 +39,15 @@
             </a>
         {% endif %}
         <span class="mblog_content">
-            {% if entry.message_title %}
-                <h1><a href="{{entry.url}}" class="item_link">{{entry.title}}</a></h1>
+            {% if entry.title %}
+                <h2><a href="{{entry.url}}" class="item_link">{{entry.title}}</a></h2>
+            {% endif %}
+            {% if entry.tags %}
+                <ul class="mblog_tags">
+                {% for tag in entry.tags %}
+                    <li><a>{{tag}}</a></li>
+                {% endfor %}
+                </ul>
             {% endif %}
             {{entry.content}}
         </span>
--- a/themes/default/styles/blog.css	Sat Nov 21 14:34:36 2015 +0100
+++ b/themes/default/styles/blog.css	Sat Nov 21 17:03:46 2015 +0100
@@ -116,6 +116,29 @@
     padding: 0px 0px 0px 18px;
 }
 
+/* START TAGS: styles are adapted from Dotclear */
+.mblog_tags {
+    background: #fbfbfb none repeat scroll 0% 0%;
+    padding: 5px;
+    margin: 8px 0px 0px;
+    overflow: hidden;
+}
+
+.mblog_tags li {
+    display: inline;
+    font-size: small;
+}
+
+.mblog_tags li a {
+    float: left;
+    padding: 2px 8px 2px 18px;
+    white-space: nowrap;
+    color: #005D99;
+    text-decoration: none;
+	background: transparent url("../images/blueSilence/tag.png") no-repeat scroll 0px 0px;
+}
+/* END TAGS */
+
 .mblog_content {
 	display: block;
 	padding-top: 5px;
@@ -174,7 +197,7 @@
 
 .mblog_entry h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {
     text-decoration: none;
-    color: rgb(51, 51, 51);
+    color: #666;
 }
 
 img {
@@ -187,4 +210,4 @@
     vertical-align: middle;
     margin-right: 10px;
     border-radius: 5px;
-}
\ No newline at end of file
+}