Skip to content

Commit

Permalink
Merge branch 'staging' into production
Browse files Browse the repository at this point in the history
  • Loading branch information
sahil28297 committed Aug 18, 2021
2 parents 10d1ce9 + df14800 commit 3a29e33
Show file tree
Hide file tree
Showing 15 changed files with 325 additions and 166 deletions.
2 changes: 1 addition & 1 deletion frappe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
sys.setdefaultencoding("utf-8")

__frappe_version__ = '12.8.1'
__version__ = '2.5.0'
__version__ = '2.6.0'
__title__ = "Frappe Framework"

local = Local()
Expand Down
10 changes: 9 additions & 1 deletion frappe/desk/doctype/dashboard_chart/dashboard_chart.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"group_by_based_on",
"aggregate_function_based_on",
"number_of_groups",
"show_others",
"column_break_6",
"is_public",
"heatmap_year",
Expand Down Expand Up @@ -297,9 +298,16 @@
"fieldname": "or_filters_section",
"fieldtype": "Section Break",
"label": "OR Filters Section"
},
{
"default": "0",
"depends_on": "eval:doc.number_of_groups >0",
"fieldname": "show_others",
"fieldtype": "Check",
"label": "Show Others"
}
],
"modified": "2021-07-04 23:21:32.844514",
"modified": "2021-08-18 00:56:32.023290",
"modified_by": "Administrator",
"module": "Desk",
"name": "Dashboard Chart",
Expand Down
16 changes: 11 additions & 5 deletions frappe/desk/doctype/dashboard_chart/dashboard_chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,9 @@ def get_group_by_chart_config(chart, filters, or_filters):
group_by_field = chart.group_by_based_on
doctype = chart.document_type

# don't include documents where Group By Based On has Null values
filters.append([doctype, group_by_field, "!=", ""])

