[fix] css for blog and set context.path = request.path if available
This commit is contained in:
parent
4f93c976a7
commit
8bf6151dd9
7 changed files with 43 additions and 38 deletions
|
|
@ -589,6 +589,7 @@ fieldset {
|
|||
}
|
||||
.blog-category {
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
font-size: 12px;
|
||||
text-align: center;
|
||||
margin-bottom: 20px;
|
||||
|
|
@ -600,7 +601,7 @@ fieldset {
|
|||
}
|
||||
.blog-comments,
|
||||
.help-article-comments {
|
||||
padding: 5px 15px 15px 70px;
|
||||
padding: 0px 15px 15px 85px;
|
||||
}
|
||||
.comment-view {
|
||||
background-color: #fafbfc;
|
||||
|
|
@ -846,6 +847,7 @@ body {
|
|||
display: inline-block;
|
||||
padding-bottom: 4px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.sidebar-block,
|
||||
|
|
@ -855,6 +857,7 @@ body {
|
|||
}
|
||||
.content-block {
|
||||
padding-left: 50px;
|
||||
padding-right: 50px;
|
||||
}
|
||||
.content-header {
|
||||
padding-bottom: 20px;
|
||||
|
|
@ -867,7 +870,7 @@ a:active {
|
|||
}
|
||||
.blog-header {
|
||||
font-size: 36px;
|
||||
margin-bottom: 20px;
|
||||
margin-left: -1px;
|
||||
}
|
||||
.blog-dot:before {
|
||||
padding-right: 8px;
|
||||
|
|
@ -879,14 +882,12 @@ a:active {
|
|||
margin-bottom: 25px;
|
||||
border: none;
|
||||
}
|
||||
.post-description {
|
||||
margin-top: 0px;
|
||||
}
|
||||
.post-by {
|
||||
margin-top: 4px;
|
||||
margin-top: -5px;
|
||||
margin-bottom: 4px;
|
||||
text-transform: uppercase;
|
||||
font-size: 12px;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
li .footer-child-item {
|
||||
margin-bottom: 4px !important;
|
||||
|
|
@ -899,7 +900,6 @@ li .social-child-item {
|
|||
margin-top: 30px;
|
||||
}
|
||||
.blog-text {
|
||||
text-align: justify;
|
||||
padding-top: 50px;
|
||||
padding-bottom: 50px;
|
||||
font-size: 18px;
|
||||
|
|
|
|||
|
|
@ -251,7 +251,6 @@ fieldset {
|
|||
|
||||
h1, h2, h3 {
|
||||
margin-top: 10px;
|
||||
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
|
|
@ -286,6 +285,7 @@ fieldset {
|
|||
|
||||
.blog-category {
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
font-size: 12px;
|
||||
text-align: center;
|
||||
margin-bottom: 20px;
|
||||
|
|
@ -299,7 +299,7 @@ fieldset {
|
|||
|
||||
.blog-comments,
|
||||
.help-article-comments {
|
||||
padding: 5px 15px 15px 70px;
|
||||
padding: 0px 15px 15px 85px;
|
||||
}
|
||||
.comment-view {
|
||||
background-color: #fafbfc;
|
||||
|
|
@ -439,20 +439,22 @@ a.active {
|
|||
margin-top: 60px;
|
||||
}
|
||||
|
||||
.footer-group-label{
|
||||
.footer-group-label {
|
||||
display:inline-block;
|
||||
padding-bottom: 4px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.sidebar-block, .content-block {
|
||||
padding-top:50px;
|
||||
padding-bottom:50px;
|
||||
padding-top: 50px;
|
||||
padding-bottom: 50px;
|
||||
}
|
||||
|
||||
.content-block {
|
||||
padding-left: 50px;
|
||||
padding-right: 50px;
|
||||
}
|
||||
|
||||
.content-header {
|
||||
|
|
@ -464,9 +466,9 @@ a:hover, a:visited, a:link, a:active
|
|||
text-decoration: none;
|
||||
}
|
||||
|
||||
.blog-header{
|
||||
font-size:36px;
|
||||
margin-bottom: 20px;
|
||||
.blog-header {
|
||||
font-size: 36px;
|
||||
margin-left: -1px;
|
||||
}
|
||||
|
||||
.blog-dot:before{
|
||||
|
|
@ -481,15 +483,12 @@ a:hover, a:visited, a:link, a:active
|
|||
border:none;
|
||||
}
|
||||
|
||||
.post-description{
|
||||
margin-top:0px;
|
||||
}
|
||||
|
||||
.post-by {
|
||||
margin-top:4px;
|
||||
margin-bottom:4px;
|
||||
margin-top: -5px;
|
||||
margin-bottom: 4px;
|
||||
text-transform: uppercase;
|
||||
font-size: 12px;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
li .footer-child-item {
|
||||
|
|
@ -506,7 +505,6 @@ li .social-child-item {
|
|||
}
|
||||
|
||||
.blog-text {
|
||||
text-align:justify;
|
||||
padding-top: 50px;
|
||||
padding-bottom: 50px;
|
||||
font-size: 18px;
|
||||
|
|
@ -534,4 +532,4 @@ li .social-child-item {
|
|||
.vert-line {overflow:hidden;}
|
||||
.vert-line>div+div{border-left:1px solid @light-border-color;}
|
||||
.vert-line>div{
|
||||
padding-bottom:2000px; margin-bottom:-2000px;}
|
||||
padding-bottom:2000px; margin-bottom:-2000px;}
|
||||
|
|
|
|||
|
|
@ -7,9 +7,7 @@
|
|||
<!-- begin blog content -->
|
||||
<div class="blog-info">
|
||||
<div class="text-muted blog-category">{{blog_category}}</div>
|
||||
<div class="blog-header">
|
||||
{{ title }}
|
||||
</div>
|
||||
<h1 class="blog-header">{{ title }}</h1>
|
||||
<p class="post-by text-muted"><a href="/blog?by={{ blogger }}&by_name={{ full_name }}" class="no-decoration">
|
||||
BY {{ blogger_info and blogger_info.full_name or full_name }}</a> <i class="blog-dot"></i> {{ frappe.format_date(published_on) }} <i class="blog-dot"></i>{{ comment_text }}</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<div class="web-list-item blog-list-item">
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="blog-header"><a href="/{{ post.page_name }}">{{ post.title }}</a></div>
|
||||
<h1 class="blog-header"><a href="/{{ post.page_name }}">{{ post.title }}</a></h1>
|
||||
<p class="post-by text-muted"><a href="/blog?by={{ post.blogger }}&by_name={{ post.full_name }}" class="no-decoration">
|
||||
BY {{ post.full_name }}</a> <i class="blog-dot"></i> {{ frappe.format_date(post.published_on) }} <i class="blog-dot"></i> <a href="/{{ post.parent_website_route }}" class="no-decoration">{{ post.blog_category }}</a> <i class="blog-dot"></i> {{ post.comment_text }}</p>
|
||||
<p class="post-description">{{ post.content }}</p>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<div class="blogger">
|
||||
<div class="inline-block" style="vertical-align: top">
|
||||
<div class="avatar avatar-large" style="margin-top: 10px;">
|
||||
<div class="avatar avatar-large">
|
||||
<img itemprop="thumbnailUrl" src="{{ blogger_info.avatar }}" />
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -125,22 +125,25 @@ def has_gravatar(email):
|
|||
or frappe.flags.in_test):
|
||||
# no gravatar if via upload
|
||||
# since querying gravatar for every item will be slow
|
||||
return
|
||||
return ''
|
||||
|
||||
gravatar_url = "https://secure.gravatar.com/avatar/{hash}?d=404&s=200".format(hash=md5.md5(email).hexdigest())
|
||||
try:
|
||||
res = requests.get(gravatar_url)
|
||||
if res.status_code==404:
|
||||
return ''
|
||||
else:
|
||||
if res.status_code==200:
|
||||
return gravatar_url
|
||||
else:
|
||||
return ''
|
||||
except requests.exceptions.ConnectionError:
|
||||
return ''
|
||||
|
||||
def get_gravatar(email):
|
||||
gravatar_url = has_gravatar(email)
|
||||
|
||||
if not gravatar_url:
|
||||
return Identicon(email).base64()
|
||||
gravatar_url = Identicon(email).base64()
|
||||
|
||||
return gravatar_url
|
||||
|
||||
def get_traceback():
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -14,7 +14,13 @@ def get_context(path, args=None):
|
|||
context.update(args)
|
||||
|
||||
context = build_context(context)
|
||||
context["path"] = path
|
||||
|
||||
if frappe.local.request:
|
||||
# for <body data-path=""> (remove leading slash)
|
||||
# path could be overriden in render.resolve_from_map
|
||||
context["path"] = frappe.local.request.path[1:]
|
||||
else:
|
||||
context["path"] = path
|
||||
|
||||
# set using frappe.respond_as_web_page
|
||||
if hasattr(frappe.local, 'response') and frappe.local.response.get('context'):
|
||||
|
|
@ -76,19 +82,19 @@ def build_context(context):
|
|||
|
||||
def add_sidebar_data(context):
|
||||
from frappe.utils.user import get_fullname_and_avatar
|
||||
|
||||
|
||||
context.my_account_list = frappe.get_all('Portal Menu Item',
|
||||
fields=['title', 'route', 'reference_doctype'], filters={'enabled': 1}, order_by='idx asc')
|
||||
|
||||
for item in context.my_account_list:
|
||||
if item.reference_doctype:
|
||||
item.count = len(frappe.templates.pages.list.get(item.reference_doctype).get('result'))
|
||||
|
||||
|
||||
|
||||
|
||||
info = get_fullname_and_avatar(frappe.session.user)
|
||||
context["fullname"] = info.fullname
|
||||
context["user_image"] = info.avatar
|
||||
|
||||
|
||||
|
||||
def add_metatags(context):
|
||||
tags = context.get("metatags")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue