Mercurial > libervia-web
comparison src/pages/common/blog/page_meta.py @ 1029:78b7b5ec7ca1
pages (common/blog): if background is set in user preferences, use it
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 22 Jan 2018 08:53:06 +0100 |
parents | 38cfee0eed48 |
children | f5661761b1b9 |
comparison
equal
deleted
inserted
replaced
1028:ad97d7e7de3b | 1029:78b7b5ec7ca1 |
---|---|
5 from twisted.internet import defer | 5 from twisted.internet import defer |
6 from sat.tools.common import data_objects | 6 from sat.tools.common import data_objects |
7 from libervia.server import session_iface | 7 from libervia.server import session_iface |
8 from sat.core.i18n import _ | 8 from sat.core.i18n import _ |
9 from sat.core.log import getLogger | 9 from sat.core.log import getLogger |
10 from sat.tools.common.template import safe | |
10 import urllib | 11 import urllib |
12 import cgi | |
11 log = getLogger('pages/common/blog') | 13 log = getLogger('pages/common/blog') |
12 | 14 |
13 """generic blog (with service/node provided)""" | 15 """generic blog (with service/node provided)""" |
14 name = u'blog' | 16 name = u'blog' |
15 template = u"blog/articles.html" | 17 template = u"blog/articles.html" |
186 items_http_uri[item.id] = self.host.getExtBaseURL(request, blog_view.getURL(service_s, node or '@', u'id', item.id)) | 188 items_http_uri[item.id] = self.host.getExtBaseURL(request, blog_view.getURL(service_s, node or '@', u'id', item.id)) |
187 for tag in item.tags: | 189 for tag in item.tags: |
188 if tag not in tags_http_uri: | 190 if tag not in tags_http_uri: |
189 tags_http_uri[tag] = self.host.getExtBaseURL(request, blog_view.getURL(service_s, node or '@', u'tag', tag)) | 191 tags_http_uri[tag] = self.host.getExtBaseURL(request, blog_view.getURL(service_s, node or '@', u'tag', tag)) |
190 template_data[u'allow_commenting'] = data.get(u'allow_commenting', False) | 192 template_data[u'allow_commenting'] = data.get(u'allow_commenting', False) |
193 if u'target_profile' in template_data: | |
194 bg_img = yield self.host.bridgeCall(u'asyncGetParamA', u'Background', u'Blog page', u'value', -1, template_data[u'target_profile']) | |
195 if bg_img: | |
196 template_data['dynamic_style'] = safe(u""" | |
197 :root { | |
198 --bg-img: url("%s"); | |
199 } | |
200 """ % cgi.escape(bg_img, True)) | |
191 | 201 |
192 | 202 |
193 @defer.inlineCallbacks | 203 @defer.inlineCallbacks |
194 def on_data_post(self, request): | 204 def on_data_post(self, request): |
195 profile = self.getProfile(request) | 205 profile = self.getProfile(request) |