data = frappe.db.get_list(
doctype,
fields = [
Expand All @@ -305,11 +308,14 @@ def get_group_by_chart_config(chart, filters, or_filters):

if data:
if chart.number_of_groups and chart.number_of_groups < len(data):
other_count = 0
for i in range(chart.number_of_groups - 1, len(data)):
other_count += data[i]['count']
data = data[0: chart.number_of_groups - 1]
data.append({'name': 'Other', 'count': other_count})
if chart.number_of_groups > 0 and chart.show_others:
other_count = 0
for i in range(chart.number_of_groups - 1, len(data)):
other_count += data[i]['count']
data = data[0: chart.number_of_groups - 1]
data.append({'name': 'Other', 'count': other_count})
else:
data = data[0: chart.number_of_groups]

chart_config = {
"labels": [item['name'] if item['name'] else 'Not Specified' for item in data],
Expand Down
3 changes: 1 addition & 2 deletions frappe/public/build.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"css/frappe-web-b4.css": [
"public/scss/website.scss",
"public/less/indicator.less",
"website/css/blog.css"
"public/less/indicator.less"
],
"css/frappe-chat-web.css": [
"public/css/font-awesome.css",
Expand Down
90 changes: 90 additions & 0 deletions frappe/public/css/blog.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
body[data-path="blog"] .page-header,
body[data-path="blog"] .page-breadcrumbs,
body[data-path="blog"] .page_content > p {
display: none;
}

.container.my-5 {
margin-top: 0 !important; /* csslint allow: known-properties, important */
}

.result {
display: flex;
flex-wrap: wrap;
margin-bottom: 3.75rem;
}

.website-list .result {
border-bottom: 0;
}

header .header-info h2 {
color: #fff;
font-size: 32px;
line-height: 39px;
max-width: 410px;
}

header .col-md-8 img {
display: none;
}

header .header-info {
background: #FFFFFF 0% 0% no-repeat padding-box;
box-shadow: 0px 6px 6px #0000002E;
border: 1px solid #DEDEDE;
border-radius: 44px;
}

.blog-list-item .title img {
border-top-left-radius: 14px;
border-top-right-radius: 14px;
height: 220px;
width: 100%;
margin-bottom: 15px;
}

header .header-info .col-md-4 img {
border-top-left-radius: 44px;
border-bottom-left-radius: 44px;
width: 100%;
height: 100%;
}

header .header-info .col-md-8 {
padding: 20px 70px 20px 40px
}

.feature_category_text {
font: normal normal bold 14px/17px 'Lato', sans-serif;
color: #616161;
text-transform: capitalize;
}

.blog_date {
font: normal normal 300 14px/17px 'Lato', sans-serif;
color: #616161;
}

.blog_title a {
font: normal normal bold 24px/29px 'Lato', sans-serif;
color: #3D3D3D;
text-decoration: none;
}

.blog_content {
font: normal normal normal 18px/22px 'Lato', sans-serif;
color: #6E6E6E;
}

.blog-list-item .box {
background: #FFFFFF 0% 0% no-repeat padding-box;
box-shadow: 0px 6px 6px #0000002E;
border: 1px solid #CECECE;
border-radius: 14px;
}

.blog-list-item .blog_content {
font: normal normal normal 14px/17px 'Lato', sans-serif;
color: #6B6B6B;
}
84 changes: 84 additions & 0 deletions frappe/public/css/blogdetail.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
main.container {
max-width: unset!important;
padding:0!important;
}

ol.breadcrumb {
display: none;
}

.blog-container {
position: relative;
}

header {
background: #C2C2C2 0% 0% no-repeat padding-box;
height: 580px;
position: absolute;
width: 100%;
z-index: -9;
}

.blog-container .content {
padding-top: 60px;
}

.blog-container .container {
background: #FFFFFF 0% 0% no-repeat padding-box;
box-shadow: 0px 6px 6px #00000029;
border: 1px solid #C1C1C1;
border-radius: 40px;
padding: 50px 70px;
}

.blog-container hr {
border-top: 1px solid #8d99a6;
}

h1.blog-header {
font: normal normal normal 53px/63px 'Lato', sans-serif;
color: #373737;
}

p.blog_date {
font: normal normal 300 14px/17px 'Lato', sans-serif;
color: #616161;
}

.feature_category_text {
font: normal normal normal 14px/17px 'Lato', sans-serif;
color: #616161;
text-transform: capitalize;
margin: 20px 0 10px;
}

.media h5 a {
font: normal normal bold 24px/29px 'Lato', sans-serif;
color: #222A3D;
}

.media p {
font: normal normal normal 14px/17px 'Lato', sans-serif;
color: #222A3D;
}

.blog-comments .comment-header {
font: normal normal bold 18px/22px 'Lato', sans-serif;
color: #222A3D;
}

.comment-row span.font-weight-bold {
font: normal normal bold 18px/22px 'Lato',sans-serif;
color: #222A3D;
}

.comment-row .media-body .text-muted p {
font: normal normal normal 20px/24px 'Lato', sans-serif;
color: #515A6E;
}

#comment-form input,
#comment-form textarea {
border: 1px solid #929AAC;
border-radius: 10px;
}
42 changes: 0 additions & 42 deletions frappe/public/css/blogheader.css

This file was deleted.

Binary file added frappe/public/images/placeholder_blog.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions frappe/utils/formatters.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,19 @@ def format_value(value, df=None, doc=None, currency=None, translated=False):
values = [v.get(link_field.fieldname, 'asdf') for v in value]
return ', '.join(values)

elif df.get("fieldtype") in ["Link", "Dynamic Link"]:
if not doc or not doc.get("__link_titles") or not df.options:
return value

doctype = df.options
if df.get("fieldtype") == "Dynamic Link":
if not df.parent:
return value

meta = frappe.get_meta(df.parent)
_field = meta.get_field(df.options)
doctype = _field.options

return doc.__link_titles.get("{0}::{1}".format(doctype, value), value)

return value
39 changes: 0 additions & 39 deletions frappe/website/css/blog.css

This file was deleted.

7 changes: 6 additions & 1 deletion frappe/website/doctype/blog_post/blog_post.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ def get_context(self, context):

context.content = get_html_content_based_on_type(self, 'content', self.content_type)
context.description = self.blog_intro or strip_html_tags(context.content[:140])
context.subject = self.title
if self.name == frappe.db.get_single_value('Website Settings', 'featured_blog'):
context.is_featuredblog = True

context.metatags = {
"name": self.title,
Expand Down Expand Up @@ -97,6 +100,8 @@ def get_list_context(context=None):
featured_blog = None
if website_settings.featured_blog:
featured_blog = frappe.get_doc("Blog Post", website_settings.featured_blog).as_dict()
featured_blog.content = get_html_content_based_on_type(featured_blog, 'content', featured_blog.content_type)
cover_image = find_first_image(featured_blog.content)
list_context = frappe._dict(
template = "templates/includes/blog/blog.html",
get_list = get_blog_list,
Expand All @@ -106,7 +111,7 @@ def get_list_context(context=None):
title = _('Blog'),
page_heading_template = frappe.get_hooks('blogs_page_heading_template') or 'website/doctype/blog_post/templates/blog_post_header.html',
featured_blog = featured_blog,
background_image = website_settings.blog_header or None
featured_image = cover_image
)

category = sanitize_html(frappe.local.form_dict.blog_category or frappe.local.form_dict.category)
Expand Down
Loading

0 comments on commit 3a29e33

Please sign in to comment.