changeset 763:7390cba0bb44

browser_side: display tags with nice icons like for the static blog
author souliane <souliane@mailoo.org>
date Wed, 25 Nov 2015 00:22:41 +0100
parents 8eeb98659de2
children b392ea1514ee
files src/browser/public/libervia.css src/browser/sat_browser/richtext.py themes/default/styles/blog.css
diffstat 3 files changed, 35 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/browser/public/libervia.css	Tue Nov 24 23:28:55 2015 +0100
+++ b/src/browser/public/libervia.css	Wed Nov 25 00:22:41 2015 +0100
@@ -956,6 +956,31 @@
     left: -20px;
 }
 
+/* START TAGS: styles are adapted from Dotclear */
+.mblog_tags {
+    background: #fbfbfb none repeat scroll 0% 0%;
+    padding: 5px;
+    margin: 8px 0px 0px;
+    overflow: hidden;
+    border-radius: 5px;
+}
+
+.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("../themes/default/images/blueSilence/tag.png") no-repeat scroll 0px 0px;
+}
+/* END TAGS */
+
+
 /* Chat & MUC Room */
 
 .chatPanel {
--- a/src/browser/sat_browser/richtext.py	Tue Nov 24 23:28:55 2015 +0100
+++ b/src/browser/sat_browser/richtext.py	Wed Nov 25 00:22:41 2015 +0100
@@ -323,11 +323,15 @@
         content = self._original_content
         text = content['text']
         if 'title' in content and content['title']:
-            text = '<h1>%s</h1>%s' % (html_tools.html_sanitize(content['title']), text)
-        tags = list(common.dict2iter('tag', content))
-        if tags: # FIXME: display it more beautiful
-            text = '%s<h3>%s %s</h3>' % (text, _("Tags:"), html_tools.html_sanitize(", ".join(tags)))
-        self.display.setContent({'text': text})
+            title = '<h1>%s</h1>' % html_tools.html_sanitize(content['title'])
+
+        tags = ""
+        for tag in common.dict2iter('tag', content):
+            tags += "<li><a>%s</a></li>" % html_tools.html_sanitize(tag)
+        if tags:
+            tags = '<ul class="mblog_tags">%s</ul>' % tags
+
+        self.display.setContent({'text': "%s%s%s" % (title, tags, text)})
 
     def setFocus(self, focus):
         self.textarea.setFocus(focus)
--- a/themes/default/styles/blog.css	Tue Nov 24 23:28:55 2015 +0100
+++ b/themes/default/styles/blog.css	Wed Nov 25 00:22:41 2015 +0100
@@ -135,7 +135,7 @@
     white-space: nowrap;
     color: #005D99;
     text-decoration: none;
-	background: transparent url("../images/blueSilence/tag.png") no-repeat scroll 0px 0px;
+    background: transparent url("../images/blueSilence/tag.png") no-repeat scroll 0px 0px;
 }
 /* END TAGS */