-
- {{ title }}
-- {{ frappe.format_date(published_on) }} - {% if read_time %} - · - {{ read_time }} min read - {% endif %} -
+ +{{ title }}
++ {{ blog_intro }} +
+ + +- {{ blog_intro }} -
{{ content }}
@@ -51,6 +63,20 @@
margin: 0 auto;
font-size: 1.2rem;
}
-
+.meta-info {
+ display: flex;
+ justify-content: space-between;
+ align-items: flex-end;
+}
+.social-links {
+ margin-right: 0px;
+}
+.social-links a {
+ font-size: 1.25rem;
+ margin: 0 5px 0 0;
+ padding: 5px;
+ width: 2.5rem;
+ text-align: center;
+}
{% endblock %}
diff --git a/frappe/website/doctype/blog_settings/blog_settings.js b/frappe/website/doctype/blog_settings/blog_settings.js
index b52c8862c5..90421b9550 100644
--- a/frappe/website/doctype/blog_settings/blog_settings.js
+++ b/frappe/website/doctype/blog_settings/blog_settings.js
@@ -5,4 +5,4 @@ frappe.ui.form.on('Blog Settings', {
refresh: function(frm) {
}
-});
+})
\ No newline at end of file
diff --git a/frappe/website/website_theme/standard/standard.json b/frappe/website/website_theme/standard/standard.json
index 1729e4616a..db79bde0a8 100644
--- a/frappe/website/website_theme/standard/standard.json
+++ b/frappe/website/website_theme/standard/standard.json
@@ -10,7 +10,7 @@
"font_properties": "300,600",
"footer": [],
"idx": 26,
- "modified": "2020-04-29 12:26:48.399125",
+ "modified": "2020-05-06 17:36:19.830993",
"modified_by": "Administrator",
"module": "Website",
"name": "Standard",
From fe911aa0c59251b8ebf25cd95cf263ce5a073b08 Mon Sep 17 00:00:00 2001
From: Himanshu -
+
- ${__('Reviews')} + +
-
-
- {%= __("Reviews") %} - -
- {%= __("Shared With") %} diff --git a/frappe/social/doctype/energy_point_settings/energy_point_settings.js b/frappe/social/doctype/energy_point_settings/energy_point_settings.js index f061f4d74e..880e1866ea 100644 --- a/frappe/social/doctype/energy_point_settings/energy_point_settings.js +++ b/frappe/social/doctype/energy_point_settings/energy_point_settings.js @@ -3,7 +3,9 @@ frappe.ui.form.on('Energy Point Settings', { refresh: function(frm) { - frm.add_custom_button(__('Give Review Points'), show_review_points_dialog); + if (frm.doc.enabled) { + frm.add_custom_button(__('Give Review Points'), show_review_points_dialog); + } } }); From 9724cc273a7aef877840fb095ee1d615248d98b8 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta
- + + {{ tab.title }} + + + {%- endfor -%} + +
Whatever
', - text_content='whatever', - message_id="a.really.long.message.id.that.should.not.wrap.until.998.if.it.does.then.exchange.will.break" + - ".really.long.message.id.that.should.not.wrap.unti") - result = safe_decode(prepare_message(email=email, recipient='test@test.com', - recipients_list=[])) - self.assertTrue( - "a.really.long.message.id.that.should.not.wrap.until.998.if.it.does.then.exchange.will.break" + - ".really.long.message.id.that.should.not.wrap.unti" in result) - def test_image(self): img_signature = ''' Content-Type: image/png diff --git a/frappe/tests/test_form_load.py b/frappe/tests/test_form_load.py index 5e8ad26b5e..34fc58465e 100644 --- a/frappe/tests/test_form_load.py +++ b/frappe/tests/test_form_load.py @@ -79,6 +79,8 @@ class TestFormLoad(unittest.TestCase): user.remove_roles('Blogger', 'Website Manager') user.add_roles(*user_roles) + blog_doc.delete() + def test_fieldlevel_permissions_in_load_for_child_table(self): contact = frappe.new_doc('Contact') contact.first_name = '_Test Contact 1' From 50bde698bb5848f3303a9fbb84634a0aac53d4d5 Mon Sep 17 00:00:00 2001 From: Mangesh-Khairnar| Variable | Value |
|---|---|
| {{ variable[0] }} | -{{ variable[1] }} | -
+ $(`
`).appendTo(this.wrapper.find(".page-content").empty());
this.container = this.wrapper.find(".dashboard-graph");
diff --git a/frappe/desk/doctype/dashboard_chart/dashboard_chart.js b/frappe/desk/doctype/dashboard_chart/dashboard_chart.js
index f8d5886b26..894dcccb27 100644
--- a/frappe/desk/doctype/dashboard_chart/dashboard_chart.js
+++ b/frappe/desk/doctype/dashboard_chart/dashboard_chart.js
@@ -88,9 +88,9 @@ frappe.ui.form.on('Dashboard Chart', {
}
if (frm.doc.chart_type == 'Group By') {
- frm.set_df_property('type', 'options', ['Line', 'Bar', 'Percentage', 'Pie']);
+ frm.set_df_property('type', 'options', ['Line', 'Bar', 'Percentage', 'Pie', 'Donut']);
} else {
- frm.set_df_property('type', 'options', ['Line', 'Bar']);
+ frm.set_df_property('type', 'options', ['Line', 'Bar', 'Heatmap']);
}
frm.set_value('document_type', '');
@@ -358,5 +358,3 @@ frappe.ui.form.on('Dashboard Chart', {
},
});
-
-
diff --git a/frappe/desk/doctype/dashboard_chart/dashboard_chart.json b/frappe/desk/doctype/dashboard_chart/dashboard_chart.json
index b5201a8b1f..d6f204db00 100644
--- a/frappe/desk/doctype/dashboard_chart/dashboard_chart.json
+++ b/frappe/desk/doctype/dashboard_chart/dashboard_chart.json
@@ -28,12 +28,12 @@
"to_date",
"time_interval",
"timeseries",
+ "type",
"filters_section",
"filters_json",
"chart_options_section",
- "type",
- "column_break_2",
"color",
+ "column_break_2",
"custom_options",
"section_break_10",
"last_synced_on"
@@ -85,22 +85,22 @@
"fieldtype": "Column Break"
},
{
- "depends_on": "timeseries",
+ "depends_on": "eval: doc.timeseries && doc.type !== 'Heatmap'",
"fieldname": "timespan",
"fieldtype": "Select",
"label": "Timespan",
"options": "Last Year\nLast Quarter\nLast Month\nLast Week\nSelect Date Range"
},
{
- "depends_on": "timeseries",
+ "depends_on": "eval: doc.timeseries && doc.type !== 'Heatmap'",
"fieldname": "time_interval",
"fieldtype": "Select",
"label": "Time Interval",
"options": "Yearly\nQuarterly\nMonthly\nWeekly\nDaily"
},
{
- "default": "0",
- "depends_on": "eval: ['Count', 'Sum', 'Average'].includes(doc.chart_type)",
+ "default": "1",
+ "depends_on": "eval: doc.chart_type !== 'Group By'",
"fieldname": "timeseries",
"fieldtype": "Check",
"label": "Time Series"
@@ -123,10 +123,11 @@
"label": "Chart Options"
},
{
+ "default": "Line",
"fieldname": "type",
"fieldtype": "Select",
"label": "Type",
- "options": "Line\nBar\nPercentage\nPie\nDonut",
+ "options": "Line\nBar\nHeatmap",
"reqd": 1
},
{
@@ -134,7 +135,7 @@
"fieldtype": "Column Break"
},
{
- "depends_on": "eval:doc.chart_type !== 'Report'",
+ "depends_on": "eval: doc.chart_type !== 'Report' && doc.type !== 'Heatmap'",
"fieldname": "color",
"fieldtype": "Color",
"label": "Color"
@@ -231,7 +232,7 @@
}
],
"links": [],
- "modified": "2020-05-01 15:22:59.119341",
+ "modified": "2020-04-29 17:50:59.867496",
"modified_by": "Administrator",
"module": "Desk",
"name": "Dashboard Chart",
diff --git a/frappe/desk/doctype/dashboard_chart/dashboard_chart.py b/frappe/desk/doctype/dashboard_chart/dashboard_chart.py
index 417ef2ba82..2b095b0263 100644
--- a/frappe/desk/doctype/dashboard_chart/dashboard_chart.py
+++ b/frappe/desk/doctype/dashboard_chart/dashboard_chart.py
@@ -87,7 +87,10 @@ def get(chart_name = None, chart = None, no_cache = None, filters = None, from_d
if chart.chart_type == 'Group By':
chart_config = get_group_by_chart_config(chart, filters)
else:
- chart_config = get_chart_config(chart, filters, timespan, timegrain, from_date, to_date)
+ if chart.type == 'Heatmap':
+ chart_config = get_heatmap_chart_config(chart, filters)
+ else:
+ chart_config = get_chart_config(chart, filters, timespan, timegrain, from_date, to_date)
return chart_config
@@ -174,6 +177,31 @@ def get_chart_config(chart, filters, timespan, timegrain, from_date, to_date):
return chart_config
+def get_heatmap_chart_config(chart, filters):
+ aggregate_function = get_aggregate_function(chart.chart_type)
+ value_field = chart.value_based_on or '1'
+ doctype = chart.document_type
+ datefield = chart.based_on
+ filters.append([doctype, datefield, '>', 'subdate(curdate(), interval 1 year)', False])
+
+ data = dict(frappe.db.get_all(
+ doctype,
+ fields = [
+ 'unix_timestamp(date({datefield}))'.format(datefield=datefield),
+ '{aggregate_function}({value_field})'.format(aggregate_function=aggregate_function, value_field=value_field),
+ ],
+ filters = filters,
+ group_by = 'date(creation)',
+ as_list = 1,
+ order_by = 'creation asc',
+ ignore_ifnull = True
+ ))
+
+ chart_config = {
+ 'labels': '',
+ 'dataPoints': data,
+ }
+ return chart_config
def get_group_by_chart_config(chart, filters):
diff --git a/frappe/public/js/frappe/views/reports/report_utils.js b/frappe/public/js/frappe/views/reports/report_utils.js
index a8149b9134..7b1205482f 100644
--- a/frappe/public/js/frappe/views/reports/report_utils.js
+++ b/frappe/public/js/frappe/views/reports/report_utils.js
@@ -20,7 +20,7 @@ frappe.report_utils = {
return {
data: {
- labels: labels,
+ labels: labels.length? labels: null,
datasets: datasets
},
truncateLegends: 1,
diff --git a/frappe/public/js/frappe/widgets/chart_widget.js b/frappe/public/js/frappe/widgets/chart_widget.js
index a50acfcd9d..4f95649635 100644
--- a/frappe/public/js/frappe/widgets/chart_widget.js
+++ b/frappe/public/js/frappe/widgets/chart_widget.js
@@ -40,6 +40,10 @@ export default class ChartWidget extends Widget {
setup_container() {
this.body.empty();
+ if (this.chart_doc.type == 'Heatmap') {
+ this.setup_heatmap_container();
+ }
+
this.loading = $(
`
${__(
"Loading..."
@@ -60,6 +64,12 @@ export default class ChartWidget extends Widget {
this.set_chart_title();
}
+ setup_heatmap_container() {
+ this.widget.addClass('heatmap-chart');
+ this.widget.removeClass('full-width').addClass('full-width');
+ this.width = 'Full';
+ }
+
set_summary() {
if (!this.$summary) {
this.$summary = $(``).hide();
@@ -104,6 +114,10 @@ export default class ChartWidget extends Widget {
}
render_time_series_filters() {
+ if (this.chart_doc.type == 'Heatmap') {
+ return;
+ }
+
let filters = [
{
label: this.chart_settings.timespan || this.chart_doc.timespan,
@@ -465,51 +479,17 @@ export default class ChartWidget extends Widget {
}
render() {
- const chart_type_map = {
- Line: "line",
- Bar: "bar",
- Percentage: "percentage",
- Pie: "pie",
- Donut: "donut"
- };
-
- let colors = [];
-
- if (this.chart_doc.y_axis.length) {
- this.chart_doc.y_axis.map(field => {
- colors.push(field.color);
- });
- } else if (["Line", "Bar"].includes(this.chart_doc.type)) {
- colors = [this.chart_doc.color || []];
- }
-
- if (!this.data || !this.data.labels.length || !Object.keys(this.data).length) {
+ if (!this.data || !this.data.labels || !Object.keys(this.data).length) {
this.chart_wrapper.hide();
this.loading.hide();
- this.$summary.hide();
+ this.$summary && this.$summary.hide();
this.empty.show();
} else {
this.loading.hide();
this.empty.hide();
this.chart_wrapper.show();
- let chart_args = {
- data: this.data,
- type: chart_type_map[this.chart_doc.type],
- colors: colors,
- height: this.height,
- axisOptions: {
- xIsSeries: this.chart_doc.timeseries,
- shortenYAxisNumbers: 1
- }
- };
-
- if (this.chart_doc.custom_options) {
- let custom_options = JSON.parse(this.chart_doc.custom_options);
- for (let key in custom_options) {
- chart_args[key] = custom_options[key];
- }
- }
+ const chart_args = this.get_chart_args();
if (!this.dashboard_chart) {
this.dashboard_chart = new frappe.Chart(
@@ -519,7 +499,73 @@ export default class ChartWidget extends Widget {
} else {
this.dashboard_chart.update(this.data);
}
+
this.width == "Full" && this.summary && this.set_summary();
+ this.chart_doc.type == 'Heatmap' && this.render_heatmap_legend();
+ }
+ }
+
+
+ get_chart_args() {
+ let colors = this.get_chart_colors();
+
+ const chart_type_map = {
+ Line: "line",
+ Bar: "bar",
+ Percentage: "percentage",
+ Pie: "pie",
+ Donut: "donut",
+ Heatmap: "heatmap"
+ };
+
+ let chart_args = {
+ data: this.data,
+ type: chart_type_map[this.chart_doc.type],
+ colors: colors,
+ height: this.height,
+ axisOptions: {
+ xIsSeries: this.chart_doc.timeseries,
+ shortenYAxisNumbers: 1
+ }
+ };
+
+ return chart_args;
+ }
+
+ get_chart_colors() {
+ let colors = [];
+ if (this.chart_doc.y_axis.length) {
+ this.chart_doc.y_axis.map(field => {
+ colors.push(field.color);
+ });
+ } else if (["Line", "Bar"].includes(this.chart_doc.type)) {
+ colors = [this.chart_doc.color || "light-blue"];
+ } else if (this.chart_doc.type == "Heatmap") {
+ colors = [];
+ }
+
+ return colors;
+ }
+
+ render_heatmap_legend() {
+ if (!this.$heatmap_legend) {
+ this.$heatmap_legend =
+ $(`
+
Date: Wed, 29 Apr 2020 18:01:58 +0530
Subject: [PATCH 091/336] fix: hide chart for smaller widths
---
frappe/public/less/desktop.less | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/frappe/public/less/desktop.less b/frappe/public/less/desktop.less
index da59fd8c0a..44c5636731 100644
--- a/frappe/public/less/desktop.less
+++ b/frappe/public/less/desktop.less
@@ -341,6 +341,12 @@
}
}
+ @media (max-width: 768px) {
+ &.dashboard-widget-box.heatmap-chart {
+ display: none;
+ }
+ }
+
&.onboarding-widget-box {
margin-bottom: 50px;
margin-top: 10px;
From d83127021023b0ec018e43d771125c52cb662038 Mon Sep 17 00:00:00 2001
From: prssanna
Date: Wed, 29 Apr 2020 18:04:52 +0530
Subject: [PATCH 092/336] fix: set label as empty list
---
frappe/desk/doctype/dashboard_chart/dashboard_chart.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/frappe/desk/doctype/dashboard_chart/dashboard_chart.py b/frappe/desk/doctype/dashboard_chart/dashboard_chart.py
index 2b095b0263..21af41adad 100644
--- a/frappe/desk/doctype/dashboard_chart/dashboard_chart.py
+++ b/frappe/desk/doctype/dashboard_chart/dashboard_chart.py
@@ -198,7 +198,7 @@ def get_heatmap_chart_config(chart, filters):
))
chart_config = {
- 'labels': '',
+ 'labels': [],
'dataPoints': data,
}
return chart_config
From 302af369ac11ba3a4e72376f6ccb8f164f57a10f Mon Sep 17 00:00:00 2001
From: prssanna
Date: Thu, 30 Apr 2020 18:35:49 +0530
Subject: [PATCH 093/336] fix: set timeseries according to chart type
---
.../doctype/dashboard_chart/dashboard_chart.js | 18 +++++++++++-------
.../dashboard_chart/dashboard_chart.json | 6 +++---
2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/frappe/desk/doctype/dashboard_chart/dashboard_chart.js b/frappe/desk/doctype/dashboard_chart/dashboard_chart.js
index 894dcccb27..7836a66443 100644
--- a/frappe/desk/doctype/dashboard_chart/dashboard_chart.js
+++ b/frappe/desk/doctype/dashboard_chart/dashboard_chart.js
@@ -49,6 +49,7 @@ frappe.ui.form.on('Dashboard Chart', {
});
frm.set_df_property("filters_section", "hidden", 1);
+ frm.trigger('set_time_series')
frm.set_query('document_type', function() {
return {
filters: {
@@ -71,6 +72,7 @@ frappe.ui.form.on('Dashboard Chart', {
},
chart_type: function(frm) {
+ frm.trigger('set_time_series')
if (frm.doc.chart_type == 'Report') {
frm.set_query('report_name', () => {
return {
@@ -80,13 +82,6 @@ frappe.ui.form.on('Dashboard Chart', {
}
});
} else {
- // set timeseries based on chart type
- if (['Count', 'Average', 'Sum'].includes(frm.doc.chart_type)) {
- frm.set_value('timeseries', 1);
- } else {
- frm.set_value('timeseries', 0);
- }
-
if (frm.doc.chart_type == 'Group By') {
frm.set_df_property('type', 'options', ['Line', 'Bar', 'Percentage', 'Pie', 'Donut']);
} else {
@@ -97,6 +92,15 @@ frappe.ui.form.on('Dashboard Chart', {
}
},
+ set_time_series: function(frm) {
+ // set timeseries based on chart type
+ if (['Count', 'Average', 'Sum'].includes(frm.doc.chart_type)) {
+ frm.set_value('timeseries', 1);
+ } else {
+ frm.set_value('timeseries', 0);
+ }
+ },
+
document_type: function(frm) {
// update `based_on` options based on date / datetime fields
frm.set_value('source', '');
diff --git a/frappe/desk/doctype/dashboard_chart/dashboard_chart.json b/frappe/desk/doctype/dashboard_chart/dashboard_chart.json
index d6f204db00..f62d032767 100644
--- a/frappe/desk/doctype/dashboard_chart/dashboard_chart.json
+++ b/frappe/desk/doctype/dashboard_chart/dashboard_chart.json
@@ -99,8 +99,8 @@
"options": "Yearly\nQuarterly\nMonthly\nWeekly\nDaily"
},
{
- "default": "1",
- "depends_on": "eval: doc.chart_type !== 'Group By'",
+ "default": "0",
+ "depends_on": "eval: !['Group By', 'Report'].includes(doc.chart_type)\n",
"fieldname": "timeseries",
"fieldtype": "Check",
"label": "Time Series"
@@ -232,7 +232,7 @@
}
],
"links": [],
- "modified": "2020-04-29 17:50:59.867496",
+ "modified": "2020-04-30 18:30:46.242316",
"modified_by": "Administrator",
"module": "Desk",
"name": "Dashboard Chart",
From bd3d572376b56ab6522968cca753745caf9aaca8 Mon Sep 17 00:00:00 2001
From: prssanna
Date: Thu, 30 Apr 2020 18:51:53 +0530
Subject: [PATCH 094/336] fix: fix modified timestamp
---
frappe/desk/doctype/dashboard_chart/dashboard_chart.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/frappe/desk/doctype/dashboard_chart/dashboard_chart.json b/frappe/desk/doctype/dashboard_chart/dashboard_chart.json
index f62d032767..19d358c8c5 100644
--- a/frappe/desk/doctype/dashboard_chart/dashboard_chart.json
+++ b/frappe/desk/doctype/dashboard_chart/dashboard_chart.json
@@ -232,7 +232,7 @@
}
],
"links": [],
- "modified": "2020-04-30 18:30:46.242316",
+ "modified": "2020-04-23 13:01:07.178866",
"modified_by": "Administrator",
"module": "Desk",
"name": "Dashboard Chart",
From 98aad96ee8647b9f5078219665caf2a72c96bac2 Mon Sep 17 00:00:00 2001
From: prssanna
Date: Thu, 30 Apr 2020 19:20:06 +0530
Subject: [PATCH 095/336] fix: missing semicolons
---
frappe/desk/doctype/dashboard_chart/dashboard_chart.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/frappe/desk/doctype/dashboard_chart/dashboard_chart.js b/frappe/desk/doctype/dashboard_chart/dashboard_chart.js
index 7836a66443..4c525e56b3 100644
--- a/frappe/desk/doctype/dashboard_chart/dashboard_chart.js
+++ b/frappe/desk/doctype/dashboard_chart/dashboard_chart.js
@@ -49,7 +49,7 @@ frappe.ui.form.on('Dashboard Chart', {
});
frm.set_df_property("filters_section", "hidden", 1);
- frm.trigger('set_time_series')
+ frm.trigger('set_time_series');
frm.set_query('document_type', function() {
return {
filters: {
@@ -72,7 +72,7 @@ frappe.ui.form.on('Dashboard Chart', {
},
chart_type: function(frm) {
- frm.trigger('set_time_series')
+ frm.trigger('set_time_series');
if (frm.doc.chart_type == 'Report') {
frm.set_query('report_name', () => {
return {
From b045840228ce0327c0e39a2c220a0a9a6ac99530 Mon Sep 17 00:00:00 2001
From: prssanna
Date: Fri, 1 May 2020 19:17:03 +0530
Subject: [PATCH 096/336] fix: fix heatmap chart css for smaller widths
---
.../public/js/frappe/widgets/chart_widget.js | 2 +-
frappe/public/less/desktop.less | 27 +++++++++++++------
2 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/frappe/public/js/frappe/widgets/chart_widget.js b/frappe/public/js/frappe/widgets/chart_widget.js
index 4f95649635..b160afa1fa 100644
--- a/frappe/public/js/frappe/widgets/chart_widget.js
+++ b/frappe/public/js/frappe/widgets/chart_widget.js
@@ -548,7 +548,7 @@ export default class ChartWidget extends Widget {
}
render_heatmap_legend() {
- if (!this.$heatmap_legend) {
+ if (!this.$heatmap_legend && this.widget.width() > 991) {
this.$heatmap_legend =
$(`
-{{ c('web_blocks', web_blocks=theme.navbar, htmltag='div') }}
-
-{%- endif -%}
From 7c3749c2a8c1bd4eff62d5570176d0ce9b981762 Mon Sep 17 00:00:00 2001
From: Gavin D'souza
Date: Sat, 9 May 2020 17:20:25 +0530
Subject: [PATCH 106/336] fix: scaffolding for migrate-to command added
---
frappe/commands/site.py | 74 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 74 insertions(+)
diff --git a/frappe/commands/site.py b/frappe/commands/site.py
index 52994ccec3..d5329d4cf9 100755
--- a/frappe/commands/site.py
+++ b/frappe/commands/site.py
@@ -1,6 +1,7 @@
# imports - standard imports
import atexit
import compileall
+import getpass
import hashlib
import os
import re
@@ -9,6 +10,7 @@ import sys
# imports - third party imports
import click
+import requests
# imports - module imports
import frappe
@@ -256,6 +258,77 @@ def migrate(context, rebuild_website=False, skip_failing=False):
print("Compiling Python Files...")
compileall.compile_dir('../apps', quiet=1, rx=re.compile('.*node_modules.*'))
+
+@click.command('migrate-to')
+@click.argument('site_url')
+@pass_context
+def migrate_to(context, site_url):
+ '''
+ >>> import requests
+ >>> session = requests.Session()
+ >>> session.post("http://cloud:8002/api/method/login", {"usr":"gavin18d@gmail.com", "pwd":"bfdiljn;jnd"})
+
+ >>> session.headers.update({"X-Press-Team": "gavin18d@gmail.com"})
+ >>> session.post("http://cloud:8002/api/method/press.api.site.options_for_new").json()
+ '''
+
+ if site_url in ("frappe.cloud", "frappecloud.com"):
+ site_url = "frappe.cloud"
+
+ login_url = "https://{site_url}/api/method/login"
+ upload_url = "https://{site_url}/api/method/press.api.site.new_from_existing_account"
+ options_url = "https://{site_url}/api/method/press.api.site.options_for_new"
+
+ else:
+ print(f"{site_url} is not supported yet")
+ sys.exit(1)
+
+ for site in context.site:
+ username = input()
+ password = getpass.unix_getpass()
+ auth_credentials = {"usr": username, "pwd": password}
+
+ # create frapp_cloud session
+ session = requests.Session()
+ login_sc = session.post(login_url, auth_credentials)
+
+ if login_sc.ok:
+ print(f"Auth Successful w {site_url}")
+
+ # get options
+ session.headers.update({"X-Press-Team": username})
+ site_options_sc = session.post(options_url)
+
+ if site_options_sc.ok:
+ site_options = site_options_sc.json()
+
+ else:
+ print(f"Request failed with Status Code: {site_options_sc.status_code}")
+ sys.exit(1)
+
+ # set preferences from options
+
+ # take backup
+ import frappe.utils.backups
+ print(f"Taking backup for site {site}")
+ odb = frappe.utils.backups.new_backup(ignore_files=False, force=True)
+
+ # relative paths here
+ odb.backup_path_db
+ odb.backup_path_files
+ odb.backup_path_private_files
+
+ site_files = {
+ "files": []
+ }
+
+ # push to frappe_cloud
+ session.post(upload_url, files=site_files)
+
+ else:
+ print(f"Request failed with Status Code: {login_sc.status_code}")
+
+
@click.command('run-patch')
@click.argument('module')
@pass_context
@@ -559,6 +632,7 @@ commands = [
install_app,
list_apps,
migrate,
+ migrate_to,
new_site,
reinstall,
reload_doc,
From 51289dbd008d0ada4da690669a02950f3c99b677 Mon Sep 17 00:00:00 2001
From: Gavin D'souza
Date: Sat, 9 May 2020 17:21:29 +0530
Subject: [PATCH 107/336] fix: set totals currency for field
---
frappe/public/js/frappe/views/reports/report_view.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/frappe/public/js/frappe/views/reports/report_view.js b/frappe/public/js/frappe/views/reports/report_view.js
index 43540f449d..0c1f0f4635 100644
--- a/frappe/public/js/frappe/views/reports/report_view.js
+++ b/frappe/public/js/frappe/views/reports/report_view.js
@@ -1020,7 +1020,7 @@ frappe.views.ReportView = class ReportView extends frappe.views.ListView {
name: __('Totals Row'),
content: totals[col.id],
format: value => {
- return frappe.format(value, col.docfield, { always_show_decimals: true });
+ return frappe.format(value, col.docfield, { always_show_decimals: true }, data[0]);
}
}
})
From be27513a56c69f6a70bcbf5b03b99847ea1415d9 Mon Sep 17 00:00:00 2001
From: Shivam Mishra
Date: Mon, 11 May 2020 12:09:54 +0530
Subject: [PATCH 108/336] feat: added driver.js with style overrides
---
frappe/public/build.json | 5 +-
frappe/public/js/frappe/ui/driver.js | 3 +
frappe/public/less/driver.less | 180 +++++++++++++++++++++++++++
package.json | 1 +
yarn.lock | 5 +
5 files changed, 193 insertions(+), 1 deletion(-)
create mode 100644 frappe/public/js/frappe/ui/driver.js
create mode 100644 frappe/public/less/driver.less
diff --git a/frappe/public/build.json b/frappe/public/build.json
index d56907b558..e4c90cb708 100755
--- a/frappe/public/build.json
+++ b/frappe/public/build.json
@@ -112,7 +112,9 @@
"public/less/chat.less",
"public/less/filters.less",
"public/less/social.less",
- "node_modules/frappe-charts/dist/frappe-charts.min.css"
+ "node_modules/frappe-charts/dist/frappe-charts.min.css",
+ "node_modules/driver.js/dist/driver.min.css",
+ "public/less/driver.less"
],
"css/frappe-rtl.css": [
"public/css/bootstrap-rtl.css",
@@ -244,6 +246,7 @@
"public/js/frappe/utils/energy_point_utils.js",
"public/js/frappe/utils/dashboard_utils.js",
"public/js/frappe/ui/chart.js",
+ "public/js/frappe/ui/driver.js",
"public/js/frappe/barcode_scanner/index.js"
],
"css/form.min.css": [
diff --git a/frappe/public/js/frappe/ui/driver.js b/frappe/public/js/frappe/ui/driver.js
new file mode 100644
index 0000000000..98ed49ec05
--- /dev/null
+++ b/frappe/public/js/frappe/ui/driver.js
@@ -0,0 +1,3 @@
+import Driver from 'driver.js';
+
+frappe.Driver = Driver;
\ No newline at end of file
diff --git a/frappe/public/less/driver.less b/frappe/public/less/driver.less
new file mode 100644
index 0000000000..9dc7cde0b1
--- /dev/null
+++ b/frappe/public/less/driver.less
@@ -0,0 +1,180 @@
+@import "frappe/public/less/variables.less";
+
+div#driver-popover-item {
+ .driver-popover-footer {
+ display: block;
+ margin-top: 12px;
+
+ button {
+ // Edited
+ padding: 1px 5px;
+ font-size: 12px;
+ line-height: 1.5;
+ border-radius: 3px;
+ display: inline-block;
+ margin-bottom: 0;
+ font-weight: normal;
+ text-align: center;
+ white-space: nowrap;
+ vertical-align: middle;
+ text-shadow: none !important;
+ -ms-touch-action: manipulation;
+ touch-action: manipulation;
+ cursor: pointer;
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+ background-image: none;
+ border: 1px solid transparent;
+ }
+
+ button.driver-disabled {
+ color: grey;
+ cursor: default;
+ pointer-events: none;
+ }
+
+ .driver-close-btn {
+ // Edited
+ float: left;
+ color: inherit;
+ background-color: #f0f4f7;
+ border-color: transparent;
+ }
+
+ .driver-navigation-btns {
+ // Edited
+ .driver-prev-btn {
+ color: inherit;
+ background-color: #f0f4f7;
+ border-color: transparent;
+ }
+
+ .driver-next-btn {
+ color: #fff;
+ background-color: #5e64ff;
+ border-color: #444bff;
+ }
+ }
+ }
+ .driver-popover-title {
+ // Edited
+ font: 18px/normal sans-serif;
+ margin: 0 0 5px;
+ font-weight: 500;
+ display: block;
+ position: relative;
+ line-height: 1.5;
+ zoom: 1;
+ }
+ .driver-popover-description {
+ // Edited
+ margin-bottom: 0;
+ font: 12px/normal sans-serif;
+ line-height: 1.5;
+ color: @text-muted;
+ font-weight: 400;
+ zoom: 1;
+ }
+}
+
+.driver-clearfix {
+ &:after {
+ content: "";
+ display: table;
+ clear: both;
+ }
+ &:before {
+ content: "";
+ display: table;
+ }
+}
+
+.driver-stage-no-animation {
+ -webkit-transition: none !important;
+ -moz-transition: none !important;
+ -ms-transition: none !important;
+ -o-transition: none !important;
+ transition: none !important;
+ background: transparent !important;
+ outline: 5000px solid rgba(0,0,0,.75);
+}
+
+div#driver-page-overlay {
+ background: @modal-backdrop-bg;
+ position: fixed;
+ bottom: 0;
+ right: 0;
+ display: block;
+ width: 100%;
+ height: 100%;
+ zoom: 1;
+ filter: alpha(opacity=25);
+ opacity: .25;
+ z-index: 100002 !important;
+ top: 0;
+ left: 0;
+ -webkit-transition: all .3s;
+ -moz-transition: all .3s;
+ -ms-transition: all .3s;
+ -o-transition: all .3s;
+ transition: all .3s;
+}
+
+div#driver-highlighted-element-stage {
+ top: 0;
+ left: 0;
+ -webkit-transition: all .3s;
+ -moz-transition: all .3s;
+ -ms-transition: all .3s;
+ -o-transition: all .3s;
+ transition: all .3s;
+ position: absolute;
+ height: 50px;
+ width: 300px;
+ background: #fff;
+ z-index: 100003 !important;
+ display: none;
+ border-radius: 2px;
+}
+
+.driver-highlighted-element {
+ z-index: 100004 !important;
+}
+
+.driver-position-relative {
+ position: relative !important;
+}
+
+.driver-fix-stacking {
+ z-index: auto !important;
+ opacity: 1 !important;
+ -webkit-transform: none !important;
+ -moz-transform: none !important;
+ -ms-transform: none !important;
+ -o-transform: none !important;
+ transform: none !important;
+ -webkit-filter: none !important;
+ -moz-filter: none !important;
+ -ms-filter: none !important;
+ -o-filter: none !important;
+ filter: none !important;
+ -webkit-perspective: none !important;
+ -moz-perspective: none !important;
+ -ms-perspective: none !important;
+ -o-perspective: none !important;
+ perspective: none !important;
+ -webkit-transform-style: flat !important;
+ -moz-transform-style: flat !important;
+ -ms-transform-style: flat !important;
+ transform-style: flat !important;
+ -webkit-transform-box: border-box !important;
+ -moz-transform-box: border-box !important;
+ -ms-transform-box: border-box !important;
+ -o-transform-box: border-box !important;
+ transform-box: border-box !important;
+ will-change: unset !important;
+}
+
+
diff --git a/package.json b/package.json
index e735beee9b..fae9798706 100644
--- a/package.json
+++ b/package.json
@@ -25,6 +25,7 @@
"bootstrap": "^4.4.1",
"cookie": "^0.4.0",
"cssnano": "^4.1.10",
+ "driver.js": "^0.9.8",
"express": "^4.17.1",
"fast-deep-equal": "^2.0.1",
"frappe-charts": "^1.3.2",
diff --git a/yarn.lock b/yarn.lock
index b189296086..73816bdece 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1770,6 +1770,11 @@ double-ended-queue@^2.1.0-0:
resolved "https://registry.yarnpkg.com/double-ended-queue/-/double-ended-queue-2.1.0-0.tgz#103d3527fd31528f40188130c841efdd78264e5c"
integrity sha1-ED01J/0xUo9AGIEwyEHv3XgmTlw=
+driver.js@^0.9.8:
+ version "0.9.8"
+ resolved "https://registry.yarnpkg.com/driver.js/-/driver.js-0.9.8.tgz#4b327f4537b1c9b9fb19419de86174be821ae32a"
+ integrity sha512-bczjyKdX6XmFyCDkwtRmlaORDwfBk1xXmRO0CAe5VwNQTM98aWaG2LAIiIdTe53iV/B7W5lXlIy2xYtf0JRb7Q==
+
duplexer3@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2"
From 1ab4f21a3609296b7cd1898f6064a578920cb897 Mon Sep 17 00:00:00 2001
From: Shivam Mishra
Date: Mon, 11 May 2020 12:36:25 +0530
Subject: [PATCH 109/336] feat: added frappe tour API
---
frappe/public/js/frappe/form/form.js | 29 ++++++++++++++++++++++++++++
frappe/public/js/frappe/provide.js | 1 +
2 files changed, 30 insertions(+)
diff --git a/frappe/public/js/frappe/form/form.js b/frappe/public/js/frappe/form/form.js
index a5853d96f5..0368311a2d 100644
--- a/frappe/public/js/frappe/form/form.js
+++ b/frappe/public/js/frappe/form/form.js
@@ -1556,6 +1556,35 @@ frappe.ui.form.Form = class FrappeForm {
$el.find('input, select, textarea').focus();
}, 1000);
}
+
+ show_tour() {
+ if (!frappe.tour.hasOwnProperty(this.doctype) || !Array.isArray(frappe.tour[this.doctype])) {
+ return
+ }
+
+ const driver = new frappe.Driver({
+ overlayClickNext: true,
+ keyboardControl: true,
+ nextBtnText: 'Next', // Next button text for this step
+ prevBtnText: 'Previous',
+ });
+
+ let steps = frappe.tour[this.doctype].map(step => {
+ let field = this.get_docfield(step.fieldname);
+ return {
+ element: `.frappe-control[title='${step.fieldname}']`,
+ popover: {
+ title: step.title || field.label,
+ description: step.description
+ }
+ }
+ });
+
+ console.log(steps);
+
+ driver.defineSteps(steps);
+ driver.start();
+ }
};
frappe.validated = 0;
diff --git a/frappe/public/js/frappe/provide.js b/frappe/public/js/frappe/provide.js
index 1dacc4dd47..d4d0fdffb8 100644
--- a/frappe/public/js/frappe/provide.js
+++ b/frappe/public/js/frappe/provide.js
@@ -35,6 +35,7 @@ frappe.provide('locals.DocType');
// for listviews
frappe.provide("frappe.listview_settings");
+frappe.provide("frappe.tour");
frappe.provide("frappe.listview_parent_route");
// constants
From b24de5b703c8ac2c7fed1afa5a84821768406c99 Mon Sep 17 00:00:00 2001
From: Shivam Mishra
Date: Mon, 11 May 2020 12:37:25 +0530
Subject: [PATCH 110/336] feat: setup tour for note
---
frappe/desk/doctype/note/note.js | 26 +++++++++++++++++++-------
1 file changed, 19 insertions(+), 7 deletions(-)
diff --git a/frappe/desk/doctype/note/note.js b/frappe/desk/doctype/note/note.js
index c237998ccf..5718180b70 100644
--- a/frappe/desk/doctype/note/note.js
+++ b/frappe/desk/doctype/note/note.js
@@ -1,9 +1,9 @@
frappe.ui.form.on("Note", {
refresh: function(frm) {
- if(frm.doc.__islocal) {
+ if (frm.doc.__islocal) {
frm.events.set_editable(frm, true);
} else {
- if(!frm.doc.content) {
+ if (!frm.doc.content) {
frm.doc.content = "";
}
@@ -18,16 +18,15 @@ frappe.ui.form.on("Note", {
// hide all fields other than content
// no permission
- if(editable && !frm.perm[0].write) return;
+ if (editable && !frm.perm[0].write) return;
// content read_only
- frm.set_df_property("content", "read_only", editable ? 0: 1);
+ frm.set_df_property("content", "read_only", editable ? 0 : 1);
// hide all other fields
$.each(frm.fields_dict, function(fieldname) {
-
- if(fieldname !== "content") {
- frm.set_df_property(fieldname, "hidden", editable ? 0: 1);
+ if (fieldname !== "content") {
+ frm.set_df_property(fieldname, "hidden", editable ? 0 : 1);
}
});
@@ -39,3 +38,16 @@ frappe.ui.form.on("Note", {
frm.is_note_editable = editable;
}
});
+
+frappe.tour['Note'] = [
+ {
+ fieldname: "title",
+ title: "Title of the Note",
+ description: "This is the name by which the note will be saved, you can change this later",
+ },
+ {
+ fieldname: "public",
+ title: "Sets the Note to Public",
+ description: "You can change the visibility of the note with this, setting it to public will allow other users to view it.",
+ },
+];
\ No newline at end of file
From 470abc20a1463ae68cbc33f4d8d748edb2a9f47d Mon Sep 17 00:00:00 2001
From: Shivam Mishra
Date: Mon, 11 May 2020 12:56:40 +0530
Subject: [PATCH 111/336] feat: expand all sections before tour
---
frappe/public/js/frappe/form/form.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/frappe/public/js/frappe/form/form.js b/frappe/public/js/frappe/form/form.js
index 0368311a2d..41bde104dd 100644
--- a/frappe/public/js/frappe/form/form.js
+++ b/frappe/public/js/frappe/form/form.js
@@ -1569,6 +1569,8 @@ frappe.ui.form.Form = class FrappeForm {
prevBtnText: 'Previous',
});
+ this.layout.sections.forEach(section => section.collapse(false))
+
let steps = frappe.tour[this.doctype].map(step => {
let field = this.get_docfield(step.fieldname);
return {
@@ -1580,8 +1582,6 @@ frappe.ui.form.Form = class FrappeForm {
}
});
- console.log(steps);
-
driver.defineSteps(steps);
driver.start();
}
From bf7de110e27a50906a3d4384c9489a769af3b5a0 Mon Sep 17 00:00:00 2001
From: Shivam Mishra
Date: Mon, 11 May 2020 12:57:37 +0530
Subject: [PATCH 112/336] feat: added steps for website settings
---
.../doctype/website_settings/website_settings.js | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/frappe/website/doctype/website_settings/website_settings.js b/frappe/website/doctype/website_settings/website_settings.js
index be294258f4..7fbb785acf 100644
--- a/frappe/website/doctype/website_settings/website_settings.js
+++ b/frappe/website/doctype/website_settings/website_settings.js
@@ -95,4 +95,17 @@ frappe.ui.form.on('Top Bar Item', {
label: function(frm, doctype, name) {
frm.events.set_parent_options(frm, doctype, name);
},
-});
\ No newline at end of file
+});
+
+frappe.tour['Website Settings'] = [
+ {
+ fieldname: "enable_view_tracking",
+ title: __("Enable Tracking Page Views"),
+ description: __("Checking this will enable tracking page views for blogs, web pages, etc."),
+ },
+ {
+ fieldname: "disable_signup",
+ title: __("Disable Signup for your site"),
+ description: __("Check this if you don't want users to sign up for an account on your site. Users won't get desk access unless you explicitly provide it."),
+ }
+];
\ No newline at end of file
From 66a58ba09a3ca9158f19408fd8a298f782c27cb2 Mon Sep 17 00:00:00 2001
From: Rucha Mahabal
Date: Mon, 11 May 2020 14:03:12 +0530
Subject: [PATCH 113/336] test: next schedule date of auto repeat with daily
frequency
---
frappe/automation/doctype/auto_repeat/test_auto_repeat.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/frappe/automation/doctype/auto_repeat/test_auto_repeat.py b/frappe/automation/doctype/auto_repeat/test_auto_repeat.py
index 769c77b67c..60fa9cb59e 100644
--- a/frappe/automation/doctype/auto_repeat/test_auto_repeat.py
+++ b/frappe/automation/doctype/auto_repeat/test_auto_repeat.py
@@ -99,13 +99,18 @@ class TestAutoRepeat(unittest.TestCase):
def test_next_schedule_date(self):
current_date = getdate(today())
todo = frappe.get_doc(
- dict(doctype='ToDo', description='test next schedule date todo', assigned_by='Administrator')).insert()
+ dict(doctype='ToDo', description='test next schedule date for monthly', assigned_by='Administrator')).insert()
doc = make_auto_repeat(frequency='Monthly', reference_document=todo.name, start_date=add_months(today(), -2))
# next_schedule_date is set as on or after current date
# it should not be a previous month's date
self.assertTrue((doc.next_schedule_date >= current_date))
+ todo = frappe.get_doc(
+ dict(doctype='ToDo', description='test next schedule date for daily', assigned_by='Administrator')).insert()
+ doc = make_auto_repeat(frequency='Daily', reference_document=todo.name, start_date=add_days(today(), -2))
+ self.assertEqual(getdate(doc.next_schedule_date), current_date)
+
def make_auto_repeat(**args):
args = frappe._dict(args)
From a358bcdc33246b81120ff8ee558e51b2cfdd5e41 Mon Sep 17 00:00:00 2001
From: Shivam Mishra
Date: Mon, 11 May 2020 14:07:21 +0530
Subject: [PATCH 114/336] feat: add form tour as onboarding option
---
.../doctype/onboarding_step/onboarding_step.js | 18 ++++++++++++++++++
.../onboarding_step/onboarding_step.json | 15 ++++++++++++---
2 files changed, 30 insertions(+), 3 deletions(-)
diff --git a/frappe/desk/doctype/onboarding_step/onboarding_step.js b/frappe/desk/doctype/onboarding_step/onboarding_step.js
index 3e5d4d4260..793e044d98 100644
--- a/frappe/desk/doctype/onboarding_step/onboarding_step.js
+++ b/frappe/desk/doctype/onboarding_step/onboarding_step.js
@@ -25,6 +25,24 @@ frappe.ui.form.on("Onboarding Step", {
}
},
+ action: function(frm) {
+ if (frm.doc.action == "Show Form Tour") {
+ frm.fields_dict.reference_document.set_description(`You need to add the steps in the contoller JS file. For example:
Date: Mon, 11 May 2020 14:07:55 +0530
Subject: [PATCH 115/336] feat: add on_finish hook for tour
---
frappe/public/js/frappe/form/form.js | 8 ++++-
.../js/frappe/widgets/onboarding_widget.js | 35 ++++++++++++++++++-
2 files changed, 41 insertions(+), 2 deletions(-)
diff --git a/frappe/public/js/frappe/form/form.js b/frappe/public/js/frappe/form/form.js
index 41bde104dd..3742ea36dc 100644
--- a/frappe/public/js/frappe/form/form.js
+++ b/frappe/public/js/frappe/form/form.js
@@ -1557,7 +1557,7 @@ frappe.ui.form.Form = class FrappeForm {
}, 1000);
}
- show_tour() {
+ show_tour(on_finish) {
if (!frappe.tour.hasOwnProperty(this.doctype) || !Array.isArray(frappe.tour[this.doctype])) {
return
}
@@ -1567,6 +1567,12 @@ frappe.ui.form.Form = class FrappeForm {
keyboardControl: true,
nextBtnText: 'Next', // Next button text for this step
prevBtnText: 'Previous',
+ opacity: 0.25,
+ onNext: (el) => {
+ if (!driver.hasNextStep()) {
+ on_finish && on_finish();
+ }
+ }
});
this.layout.sections.forEach(section => section.collapse(false))
diff --git a/frappe/public/js/frappe/widgets/onboarding_widget.js b/frappe/public/js/frappe/widgets/onboarding_widget.js
index 78305edd5d..f9abbaf64e 100644
--- a/frappe/public/js/frappe/widgets/onboarding_widget.js
+++ b/frappe/public/js/frappe/widgets/onboarding_widget.js
@@ -57,6 +57,7 @@ export default class OnboardingWidget extends Widget {
let actions = {
"Watch Video": () => this.show_video(step),
"Create Entry": () => this.show_quick_entry(step),
+ "Show Form Tour": () => this.show_form_tour(step),
"Update Settings": () => this.update_settings(step),
"View Report": () => this.open_report(step),
};
@@ -86,7 +87,9 @@ export default class OnboardingWidget extends Widget {
primary_action: {
action: () => {
msg_dialog.hide();
- this.mark_complete(step);
+ frappe.set_route(current_route).then(() => {
+ this.mark_complete(step);
+ });
},
label: () => __("Continue"),
},
@@ -105,6 +108,36 @@ export default class OnboardingWidget extends Widget {
});
}
+ show_form_tour(step) {
+ let route;
+ if (step.is_single) {
+ route = `Form/${step.reference_document}`
+ } else {
+ route = `Form/${step.reference_document}/New ${step.reference_document}`
+ }
+
+ frappe.route_options = {};
+ frappe.route_options.after_load = (frm) => {
+ frm.show_tour(() => {
+ let msg_dialog = frappe.msgprint({
+ message: __("Let's take you back to onboarding"),
+ title: __("Great Job"),
+ primary_action: {
+ action: () => {
+ frappe.set_route(current_route).then(() => {
+ this.mark_complete(step);
+ });
+ msg_dialog.hide();
+ },
+ label: () => __("Continue"),
+ }
+ });
+ });
+ };
+
+ frappe.set_route(route)
+ }
+
update_settings(step) {
let current_route = frappe.get_route();
From 986504d46d7960fe2cb272111e3d02fa33a23f9f Mon Sep 17 00:00:00 2001
From: Shivam Mishra
Date: Mon, 11 May 2020 14:19:22 +0530
Subject: [PATCH 116/336] fix: routing bug for tour
---
frappe/public/js/frappe/widgets/onboarding_widget.js | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/frappe/public/js/frappe/widgets/onboarding_widget.js b/frappe/public/js/frappe/widgets/onboarding_widget.js
index f9abbaf64e..94b73d0c8b 100644
--- a/frappe/public/js/frappe/widgets/onboarding_widget.js
+++ b/frappe/public/js/frappe/widgets/onboarding_widget.js
@@ -78,6 +78,7 @@ export default class OnboardingWidget extends Widget {
doctype: step.report_reference_doctype
});
+
let current_route = frappe.get_route();
frappe.set_route(route).then(() => {
@@ -86,10 +87,10 @@ export default class OnboardingWidget extends Widget {
title: __(step.reference_report),
primary_action: {
action: () => {
- msg_dialog.hide();
frappe.set_route(current_route).then(() => {
this.mark_complete(step);
});
+ msg_dialog.hide();
},
label: () => __("Continue"),
},
@@ -116,6 +117,8 @@ export default class OnboardingWidget extends Widget {
route = `Form/${step.reference_document}/New ${step.reference_document}`
}
+ let current_route = frappe.get_route();
+
frappe.route_options = {};
frappe.route_options.after_load = (frm) => {
frm.show_tour(() => {
From 451772dfab13abfb440c199c34d67887cf1921d9 Mon Sep 17 00:00:00 2001
From: Gavin D'souza
Date: Mon, 11 May 2020 15:47:19 +0530
Subject: [PATCH 117/336] refactor(commands): migrate-to frappecloud connector
---
frappe/commands/site.py | 67 +------------
frappe/utils/remote_migrations.py | 151 ++++++++++++++++++++++++++++++
requirements.txt | 1 +
3 files changed, 155 insertions(+), 64 deletions(-)
create mode 100644 frappe/utils/remote_migrations.py
diff --git a/frappe/commands/site.py b/frappe/commands/site.py
index d5329d4cf9..058554cff6 100755
--- a/frappe/commands/site.py
+++ b/frappe/commands/site.py
@@ -263,70 +263,9 @@ def migrate(context, rebuild_website=False, skip_failing=False):
@click.argument('site_url')
@pass_context
def migrate_to(context, site_url):
- '''
- >>> import requests
- >>> session = requests.Session()
- >>> session.post("http://cloud:8002/api/method/login", {"usr":"gavin18d@gmail.com", "pwd":"bfdiljn;jnd"})
-
- >>> session.headers.update({"X-Press-Team": "gavin18d@gmail.com"})
- >>> session.post("http://cloud:8002/api/method/press.api.site.options_for_new").json()
- '''
-
- if site_url in ("frappe.cloud", "frappecloud.com"):
- site_url = "frappe.cloud"
-
- login_url = "https://{site_url}/api/method/login"
- upload_url = "https://{site_url}/api/method/press.api.site.new_from_existing_account"
- options_url = "https://{site_url}/api/method/press.api.site.options_for_new"
-
- else:
- print(f"{site_url} is not supported yet")
- sys.exit(1)
-
- for site in context.site:
- username = input()
- password = getpass.unix_getpass()
- auth_credentials = {"usr": username, "pwd": password}
-
- # create frapp_cloud session
- session = requests.Session()
- login_sc = session.post(login_url, auth_credentials)
-
- if login_sc.ok:
- print(f"Auth Successful w {site_url}")
-
- # get options
- session.headers.update({"X-Press-Team": username})
- site_options_sc = session.post(options_url)
-
- if site_options_sc.ok:
- site_options = site_options_sc.json()
-
- else:
- print(f"Request failed with Status Code: {site_options_sc.status_code}")
- sys.exit(1)
-
- # set preferences from options
-
- # take backup
- import frappe.utils.backups
- print(f"Taking backup for site {site}")
- odb = frappe.utils.backups.new_backup(ignore_files=False, force=True)
-
- # relative paths here
- odb.backup_path_db
- odb.backup_path_files
- odb.backup_path_private_files
-
- site_files = {
- "files": []
- }
-
- # push to frappe_cloud
- session.post(upload_url, files=site_files)
-
- else:
- print(f"Request failed with Status Code: {login_sc.status_code}")
+ from frappe.utils.remote_migrations import migrate_to
+ for site in context.sites:
+ migrate_to(site, site_url)
@click.command('run-patch')
diff --git a/frappe/utils/remote_migrations.py b/frappe/utils/remote_migrations.py
new file mode 100644
index 0000000000..7664411474
--- /dev/null
+++ b/frappe/utils/remote_migrations.py
@@ -0,0 +1,151 @@
+import getpass
+import sys
+
+import requests
+from terminaltables import AsciiTable
+
+import frappe
+import frappe.utils.backups
+
+
+def choose(plans_list):
+ plans_table = []
+ available_plans = []
+ selected_plan = None
+
+ print(f"{len(plans_list)} plans available")
+
+ plans_table.append([x for x in plans_list[0].keys()])
+ for plan in plans_list:
+ row_data = [x for x in plan.values()]
+ available_plans.append(row_data[0])
+ plans_table.append(row_data)
+
+ print(AsciiTable(plans_table).table)
+
+ while True:
+ if selected_plan:
+ break
+ else:
+ input_plan = input("Send plan?: ")
+ if input_plan in available_plans:
+ return selected_plan
+ else:
+ print("Invalid selection...try again")
+
+
+def filter_apps(app_groups):
+ from frappe.utils import get_installed_apps_info
+
+ allowed_apps = []
+ filtered_apps = []
+ existing_apps = []
+
+ for group in app_groups:
+ for app in group.get("apps"):
+ app_name = group.get('scrubbed')
+ branch = group.get('branch')
+ allowed_apps.append(tuple(app_name, branch))
+
+ for app in get_installed_apps_info():
+ app_name = app.get('app_name')
+ branch = app.get('branch')
+ existing_apps.append(tuple(app_name, branch))
+
+ filtered_apps = [app[0] for app in existing_apps if app in allowed_apps]
+
+ return "Vanilla Version 12", filtered_apps
+
+
+def migrate_to(local_site, remote_site):
+ if remote_site in ("frappe.cloud", "frappecloud.com"):
+ remote_site = "cloud:8002"
+ # remote_site = "frappecloud.com"
+ return frappecloud_migrator(local_site, remote_site)
+ else:
+ print(f"{remote_site} is not supported yet")
+ sys.exit(1)
+
+
+def frappecloud_migrator(local_site, remote_site):
+ # test:
+ login_url = f"http://{remote_site}/api/method/login"
+ upload_url = f"http://{remote_site}/api/method/press.api.site.new"
+ files_url = f"http://{remote_site}/api/method/upload_file"
+ options_url = f"http://{remote_site}/api/method/press.api.site.options_for_new"
+
+ # production:
+ # login_url = f"https://{remote_site}/api/method/login"
+ # upload_url = f"https://{remote_site}/api/method/press.api.site.new_from_existing_account"
+ # options_url = f"https://{remote_site}/api/method/press.api.site.options_for_new"
+
+ print(f"Frappe Cloud credentials @ {remote_site}")
+
+ username = input("Username: ")
+ password = getpass.unix_getpass()
+ auth_credentials = {"usr": username, "pwd": password}
+
+ # create frapp_cloud session
+ session = requests.Session()
+ login_sc = session.post(login_url, auth_credentials)
+
+ if login_sc.ok:
+ print(f"Authorization Successful!")
+
+ # get options
+ session.headers.update({"X-Press-Team": username})
+ site_options_sc = session.post(options_url)
+
+ if site_options_sc.ok:
+ site_options = site_options_sc.json()["message"]
+ app_groups = site_options_sc.json()["groups"]
+
+ else:
+ print(f"Request failed with Status Code: {site_options_sc.status_code}")
+ sys.exit(1)
+
+ # set preferences from options
+ subdomain = input("Enter subdomain: ")
+ plan = choose(site_options['plans'])
+
+ frappe.init(site=local_site)
+ frappe.connect()
+
+ # apps currently on site....vanilla.
+ selected_group, filtered_apps = filter_apps(app_groups)
+
+ # take backup
+ print(f"Taking backup for site {local_site}")
+ odb = frappe.utils.backups.new_backup(ignore_files=False, force=True)
+ files_session = {}
+
+ # upload files
+ for file_type, file_path in [("database", odb.backup_path_db), ("public", odb.backup_path_files), ("private", odb.backup_path_private_files)]:
+ file_upload_response = session.post(files_url, data={}, files={
+ "file": open(file_path, "rb"),
+ "is_private": 1,
+ "folder": "Home",
+ "method": "press.api.site.upload_backup",
+ "type": file_type
+ })
+ if file_upload_response.ok:
+ files_session[file_type] = file_upload_response.json()["message"]
+ else:
+ print(f"Upload failed for: {file_path}")
+
+ files_uploaded = { k, v["file_url"] for k, v in files_session.items() }
+
+ # push to frappe_cloud
+ session.post(upload_url, data={
+ "site": {
+ "apps": filtered_apps,
+ "files": files_uploaded,
+ "group": selected_group,
+ "name": subdomain,
+ "plan": plan
+ }
+ })
+ frappe.destroy()
+
+ else:
+ print(f"Request failed with Status Code: {login_sc.status_code}")
diff --git a/requirements.txt b/requirements.txt
index 6c22d66139..c4cb79892a 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -60,6 +60,7 @@ semantic-version==2.8.4
six==1.14.0
sqlparse==0.2.4
stripe==2.40.0
+terminaltables
unittest-xml-reporting==2.5.2
urllib3==1.25.8
watchdog==0.8.0
From 355393ed0a1307e3a4597a322ff7fe8167f6c11a Mon Sep 17 00:00:00 2001
From: Faris Ansari
Date: Mon, 11 May 2020 15:53:29 +0530
Subject: [PATCH 118/336] fix: Port Tailwind styles to Bootstrap 4 SCSS
---
frappe/public/scss/base.scss | 43 +++
frappe/public/scss/markdown.scss | 117 ++++++++
frappe/public/scss/page-builder.scss | 252 ++++++++++++++++++
frappe/public/scss/variables.scss | 39 ++-
frappe/public/scss/website-image.scss | 4 +-
frappe/public/scss/website.scss | 226 ++++++++++++----
.../templates/components/image_with_blur.html | 5 +-
frappe/templates/components/web_block.html | 7 +-
.../full_width_image/full_width_image.html | 2 +-
frappe/website/web_template/hero/hero.html | 17 +-
.../hero_with_right_image.html | 28 +-
.../web_template/markdown/markdown.html | 6 +-
.../section_with_cards.html | 66 +++--
.../section_with_cta/section_with_cta.html | 24 +-
.../section_with_image.html | 6 +-
.../section_with_left_image.html | 10 +-
.../section_with_tabs/section_with_tabs.html | 128 +++------
17 files changed, 743 insertions(+), 237 deletions(-)
create mode 100644 frappe/public/scss/base.scss
create mode 100644 frappe/public/scss/markdown.scss
create mode 100644 frappe/public/scss/page-builder.scss
diff --git a/frappe/public/scss/base.scss b/frappe/public/scss/base.scss
new file mode 100644
index 0000000000..a00996780e
--- /dev/null
+++ b/frappe/public/scss/base.scss
@@ -0,0 +1,43 @@
+html {
+ height: 100%;
+}
+
+body {
+ -webkit-font-smoothing: antialiased;
+ font-size: 16px;
+ color: $black;
+}
+
+img {
+ max-width: 100%;
+ height: auto;
+}
+
+h1 {
+ font-size: $font-size-3xl;
+ font-weight: 800;
+ line-height: 1.25;
+ letter-spacing: -0.025em;
+
+ @include media-breakpoint-up(sm) {
+ line-height: 2.5rem;
+ font-size: $font-size-4xl;
+ }
+ @include media-breakpoint-up(xl) {
+ line-height: 1;
+ font-size: $font-size-5xl;
+ }
+}
+
+h2 {
+ font-size: $font-size-xl;
+ font-weight: bold;
+
+ @include media-breakpoint-up(sm) {
+ font-size: $font-size-2xl;
+ }
+ @include media-breakpoint-up(md) {
+ font-size: $font-size-3xl;
+ }
+}
+
diff --git a/frappe/public/scss/markdown.scss b/frappe/public/scss/markdown.scss
new file mode 100644
index 0000000000..440a4cfe88
--- /dev/null
+++ b/frappe/public/scss/markdown.scss
@@ -0,0 +1,117 @@
+.from-markdown {
+ line-height: 1.625;
+
+ > * + * {
+ margin-top: 1rem;
+ }
+
+ > :first-child {
+ margin-top: 0;
+ }
+
+ ul,
+ ol {
+ padding-left: 2.5rem;
+ }
+
+ ul {
+ list-style-type: disc;
+ }
+
+ ol {
+ list-style: decimal;
+ }
+
+ li > * + * {
+ margin-top: 1rem;
+ }
+
+ > ul > * + *,
+ > ol > * + * {
+ margin-top: 1rem;
+ }
+
+ > blockquote {
+ padding: 0.75rem 1rem;
+ font-size: $font-size-sm;
+ font-weight: 500;
+ color: $gray-900;
+ border-left: 4px solid $yellow;
+ background-color: lighten($yellow, 42%);
+ border-top-left-radius: 0.1rem;
+ border-bottom-left-radius: 0.1rem;
+ border-top-right-radius: 0.375rem;
+ border-bottom-right-radius: 0.375rem;
+ margin: 1.5rem 0;
+ }
+
+ blockquote p:last-child {
+ margin-bottom: 0;
+ }
+
+ h1 + p {
+ max-width: 42rem;
+ margin-top: 0.75rem;
+ font-size: $font-size-base;
+ color: $gray-900;
+
+ @include media-breakpoint-up(sm) {
+ margin-top: 1.25rem;
+ font-size: 1.125rem;
+ }
+ @include media-breakpoint-up(md) {
+ font-size: 1.25rem;
+ }
+ }
+
+ h2 {
+ margin-bottom: 1rem;
+ margin-top: 3.5rem;
+ }
+
+ h3 {
+ margin-top: 3rem;
+ margin-bottom: 1rem;
+ font-weight: 600;
+ line-height: 1.25;
+ font-size: $font-size-xl;
+ }
+
+ h4 {
+ margin-top: 2.5rem;
+ margin-bottom: 1rem;
+ font-size: 1.125rem;
+ font-weight: 600;
+ line-height: 1.25;
+ }
+
+ h5 {
+ margin-top: 2rem;
+ margin-bottom: 1rem;
+ font-size: $font-size-base;
+ font-weight: 600;
+ line-height: 1.25;
+ }
+
+ h6 {
+ margin-top: 1.5rem;
+ margin-bottom: 1rem;
+ font-size: $font-size-sm;
+ font-weight: 600;
+ line-height: 1.25;
+ }
+
+ tr > td,
+ tr > th {
+ font-size: $font-size-sm;
+ }
+
+ th:empty {
+ display: none;
+ }
+
+ .screenshot {
+ border: 1px solid $gray-400;
+ border-radius: 0.375rem;
+ }
+}
diff --git a/frappe/public/scss/page-builder.scss b/frappe/public/scss/page-builder.scss
new file mode 100644
index 0000000000..8ba894ccf8
--- /dev/null
+++ b/frappe/public/scss/page-builder.scss
@@ -0,0 +1,252 @@
+.hero-subtitle {
+ @extend .lead;
+ max-width: 42rem;
+}
+
+.section-description {
+ max-width: 56rem;
+ margin-top: 0.5rem;
+ font-size: $font-size-base;
+ color: $gray-900;
+
+ @include media-breakpoint-up(lg) {
+ font-size: $font-size-lg;
+ }
+}
+
+.section-image {
+ margin-top: 2rem;
+ border-radius: 0.75rem;
+ width: 100%;
+}
+
+.section-padding {
+ padding-top: 3rem;
+ padding-bottom: 3rem;
+
+ @include media-breakpoint-up(sm) {
+ padding-top: 5rem;
+ padding-bottom: 5rem;
+ }
+ @include media-breakpoint-up(xl) {
+ padding-top: 8rem;
+ padding-bottom: 8rem;
+ }
+}
+
+.section-padding-top {
+ padding-top: 3rem;
+
+ @include media-breakpoint-up(sm) {
+ padding-top: 5rem;
+ }
+ @include media-breakpoint-up(xl) {
+ padding-top: 8rem;
+ }
+}
+
+.section-padding-bottom {
+ padding-bottom: 3rem;
+
+ @include media-breakpoint-up(sm) {
+ padding-bottom: 5rem;
+ }
+ @include media-breakpoint-up(xl) {
+ padding-bottom: 8rem;
+ }
+}
+
+.hero-with-right-image {
+ position: relative;
+
+ .hero-content {
+ display: flex;
+ align-items: center;
+ }
+
+ .hero-image {
+ width: auto;
+ display: none;
+ object-fit: contain;
+ max-height: 36rem;
+
+ &.contain-image {
+ right: 0;
+ }
+
+ @include media-breakpoint-up(md) {
+ display: block;
+ max-width: 28rem;
+ }
+ @include media-breakpoint-up(lg) {
+ max-width: 32rem;
+ }
+ @include media-breakpoint-up(xl) {
+ max-width: 42rem;
+ }
+ }
+}
+
+.card {
+ .card-title {
+ color: $black;
+ }
+
+ .card-body {
+ color: $gray-900;
+ }
+
+ &:hover {
+ border-color: $gray-600;
+ }
+
+ &.card-sm {
+ .card-body {
+ padding: 1.5rem;
+ }
+
+ .card-title {
+ font-size: $font-size-base;
+ font-weight: 600;
+ }
+
+ .card-text {
+ font-size: $font-size-sm;
+ }
+ }
+ &.card-md {
+ .card-body {
+ padding: 1.75rem;
+ }
+
+ .card-title {
+ font-size: $font-size-lg;
+ font-weight: 600;
+
+ @include media-breakpoint-up(md) {
+ font-size: $font-size-xl;
+ }
+ }
+ .card-text {
+ font-size: $font-size-base;
+ }
+ }
+ &.card-lg {
+ .card-body {
+ padding: 2rem;
+ }
+
+ .card-title {
+ font-size: $font-size-xl;
+ font-weight: bold;
+
+ @include media-breakpoint-up(md) {
+ font-size: $font-size-2xl;
+ }
+ }
+
+ .card-text {
+ font-size: $font-size-base;
+
+ @include media-breakpoint-up(xl) {
+ font-size: $font-size-lg;
+ }
+ }
+ }
+}
+
+.nav-tabs {
+ .nav-link.active,
+ .nav-item.show .nav-link {
+ color: darken($primary, 5%);
+ background-color: #fff;
+ border-bottom: 2px solid $primary;
+ }
+
+ .nav-link {
+ color: $gray-700;
+ font-weight: 500;
+ border: none;
+ padding: 1rem 0.5rem;
+ margin-right: 2rem;
+
+ &:hover {
+ color: $primary;
+ }
+ }
+}
+
+.section-markdown > .from-markdown {
+ max-width: 42rem;
+}
+
+.section-cta {
+ padding: 3rem 2rem;
+ text-align: center;
+ background-color: lighten($primary, 42%);
+ border-radius: 0.75rem;
+
+ @include media-breakpoint-up(sm) {
+ padding-left: 3rem;
+ padding-right: 3rem;
+ }
+ @include media-breakpoint-up(md) {
+ padding-top: 5rem;
+ padding-bottom: 5rem;
+ }
+
+ .title {
+ margin: 0 auto;
+ max-width: 36rem;
+ font-size: $font-size-2xl;
+ font-weight: 800;
+ line-height: 1.25;
+ @include media-breakpoint-up(md) {
+ font-size: $font-size-4xl;
+ }
+ }
+ .subtitle {
+ max-width: 36rem;
+ margin: 0 auto;
+ margin-top: 0.5rem;
+ font-size: $font-size-base;
+ color: $gray-900;
+ @include media-breakpoint-up(md) {
+ font-size: $font-size-lg;
+ }
+ }
+ .description {
+ max-width: 36rem;
+ margin: 0 auto;
+ margin-top: 0.5rem;
+ font-size: $font-size-xs;
+ color: $gray-900;
+ }
+}
+
+.section-cta-container {
+ position: relative;
+ .confetti {
+ position: absolute;
+ width: 1rem;
+ height: 1rem;
+ border-radius: 99999px;
+ }
+ .confetti-1 {
+ top: 0;
+ margin-top: -0.5rem;
+ background-color: #84e1bc;
+ left: 25%;
+ }
+ .confetti-2 {
+ background-color: #fdba8c;
+ top: 66.67%;
+ right: 16.67%;
+ }
+ .confetti-3 {
+ bottom: 0;
+ margin-bottom: -0.5rem;
+ background-color: #f8b4b4;
+ left: 16.67%;
+ }
+}
diff --git a/frappe/public/scss/variables.scss b/frappe/public/scss/variables.scss
index 6ee7cda884..e5f3a47f6f 100644
--- a/frappe/public/scss/variables.scss
+++ b/frappe/public/scss/variables.scss
@@ -8,14 +8,45 @@ $gray-600: #8d99a6 !default;
$gray-700: #495057 !default;
$gray-800: #36414c !default;
$gray-900: #2e3338 !default;
-$primary: #5e64ff !default;
+$primary: #2490ef !default;
$black: #000 !default;
$body-color: $gray-800 !default;
$text-muted: $gray-600 !default;
-$border-color: $gray-200 !default;
+$border-color: $gray-300 !default;
-@import "~bootstrap/scss/functions";
-@import "~bootstrap/scss/variables";
+$font-size-xs: 0.75rem !default;
+$font-size-sm: 0.875rem !default;
+$font-size-base: 1rem !default;
+$font-size-lg: 1.125rem !default;
+$font-size-xl: 1.25rem !default;
+$font-size-2xl: 1.5rem !default;
+$font-size-3xl: 1.875rem !default;
+$font-size-4xl: 2.25rem !default;
+$font-size-5xl: 3rem !default;
+$font-size-6xl: 4rem !default;
+$btn-padding-y-lg: 1rem !default;
+$btn-padding-x-lg: 2.5rem !default;
+$btn-font-size-lg: 1.125rem !default;
+$btn-line-height-lg: 1 !default;
+$btn-border-radius-lg: 0.5rem !default;
+$btn-border-radius: 0.375rem !default;
+$btn-font-size: $font-size-sm;
+$btn-padding-x: 1rem !default;
+$btn-padding-y: 0.5rem !default;
+$btn-font-weight: 500 !default;
+
+$navbar-nav-link-padding-x: 1rem !default;
+$navbar-padding-y: 1rem;
+$card-border-radius: 0.75rem !default;
+$card-spacer-y: 1rem !default;
+
+$dropdown-font-size: $font-size-sm !default;
+$dropdown-border-radius: 0.375rem !default;
+$dropdown-item-padding-y: 0.5rem !default;
+$dropdown-item-padding-x: 0.5rem !default;
+
+@import '~bootstrap/scss/functions';
+@import '~bootstrap/scss/variables';
diff --git a/frappe/public/scss/website-image.scss b/frappe/public/scss/website-image.scss
index 18adae4acc..8c32e821fe 100644
--- a/frappe/public/scss/website-image.scss
+++ b/frappe/public/scss/website-image.scss
@@ -34,7 +34,7 @@ img:after {
display: flex;
justify-content: center;
align-items: center;
- font-size: 3rem;
+ font-size: $font-size-5xl;
color: $gray-300;
background: $light;
}
@@ -85,4 +85,4 @@ img:after {
.object-fit-cover {
object-fit: cover;
-}
\ No newline at end of file
+}
diff --git a/frappe/public/scss/website.scss b/frappe/public/scss/website.scss
index 6f82e25ee0..4fbd57bc0b 100644
--- a/frappe/public/scss/website.scss
+++ b/frappe/public/scss/website.scss
@@ -1,31 +1,63 @@
-@import "variables";
-@import "frappe/public/css/font-awesome";
-@import "~bootstrap/scss/bootstrap";
-@import "multilevel-dropdown";
-@import "website-image";
+@import 'variables';
+@import 'frappe/public/css/font-awesome';
+@import '~bootstrap/scss/bootstrap';
+@import 'base';
+@import 'multilevel-dropdown';
+@import 'website-image';
+@import 'page-builder';
+@import 'markdown';
-html {
- height: 100%;
+.container {
+ padding-left: 1.25rem;
+ padding-right: 1.25rem;
}
-body {
- min-height: 100%;
- display: flex;
- flex-direction: column;
- font-size: 16px;
-
- > div {
- flex: 1 0 auto;
+@include media-breakpoint-up(sm) {
+ .container {
+ padding-left: 1rem;
+ padding-right: 1rem;
}
}
-footer {
- flex-shrink: 0;
+@include media-breakpoint-up(md) {
+ .container {
+ padding-left: 1rem;
+ padding-right: 1rem;
+ }
+}
+
+@include media-breakpoint-up(lg) {
+ .container {
+ padding-left: 1rem;
+ padding-right: 1rem;
+ }
+}
+
+@include media-breakpoint-up(xl) {
+ .container {
+ padding-left: 1.5rem;
+ padding-right: 1.5rem;
+ }
+}
+
+.navbar-light {
+ border-bottom: 1px solid $border-color;
+}
+
+.navbar-light .navbar-nav .nav-link {
+ color: $gray-900;
+ font-size: $font-size-sm;
+ font-weight: 500;
+
+ &:hover,
+ &:focus, &.active {
+ color: $primary;
+ }
}
.navbar.bg-dark {
.dropdown-menu {
- font-size: .75rem;
+ font-size: 0.75rem;
background-color: $dark;
border-radius: 0;
}
@@ -53,6 +85,13 @@ footer {
}
}
+.dropdown-menu {
+ padding: 0.25rem;
+}
+
+.dropdown-item {
+ border-radius: $dropdown-border-radius;
+}
.input-dark {
background-color: $dark;
@@ -61,25 +100,21 @@ footer {
}
.breadcrumb {
- padding-left: 0;
- padding-right: 0;
- background-color: white;
+ padding-left: 0;
+ padding-right: 0;
+ background-color: white;
}
a.card {
text-decoration: none;
}
-img {
- max-width: 100%;
-}
-
.hidden {
@extend .d-none;
}
.hide-control {
- @extend .d-none;
+ @extend .d-none;
}
.text-underline {
@@ -90,10 +125,49 @@ img {
color: #d1d8dd !important;
}
+// footer
+
.web-footer {
padding: 5rem 0;
min-height: 140px;
- border-top: 1px solid $border-color;
+}
+
+.footer-logo {
+ width: 5rem;
+ height: 2rem;
+}
+
+.footer-col-left, .footer-col-right {
+ padding-top: 1rem;
+ padding-bottom: 1rem;
+}
+
+.footer-col-right {
+ @include media-breakpoint-up(sm) {
+ text-align: right;
+ }
+}
+
+.footer-col-left .footer-link {
+ margin-right: 1rem;
+}
+
+.footer-col-right .footer-link {
+ margin-right: 1rem;
+ @include media-breakpoint-up(sm) {
+ margin-right: 0;
+ margin-left: 1rem;
+ }
+}
+
+.footer-link, .footer-child-item a {
+ font-weight: 500;
+ color: $gray-900;
+
+ &:hover {
+ color: $primary;
+ text-decoration: none;
+ }
}
.footer-group-label {
@@ -101,41 +175,75 @@ img {
}
.footer-parent-item {
- margin-bottom: 1rem;
+ margin-bottom: 0.5rem;
+}
+
+.footer-info {
+ border-top: 1px solid $border-color;
+ color: $text-muted;
+ font-size: $font-size-sm;
}
.no-underline {
- text-decoration: none !important;
+ text-decoration: none !important;
}
.indicator {
- font-size: inherit;
+ font-size: inherit;
}
h4.modal-title {
- font-size: 1em;
+ font-size: 1em;
}
h5.modal-title {
- margin: 0px !important;
+ margin: 0px !important;
}
-.col-xs-1 { @extend .col-1; }
-.col-xs-2 { @extend .col-2; }
-.col-xs-3 { @extend .col-3; }
-.col-xs-4 { @extend .col-4; }
-.col-xs-5 { @extend .col-5; }
-.col-xs-6 { @extend .col-6; }
-.col-xs-7 { @extend .col-7; }
-.col-xs-8 { @extend .col-8; }
-.col-xs-9 { @extend .col-9; }
-.col-xs-10 { @extend .col-10; }
-.col-xs-11 { @extend .col-11; }
-.col-xs-12 { @extend .col-12; }
+.col-xs-1 {
+ @extend .col-1;
+}
+.col-xs-2 {
+ @extend .col-2;
+}
+.col-xs-3 {
+ @extend .col-3;
+}
+.col-xs-4 {
+ @extend .col-4;
+}
+.col-xs-5 {
+ @extend .col-5;
+}
+.col-xs-6 {
+ @extend .col-6;
+}
+.col-xs-7 {
+ @extend .col-7;
+}
+.col-xs-8 {
+ @extend .col-8;
+}
+.col-xs-9 {
+ @extend .col-9;
+}
+.col-xs-10 {
+ @extend .col-10;
+}
+.col-xs-11 {
+ @extend .col-11;
+}
+.col-xs-12 {
+ @extend .col-12;
+}
-.btn-default { @extend .btn-light; }
+.btn-default {
+ @extend .btn-light;
+}
-.btn-xs { @extend .btn-sm; }
+.btn-xs {
+ @extend .btn-sm;
+}
.hidden-xs {
@extend .d-none;
@@ -160,3 +268,29 @@ h5.modal-title {
.pull-right {
float: right;
}
+
+.btn-primary-light {
+ $primary-light: lighten($primary, 42%);
+ @include button-variant(
+ $background: $primary-light,
+ $border: $primary-light,
+ $hover-background: lighten($primary-light, 1%),
+ $hover-border: $primary-light,
+ $active-background: lighten($primary-light, 1%),
+ $active-border: darken($primary-light, 12.5%)
+ );
+
+ color: darken($primary, 5%);
+ &:hover {
+ color: darken($primary, 5%);
+ }
+}
+
+.image-with-blur {
+ transition: filter 300ms ease-in-out;
+ filter: blur(1.5rem);
+}
+
+.image-loaded {
+ filter: blur(0rem);
+}
diff --git a/frappe/templates/components/image_with_blur.html b/frappe/templates/components/image_with_blur.html
index cbee369608..20b0380b88 100644
--- a/frappe/templates/components/image_with_blur.html
+++ b/frappe/templates/components/image_with_blur.html
@@ -1,6 +1,6 @@
{%- set res = frappe.utils.get_thumbnail_base64_for_image(src) if src else false -%}
{%- if res and res['base64'].startswith('data:') -%}
-
{%- else -%}
@@ -18,8 +18,7 @@
img.onload = function () {
image.src = image_source;
- image.classList.remove('blur-md');
- image.classList.add('blur-none');
+ image.classList.add('image-loaded');
};
if (image_source) {
diff --git a/frappe/templates/components/web_block.html b/frappe/templates/components/web_block.html
index f0ed8f2df4..1da71036c2 100644
--- a/frappe/templates/components/web_block.html
+++ b/frappe/templates/components/web_block.html
@@ -1,14 +1,15 @@
{%- set htmltag = htmltag or 'section' -%}
{%- set classes = resolve_class([
{
- 'py-12 sm:py-20 xl:py-32': web_block.add_padding,
- 'bg-gray-100': web_block.add_shade,
+ 'section-padding-top': web_block.add_top_padding,
+ 'section-padding-bottom': web_block.add_bottom_padding,
+ 'bg-light': web_block.add_shade,
},
web_block.css_class
]) -%}
{%- if not web_block.hide_block -%}
-<{{htmltag}} class="{{ classes }}" data-section-idx="{{ web_block.idx | e }}"
+<{{htmltag}} class="section {{ classes }}" data-section-idx="{{ web_block.idx | e }}"
data-section-template="{{ web_block.web_template | e }}">
{%- if web_block.add_container -%}
+
+ `);
+ this.body.append(this.$heatmap_legend);
}
}
diff --git a/frappe/public/less/desktop.less b/frappe/public/less/desktop.less
index 1e64533079..da59fd8c0a 100644
--- a/frappe/public/less/desktop.less
+++ b/frappe/public/less/desktop.less
@@ -293,6 +293,54 @@
}
}
+ &.dashboard-widget-box.heatmap-chart {
+ min-height: 0px;
+ height: 180px;
+
+ .widget-footer {
+ display: none;
+ }
+
+ .frappe-chart .chart-legend {
+ display: none;
+ }
+
+ .widget-body {
+ display: flex;
+ max-height: 100%;
+
+ .chart-container {
+ margin-left: 65px;
+ margin-top: -15px;
+ }
+
+ .heatmap-legend {
+ display: flex;
+ height: 100%;
+ margin-top: 30px;
+
+ .legend-colors {
+ padding-left: 1;
+ padding-left: 15px;
+ list-style: none;
+ }
+
+ li {
+ width: 10px;
+ height: 10px;
+ margin: 5px;
+ }
+
+ .legend-label {
+ color: #555b51;
+ font-size: 11px;
+ margin-left: 15px;
+ line-height: 1.6em;
+ }
+ }
+ }
+ }
+
&.onboarding-widget-box {
margin-bottom: 50px;
margin-top: 10px;
From 08eeb8350f6494deef8b7222dc5b9e7747452297 Mon Sep 17 00:00:00 2001
From: prssanna -
+
+
+
+
+
+
+
+ ${__("Less")}
+ ${__("More")}
+
diff --git a/frappe/public/less/desktop.less b/frappe/public/less/desktop.less
index 44c5636731..fbd7f988a3 100644
--- a/frappe/public/less/desktop.less
+++ b/frappe/public/less/desktop.less
@@ -301,6 +301,10 @@
display: none;
}
+ .widget-control {
+ z-index: 1;
+ }
+
.frappe-chart .chart-legend {
display: none;
}
@@ -308,16 +312,19 @@
.widget-body {
display: flex;
max-height: 100%;
+ margin: auto;
+ margin-top: -15px;
.chart-container {
- margin-left: 65px;
- margin-top: -15px;
+ height: 100%;
+ .frappe-chart {
+ height: 100%;
+ }
}
.heatmap-legend {
display: flex;
- height: 100%;
- margin-top: 30px;
+ margin: 45px 20px 0 20px;
.legend-colors {
padding-left: 1;
@@ -337,13 +344,17 @@
margin-left: 15px;
line-height: 1.6em;
}
+
+ @media (max-width: 991px) {
+ display: none;
+ }
}
}
- }
- @media (max-width: 768px) {
- &.dashboard-widget-box.heatmap-chart {
- display: none;
+ @media (max-width: 768px) {
+ .heatmap-chart {
+ display: none;
+ }
}
}
From fe31522cf58376b6db2f99b7d8dd0bdde9b69bd9 Mon Sep 17 00:00:00 2001
From: prssanna
Date: Tue, 5 May 2020 18:27:30 +0530
Subject: [PATCH 097/336] feat: add year field for heatmap charts
---
.../dashboard_chart/dashboard_chart.js | 10 ++++++++++
.../dashboard_chart/dashboard_chart.json | 9 ++++++++-
.../dashboard_chart/dashboard_chart.py | 20 ++++++++++++++-----
frappe/desk/page/user_profile/user_profile.js | 19 ++----------------
.../public/js/frappe/utils/dashboard_utils.js | 16 +++++++++++++++
.../public/js/frappe/widgets/chart_widget.js | 9 ++++++++-
6 files changed, 59 insertions(+), 24 deletions(-)
diff --git a/frappe/desk/doctype/dashboard_chart/dashboard_chart.js b/frappe/desk/doctype/dashboard_chart/dashboard_chart.js
index 4c525e56b3..90e8ce288a 100644
--- a/frappe/desk/doctype/dashboard_chart/dashboard_chart.js
+++ b/frappe/desk/doctype/dashboard_chart/dashboard_chart.js
@@ -58,6 +58,7 @@ frappe.ui.form.on('Dashboard Chart', {
}
});
frm.trigger('update_options');
+ frm.trigger('set_heatmap_year_options');
if (frm.doc.report_name) {
frm.trigger('set_chart_report_filters');
}
@@ -71,6 +72,15 @@ frappe.ui.form.on('Dashboard Chart', {
frm.trigger("show_filters");
},
+ set_heatmap_year_options: function(frm) {
+ if (frm.doc.type == 'Heatmap') {
+ frappe.db.get_doc('System Settings').then(doc => {
+ const creation_date = doc.creation;
+ frm.set_df_property('heatmap_year', 'options', frappe.dashboard_utils.get_years_since_creation(creation_date));
+ });
+ }
+ },
+
chart_type: function(frm) {
frm.trigger('set_time_series');
if (frm.doc.chart_type == 'Report') {
diff --git a/frappe/desk/doctype/dashboard_chart/dashboard_chart.json b/frappe/desk/doctype/dashboard_chart/dashboard_chart.json
index 19d358c8c5..e377ef740e 100644
--- a/frappe/desk/doctype/dashboard_chart/dashboard_chart.json
+++ b/frappe/desk/doctype/dashboard_chart/dashboard_chart.json
@@ -23,6 +23,7 @@
"number_of_groups",
"column_break_6",
"is_public",
+ "heatmap_year",
"timespan",
"from_date",
"to_date",
@@ -229,10 +230,16 @@
"fieldname": "is_public",
"fieldtype": "Check",
"label": "Is Public"
+ },
+ {
+ "depends_on": "eval: doc.type == 'Heatmap'",
+ "fieldname": "heatmap_year",
+ "fieldtype": "Select",
+ "label": "Year"
}
],
"links": [],
- "modified": "2020-04-23 13:01:07.178866",
+ "modified": "2020-05-01 19:45:01.669384",
"modified_by": "Administrator",
"module": "Desk",
"name": "Dashboard Chart",
diff --git a/frappe/desk/doctype/dashboard_chart/dashboard_chart.py b/frappe/desk/doctype/dashboard_chart/dashboard_chart.py
index 21af41adad..529e60f3a2 100644
--- a/frappe/desk/doctype/dashboard_chart/dashboard_chart.py
+++ b/frappe/desk/doctype/dashboard_chart/dashboard_chart.py
@@ -8,7 +8,7 @@ from frappe import _
import datetime
import json
from frappe.utils.dashboard import cache_source, get_from_date_from_timespan
-from frappe.utils import nowdate, add_to_date, getdate, get_last_day, formatdate, get_datetime
+from frappe.utils import nowdate, add_to_date, getdate, get_last_day, formatdate, get_datetime, cint
from frappe.model.naming import append_number_if_name_exists
from frappe.boot import get_allowed_reports
from frappe.model.document import Document
@@ -182,18 +182,28 @@ def get_heatmap_chart_config(chart, filters):
value_field = chart.value_based_on or '1'
doctype = chart.document_type
datefield = chart.based_on
- filters.append([doctype, datefield, '>', 'subdate(curdate(), interval 1 year)', False])
+ year = cint(chart.heatmap_year) if chart.heatmap_year else getdate(nowdate()).year
+ year_start_date = datetime.date(year, 1, 1).strftime('%Y-%m-%d')
+ next_year_start_date = datetime.date(year + 1, 1, 1).strftime('%Y-%m-%d')
+
+ filters.append([doctype, datefield, '>', "{date}".format(date=year_start_date), False])
+ filters.append([doctype, datefield, '<', "{date}".format(date=next_year_start_date), False])
+
+ if frappe.db.db_type == 'mariadb':
+ timestamp_field = 'unix_timestamp({datefield})'.format(datefield=datefield)
+ else:
+ timestamp_field = 'extract(epoch from timestamp {datefield})'.format(datefield=datefield)
data = dict(frappe.db.get_all(
doctype,
fields = [
- 'unix_timestamp(date({datefield}))'.format(datefield=datefield),
+ timestamp_field,
'{aggregate_function}({value_field})'.format(aggregate_function=aggregate_function, value_field=value_field),
],
filters = filters,
- group_by = 'date(creation)',
+ group_by = 'date({datefield})'.format(datefield=datefield),
as_list = 1,
- order_by = 'creation asc',
+ order_by = '{datefield} asc'.format(datefield=datefield),
ignore_ifnull = True
))
diff --git a/frappe/desk/page/user_profile/user_profile.js b/frappe/desk/page/user_profile/user_profile.js
index ff1e906cff..c43ff27ba3 100644
--- a/frappe/desk/page/user_profile/user_profile.js
+++ b/frappe/desk/page/user_profile/user_profile.js
@@ -108,21 +108,6 @@ class UserProfile {
});
}
- get_years_since_creation() {
- //Get years since user account created
- this.user_creation = frappe.boot.user.creation;
- let creation_year = this.get_year(this.user_creation);
- let current_year = this.get_year(frappe.datetime.now_date());
- let years_list = [];
- for (var year = current_year; year >= creation_year; year--) {
- years_list.push(year);
- }
- return years_list;
- }
-
- get_year(date_str) {
- return date_str.substring(0, date_str.indexOf('-'));
- }
render_line_chart() {
this.line_chart_filters = [['Energy Point Log', 'user', '=', this.user_id, false]];
@@ -246,8 +231,8 @@ class UserProfile {
create_heatmap_chart_filters() {
let filters = [
{
- label: this.get_year(frappe.datetime.now_date()),
- options: this.get_years_since_creation(),
+ label: frappe.dashboard_utils.get_year(frappe.datetime.now_date()),
+ options: frappe.dashboard_utils.get_years_since_creation(frappe.boot.user.creation),
action: (selected_item) => {
this.update_heatmap_data(frappe.datetime.obj_to_str(selected_item));
}
diff --git a/frappe/public/js/frappe/utils/dashboard_utils.js b/frappe/public/js/frappe/utils/dashboard_utils.js
index a1628be34a..d1621a3e15 100644
--- a/frappe/public/js/frappe/utils/dashboard_utils.js
+++ b/frappe/public/js/frappe/utils/dashboard_utils.js
@@ -82,5 +82,21 @@ frappe.dashboard_utils = {
).then(settings => {
return settings;
});
+ },
+
+ get_years_since_creation(creation) {
+ //Get years since user account created
+ let creation_year = this.get_year(creation);
+ let current_year = this.get_year(frappe.datetime.now_date());
+ let years_list = [];
+ for (var year = current_year; year >= creation_year; year--) {
+ years_list.push(year);
+ }
+ return years_list;
+ },
+
+ get_year(date_str) {
+ return date_str.substring(0, date_str.indexOf('-'));
}
+
};
\ No newline at end of file
diff --git a/frappe/public/js/frappe/widgets/chart_widget.js b/frappe/public/js/frappe/widgets/chart_widget.js
index b160afa1fa..f2753be32e 100644
--- a/frappe/public/js/frappe/widgets/chart_widget.js
+++ b/frappe/public/js/frappe/widgets/chart_widget.js
@@ -61,6 +61,7 @@ export default class ChartWidget extends Widget {
this.chart_wrapper = $(``);
this.chart_wrapper.appendTo(this.body);
+ this.$heatmap_legend = null;
this.set_chart_title();
}
@@ -288,7 +289,7 @@ export default class ChartWidget extends Widget {
},
{
label: __("Reset Chart"),
- action: "action-list",
+ action: "action-reset",
handler: () => {
this.reset_chart();
delete this.dashboard_chart;
@@ -529,6 +530,12 @@ export default class ChartWidget extends Widget {
}
};
+ if (this.chart_doc.type == "Heatmap") {
+ const heatmap_year = parseInt(this.chart_doc.heatmap_year || "2020");
+ chart_args.data.start = new Date(`${heatmap_year}-01-01`);
+ chart_args.data.end = new Date(`${heatmap_year+1}-01-01`);
+ }
+
return chart_args;
}
From 31a523a720c88c8141eaae04094a4d408d611ca7 Mon Sep 17 00:00:00 2001
From: prssanna
Date: Tue, 5 May 2020 19:21:51 +0530
Subject: [PATCH 098/336] feat: add year filter to heatmap charts
---
.../dashboard_chart/dashboard_chart.py | 10 +-
.../public/js/frappe/widgets/chart_widget.js | 131 ++++++++++--------
frappe/utils/dashboard.py | 1 +
3 files changed, 82 insertions(+), 60 deletions(-)
diff --git a/frappe/desk/doctype/dashboard_chart/dashboard_chart.py b/frappe/desk/doctype/dashboard_chart/dashboard_chart.py
index 529e60f3a2..e7e4aefe09 100644
--- a/frappe/desk/doctype/dashboard_chart/dashboard_chart.py
+++ b/frappe/desk/doctype/dashboard_chart/dashboard_chart.py
@@ -58,13 +58,13 @@ def has_permission(doc, ptype, user):
@frappe.whitelist()
@cache_source
def get(chart_name = None, chart = None, no_cache = None, filters = None, from_date = None,
- to_date = None, timespan = None, time_interval = None, refresh = None):
+ to_date = None, timespan = None, time_interval = None, heatmap_year=None, refresh = None):
if chart_name:
chart = frappe.get_doc('Dashboard Chart', chart_name)
else:
chart = frappe._dict(frappe.parse_json(chart))
-
+ heatmap_year = heatmap_year or chart.heatmap_year
timespan = timespan or chart.timespan
if timespan == 'Select Date Range':
@@ -88,7 +88,7 @@ def get(chart_name = None, chart = None, no_cache = None, filters = None, from_d
chart_config = get_group_by_chart_config(chart, filters)
else:
if chart.type == 'Heatmap':
- chart_config = get_heatmap_chart_config(chart, filters)
+ chart_config = get_heatmap_chart_config(chart, filters, heatmap_year)
else:
chart_config = get_chart_config(chart, filters, timespan, timegrain, from_date, to_date)
@@ -177,12 +177,12 @@ def get_chart_config(chart, filters, timespan, timegrain, from_date, to_date):
return chart_config
-def get_heatmap_chart_config(chart, filters):
+def get_heatmap_chart_config(chart, filters, heatmap_year):
aggregate_function = get_aggregate_function(chart.chart_type)
value_field = chart.value_based_on or '1'
doctype = chart.document_type
datefield = chart.based_on
- year = cint(chart.heatmap_year) if chart.heatmap_year else getdate(nowdate()).year
+ year = cint(heatmap_year) if heatmap_year else getdate(nowdate()).year
year_start_date = datetime.date(year, 1, 1).strftime('%Y-%m-%d')
next_year_start_date = datetime.date(year + 1, 1, 1).strftime('%Y-%m-%d')
diff --git a/frappe/public/js/frappe/widgets/chart_widget.js b/frappe/public/js/frappe/widgets/chart_widget.js
index f2753be32e..abd99e360d 100644
--- a/frappe/public/js/frappe/widgets/chart_widget.js
+++ b/frappe/public/js/frappe/widgets/chart_widget.js
@@ -115,58 +115,7 @@ export default class ChartWidget extends Widget {
}
render_time_series_filters() {
- if (this.chart_doc.type == 'Heatmap') {
- return;
- }
-
- let filters = [
- {
- label: this.chart_settings.timespan || this.chart_doc.timespan,
- options: [
- "Select Date Range",
- "Last Year",
- "Last Quarter",
- "Last Month",
- "Last Week"
- ],
- action: selected_item => {
- this.selected_timespan = selected_item;
-
- if (this.selected_timespan === "Select Date Range") {
- this.render_date_range_fields();
- } else {
- this.selected_from_date = null;
- this.selected_to_date = null;
- if (this.date_field_wrapper) {
- this.date_field_wrapper.hide();
-
- // Title maybe hidden becuase of date range fields
- // in half width chart
- this.title_field.show();
- this.head.css('flex-direction', "row");
- }
-
- this.save_chart_config_for_user({
- 'timespan': this.selected_timespan,
- 'from_date': null,
- 'to_date': null
-
- });
- this.fetch_and_update_chart();
- }
- }
- },
- {
- label: this.chart_settings.time_interval || this.chart_doc.time_interval,
- options: ["Yearly", "Quarterly", "Monthly", "Weekly", "Daily"],
- action: selected_item => {
- this.selected_time_interval = selected_item;
- this.save_chart_config_for_user({'time_interval': this.selected_time_interval});
- this.fetch_and_update_chart();
- }
- }
- ];
-
+ let filters = this.get_time_series_filters();
frappe.dashboard_utils.render_chart_filters(
filters,
"chart-actions",
@@ -175,12 +124,77 @@ export default class ChartWidget extends Widget {
);
}
+ get_time_series_filters() {
+ let filters;
+ if (this.chart_doc.type == 'Heatmap') {
+ filters = [{
+ label: this.chart_settings.heatmap_year || this.chart_doc.heatmap_year,
+ options: frappe.dashboard_utils.get_years_since_creation(frappe.boot.user.creation),
+ action: selected_item => {
+ this.selected_heatmap_year = selected_item;
+ this.save_chart_config_for_user({'heatmap_year': this.selected_heatmap_year});
+ this.fetch_and_update_chart();
+ }
+ }];
+ } else {
+ filters = [
+ {
+ label: this.chart_settings.timespan || this.chart_doc.timespan,
+ options: [
+ "Select Date Range",
+ "Last Year",
+ "Last Quarter",
+ "Last Month",
+ "Last Week"
+ ],
+ action: selected_item => {
+ this.selected_timespan = selected_item;
+
+ if (this.selected_timespan === "Select Date Range") {
+ this.render_date_range_fields();
+ } else {
+ this.selected_from_date = null;
+ this.selected_to_date = null;
+ if (this.date_field_wrapper) {
+ this.date_field_wrapper.hide();
+
+ // Title maybe hidden becuase of date range fields
+ // in half width chart
+ this.title_field.show();
+ this.head.css('flex-direction', "row");
+ }
+
+ this.save_chart_config_for_user({
+ 'timespan': this.selected_timespan,
+ 'from_date': null,
+ 'to_date': null
+
+ });
+ this.fetch_and_update_chart();
+ }
+ }
+ },
+ {
+ label: this.chart_settings.time_interval || this.chart_doc.time_interval,
+ options: ["Yearly", "Quarterly", "Monthly", "Weekly", "Daily"],
+ action: selected_item => {
+ this.selected_time_interval = selected_item;
+ this.save_chart_config_for_user({'time_interval': this.selected_time_interval});
+ this.fetch_and_update_chart();
+ }
+ }
+ ];
+ }
+ return filters;
+ }
+
fetch_and_update_chart() {
this.args = {
timespan: this.selected_timespan || this.chart_settings.timespan,
time_interval: this.selected_time_interval || this.chart_settings.time_interval,
from_date: this.selected_from_date || this.chart_settings.from_date,
- to_date: this.selected_to_date || this.chart_settings.to_date
+ to_date: this.selected_to_date || this.chart_settings.to_date,
+ heatmap_year: this.selected_heatmap_year || this.chart_settings.heatmap_year,
};
this.fetch(this.filters, true, this.args).then(data => {
@@ -406,6 +420,9 @@ export default class ChartWidget extends Widget {
this.save_chart_config_for_user(null, 1);
this.chart_settings = {};
this.filters = null;
+ this.selected_time_interval = null;
+ this.selected_timespan = null;
+ this.selected_heatmap_year = null;
}
save_chart_config_for_user(config, reset=0) {
@@ -473,7 +490,8 @@ export default class ChartWidget extends Widget {
time_interval: args && args.time_interval ? args.time_interval : null,
timespan: args && args.timespan ? args.timespan : null,
from_date: args && args.from_date ? args.from_date : null,
- to_date: args && args.to_date ? args.to_date : null
+ to_date: args && args.to_date ? args.to_date : null,
+ heatmap_year: args && args.heatmap_year ? args.heatmap_year : null,
};
}
return frappe.xcall(method, args);
@@ -531,7 +549,10 @@ export default class ChartWidget extends Widget {
};
if (this.chart_doc.type == "Heatmap") {
- const heatmap_year = parseInt(this.chart_doc.heatmap_year || "2020");
+ if (!this.chart_doc.heatmap_year) {
+ this.chart_doc.heatmap_year = frappe.dashboard_utils.get_year(frappe.datetime.now_date());
+ }
+ const heatmap_year = parseInt(this.selected_heatmap_year || this.chart_settings.heatmap_year || this.chart_doc.heatmap_year);
chart_args.data.start = new Date(`${heatmap_year}-01-01`);
chart_args.data.end = new Date(`${heatmap_year+1}-01-01`);
}
diff --git a/frappe/utils/dashboard.py b/frappe/utils/dashboard.py
index 7cc97ed3f9..8edcf085f0 100644
--- a/frappe/utils/dashboard.py
+++ b/frappe/utils/dashboard.py
@@ -41,6 +41,7 @@ def generate_and_cache_results(args, function, cache_key, chart):
to_date = args.to_date or None,
time_interval = args.time_interval or None,
timespan = args.timespan or None,
+ heatmap_year = args.heatmap_year or None
)
except TypeError as e:
if str(e) == "'NoneType' object is not iterable":
From a3bedcbef478dac49fe221854f2026d6415889a2 Mon Sep 17 00:00:00 2001
From: prssanna
Date: Tue, 5 May 2020 19:30:18 +0530
Subject: [PATCH 099/336] fix: fix media query to hide heatmap for smaller
widths
---
frappe/public/less/desktop.less | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/frappe/public/less/desktop.less b/frappe/public/less/desktop.less
index fbd7f988a3..6d4bbca8e8 100644
--- a/frappe/public/less/desktop.less
+++ b/frappe/public/less/desktop.less
@@ -350,11 +350,11 @@
}
}
}
+ }
- @media (max-width: 768px) {
- .heatmap-chart {
- display: none;
- }
+ @media (max-width: 768px) {
+ &.dashboard-widget-box.heatmap-chart {
+ display: none;
}
}
From f662d9011e803ece7644610a1eba1bba128f7bca Mon Sep 17 00:00:00 2001
From: prssanna
Date: Tue, 5 May 2020 23:03:51 +0530
Subject: [PATCH 100/336] fix: style for heatmap chart loading state
---
frappe/public/less/desktop.less | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/frappe/public/less/desktop.less b/frappe/public/less/desktop.less
index 6d4bbca8e8..eef0b29875 100644
--- a/frappe/public/less/desktop.less
+++ b/frappe/public/less/desktop.less
@@ -309,6 +309,10 @@
display: none;
}
+ .chart-loading-state {
+ height: 160px !important;
+ }
+
.widget-body {
display: flex;
max-height: 100%;
From 9eabcce714332aeed994cd30c3307bbd86e74b8e Mon Sep 17 00:00:00 2001
From: prssanna
Date: Tue, 5 May 2020 23:04:21 +0530
Subject: [PATCH 101/336] fix: undefined selected heatmap year
---
frappe/public/js/frappe/widgets/chart_widget.js | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/frappe/public/js/frappe/widgets/chart_widget.js b/frappe/public/js/frappe/widgets/chart_widget.js
index abd99e360d..4be9ce1fd9 100644
--- a/frappe/public/js/frappe/widgets/chart_widget.js
+++ b/frappe/public/js/frappe/widgets/chart_widget.js
@@ -549,9 +549,6 @@ export default class ChartWidget extends Widget {
};
if (this.chart_doc.type == "Heatmap") {
- if (!this.chart_doc.heatmap_year) {
- this.chart_doc.heatmap_year = frappe.dashboard_utils.get_year(frappe.datetime.now_date());
- }
const heatmap_year = parseInt(this.selected_heatmap_year || this.chart_settings.heatmap_year || this.chart_doc.heatmap_year);
chart_args.data.start = new Date(`${heatmap_year}-01-01`);
chart_args.data.end = new Date(`${heatmap_year+1}-01-01`);
@@ -616,6 +613,10 @@ export default class ChartWidget extends Widget {
let saved_filters = this.chart_settings.filters || null;
this.filters =
saved_filters || this.filters || JSON.parse(this.chart_doc.filters_json || "[]");
+
+ if (this.chart_doc.type == 'Heatmap' && !this.chart_doc.heatmap_year) {
+ this.chart_doc.heatmap_year = frappe.dashboard_utils.get_year(frappe.datetime.now_date());
+ }
}
get_settings() {
From 9b6f0a2e4c261e9256e8eda1ecc2b2b4d556a0f6 Mon Sep 17 00:00:00 2001
From: "Chinmay D. Pai"
Date: Fri, 8 May 2020 20:18:08 +0530
Subject: [PATCH 102/336] fix: use doctype instead of service name to send
email
Signed-off-by: Chinmay D. Pai
---
frappe/integrations/offsite_backup_utils.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/frappe/integrations/offsite_backup_utils.py b/frappe/integrations/offsite_backup_utils.py
index c280a1d9dd..7e80cb68c4 100644
--- a/frappe/integrations/offsite_backup_utils.py
+++ b/frappe/integrations/offsite_backup_utils.py
@@ -10,7 +10,7 @@ from frappe.utils import split_emails, get_backups_path
def send_email(success, service_name, doctype, email_field, error_status=None):
- recipients = get_recipients(service_name, email_field)
+ recipients = get_recipients(doctype, email_field)
if not recipients:
frappe.log_error("No Email Recipient found for {0}".format(service_name),
"{0}: Failed to send backup status email".format(service_name))
@@ -36,11 +36,11 @@ def send_email(success, service_name, doctype, email_field, error_status=None):
frappe.sendmail(recipients=recipients, subject=subject, message=message)
-def get_recipients(service_name, email_field):
+def get_recipients(doctype, email_field):
if not frappe.db:
frappe.connect()
- return split_emails(frappe.db.get_value(service_name, None, email_field))
+ return split_emails(frappe.db.get_value(doctype, None, email_field))
def get_latest_backup_file(with_files=False):
From cf200c195eeb2d15fc90c1ee156705cf594fd015 Mon Sep 17 00:00:00 2001
From: "mathieu.brunot"
Date: Fri, 8 May 2020 20:43:52 +0200
Subject: [PATCH 103/336] socketio_port default to null
Signed-off-by: mathieu.brunot
---
frappe/templates/base.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/frappe/templates/base.html b/frappe/templates/base.html
index 4ec9550820..dd5dd63a1f 100644
--- a/frappe/templates/base.html
+++ b/frappe/templates/base.html
@@ -65,7 +65,7 @@
frappe.ready_events.push(fn);
}
window.dev_server = {{ dev_server }};
- window.socketio_port = {{ (frappe.socketio_port or (3000 if dev_server else 80)) }};
+ window.socketio_port = {{ (frappe.socketio_port or 'null') }};
From a2a697b4d547369ed39c5bcdfdc2ab5fec1602ae Mon Sep 17 00:00:00 2001
From: Faris Ansari
Date: Sat, 9 May 2020 15:38:08 +0530
Subject: [PATCH 104/336] fix: Remove theme based_on from Website Theme
---
frappe/public/scss/website.scss | 11 ----
frappe/templates/base.html | 24 ++------
.../website_settings/website_settings.json | 6 +-
.../doctype/website_theme/website_theme.json | 55 +++----------------
.../doctype/website_theme/website_theme.py | 12 ++--
.../website_theme/website_theme_template.scss | 7 ++-
6 files changed, 24 insertions(+), 91 deletions(-)
diff --git a/frappe/public/scss/website.scss b/frappe/public/scss/website.scss
index 546110bd5c..6f82e25ee0 100644
--- a/frappe/public/scss/website.scss
+++ b/frappe/public/scss/website.scss
@@ -23,17 +23,6 @@ footer {
flex-shrink: 0;
}
-// make navbar padding consistent with the page
-.navbar {
- padding-left: 0;
- padding-right: 0;
-
- .container {
- padding-left: 15px;
- padding-right: 15px;
- }
-}
-
.navbar.bg-dark {
.dropdown-menu {
font-size: .75rem;
diff --git a/frappe/templates/base.html b/frappe/templates/base.html
index dd5dd63a1f..0a81712eb9 100644
--- a/frappe/templates/base.html
+++ b/frappe/templates/base.html
@@ -25,26 +25,10 @@
{{ head_html or "" }}
{%- endif %}
- {%- if theme.based_on == 'Bootstrap 4' or doctype != 'Web Page' -%}
- {%- if theme.theme_url -%}
-
- {%- else -%}
-
- {%- endif -%}
- {% else %}
- {%- if developer_mode -%}
-
-
- {%- else -%}
-
-
-
- {% endif %}
- {%- if theme.theme_css -%}
-
- {%- endif -%}
+ {%- if theme.theme_url -%}
+
+ {%- else -%}
+
{%- endif -%}
{%- for link in web_include_css %}
diff --git a/frappe/website/doctype/website_settings/website_settings.json b/frappe/website/doctype/website_settings/website_settings.json
index b2d765b81f..279b490c1a 100644
--- a/frappe/website/doctype/website_settings/website_settings.json
+++ b/frappe/website/doctype/website_settings/website_settings.json
@@ -161,20 +161,17 @@
"label": "Footer"
},
{
- "depends_on": "eval:doc.footer_type==='Standard'",
"fieldname": "copyright",
"fieldtype": "Data",
"label": "Copyright"
},
{
- "depends_on": "eval:doc.footer_type==='Standard'",
"description": "Address and other legal information you may want to put in the footer.",
"fieldname": "address",
"fieldtype": "Text Editor",
"label": "Address"
},
{
- "depends_on": "eval:doc.footer_type==='Standard'",
"fieldname": "footer_items",
"fieldtype": "Table",
"label": "Footer Items",
@@ -182,7 +179,6 @@
},
{
"default": "0",
- "depends_on": "eval:doc.footer_type==='Standard'",
"fieldname": "hide_footer_signup",
"fieldtype": "Check",
"label": "Hide Footer Signup"
@@ -337,7 +333,7 @@
"issingle": 1,
"links": [],
"max_attachments": 10,
- "modified": "2020-04-30 12:37:44.070662",
+ "modified": "2020-05-09 14:17:23.271806",
"modified_by": "Administrator",
"module": "Website",
"name": "Website Settings",
diff --git a/frappe/website/doctype/website_theme/website_theme.json b/frappe/website/doctype/website_theme/website_theme.json
index 10d018aa05..6ec4751341 100644
--- a/frappe/website/doctype/website_theme/website_theme.json
+++ b/frappe/website/doctype/website_theme/website_theme.json
@@ -8,7 +8,6 @@
"engine": "InnoDB",
"field_order": [
"theme",
- "based_on",
"module",
"custom",
"bootstrap_theme_section",
@@ -25,16 +24,12 @@
"dark_color",
"background_color",
"stylesheet_section",
- "theme_scss",
+ "custom_overrides",
"custom_scss",
+ "theme_scss",
"theme_url",
- "tailwind_theme_section",
"custom_css",
"theme_css",
- "navbar_section",
- "navbar",
- "footer_section",
- "footer",
"custom_js_section",
"js"
],
@@ -86,48 +81,11 @@
"label": "JavaScript",
"options": "JS"
},
- {
- "default": "Bootstrap 4",
- "fieldname": "based_on",
- "fieldtype": "Select",
- "label": "Theme Based On",
- "options": "Bootstrap 4\nTailwind"
- },
- {
- "depends_on": "eval:doc.based_on == 'Tailwind'",
- "fieldname": "navbar_section",
- "fieldtype": "Section Break",
- "label": "Navbar"
- },
- {
- "depends_on": "eval:doc.based_on=='Tailwind'",
- "fieldname": "tailwind_theme_section",
- "fieldtype": "Section Break",
- "label": "Tailwind Theme"
- },
{
"fieldname": "bootstrap_theme_section",
"fieldtype": "Section Break",
"label": "Theme Configuration"
},
- {
- "depends_on": "eval:doc.based_on == 'Tailwind'",
- "fieldname": "footer_section",
- "fieldtype": "Section Break",
- "label": "Footer"
- },
- {
- "fieldname": "navbar",
- "fieldtype": "Table",
- "label": "Navbar",
- "options": "Web Page Block"
- },
- {
- "fieldname": "footer",
- "fieldtype": "Table",
- "label": "Footer",
- "options": "Web Page Block"
- },
{
"fieldname": "custom_css",
"fieldtype": "Code",
@@ -177,7 +135,6 @@
"options": "Color"
},
{
- "depends_on": "eval:doc.based_on == 'Bootstrap 4'",
"fieldname": "stylesheet_section",
"fieldtype": "Section Break",
"label": "Stylesheet"
@@ -220,10 +177,16 @@
{
"fieldname": "column_break_11",
"fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "custom_overrides",
+ "fieldtype": "Code",
+ "label": "Custom Overrides",
+ "options": "SCSS"
}
],
"links": [],
- "modified": "2020-04-25 00:00:23.347879",
+ "modified": "2020-05-09 15:03:35.001068",
"modified_by": "Administrator",
"module": "Website",
"name": "Website Theme",
diff --git a/frappe/website/doctype/website_theme/website_theme.py b/frappe/website/doctype/website_theme/website_theme.py
index ac7637d6c7..da6d26c2e0 100644
--- a/frappe/website/doctype/website_theme/website_theme.py
+++ b/frappe/website/doctype/website_theme/website_theme.py
@@ -41,13 +41,9 @@ class WebsiteTheme(Document):
def validate_theme(self):
'''Generate theme css if theme_scss has changed'''
- if self.based_on == 'Bootstrap 4':
- doc_before_save = self.get_doc_before_save()
- if doc_before_save is None or get_scss(self) != get_scss(doc_before_save):
- self.generate_bootstrap_theme()
-
- if self.based_on == 'Tailwind':
- self.theme_css = frappe.render_template('frappe/website/doctype/website_theme/custom_theme.css', self.as_dict(), is_path=True)
+ doc_before_save = self.get_doc_before_save()
+ if doc_before_save is None or get_scss(self) != get_scss(doc_before_save):
+ self.generate_bootstrap_theme()
def export_doc(self):
"""Export to standard folder `[module]/website_theme/[name]/[name].json`."""
@@ -139,5 +135,5 @@ def generate_theme_files_if_not_exist():
frappe.log_error(frappe.get_traceback(), "Theme File Generation Failed")
def get_scss(doc):
- return (doc.theme_scss or '') + '\n' + (doc.custom_scss or '')
+ return frappe.render_template('frappe/website/doctype/website_theme/website_theme_template.scss', doc.as_dict())
diff --git a/frappe/website/doctype/website_theme/website_theme_template.scss b/frappe/website/doctype/website_theme/website_theme_template.scss
index 1bb4685b98..275b105f92 100644
--- a/frappe/website/doctype/website_theme/website_theme_template.scss
+++ b/frappe/website/doctype/website_theme/website_theme_template.scss
@@ -1,6 +1,5 @@
{% if google_font %}
@import url('https://fonts.googleapis.com/css?family={{ google_font.replace(' ', '+') }}:{{ font_properties }}&display=swap');
-
$font-family-sans-serif: "{{ google_font }}", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
{% endif -%}
@@ -14,6 +13,9 @@ $enable-shadows: {{ button_shadows and "true" or "false" }};
$enable-gradients: {{ button_gradients and "true" or "false" }};
$enable-rounded: {{ button_rounded_corners and "true" or "false" }};
+// Bootstrap Variable Overrides
+{{ custom_overrides or '' }}
+
@import "frappe/public/scss/website";
{% if font_size -%}
@@ -21,3 +23,6 @@ body {
font-size: {{ font_size }};
}
{%- endif %}
+
+// Custom Theme
+{{ custom_scss or '' }}
From e0510e2e06c84854430b5701361a3eeb048fc565 Mon Sep 17 00:00:00 2001
From: Faris Ansari
Date: Sat, 9 May 2020 15:38:27 +0530
Subject: [PATCH 105/336] fix: Navbar
---
frappe/templates/includes/navbar/navbar.html | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/frappe/templates/includes/navbar/navbar.html b/frappe/templates/includes/navbar/navbar.html
index 379c6660fc..9d48390170 100644
--- a/frappe/templates/includes/navbar/navbar.html
+++ b/frappe/templates/includes/navbar/navbar.html
@@ -1,5 +1,4 @@
-{%- if theme.based_on == 'Bootstrap 4' or doctype != 'Web Page' -%}
-
-{%- else -%}
-note.js
+
+frappe.tour['Note'] = [
+ {
+ fieldname: "title",
+ title: "Title of the Note",
+ description: "...",
+ }
+];
+
+ `);
+ } else {
+ frm.fields_dict.reference_document.set_description(null);
+ }
+ },
+
disable_form: function(frm) {
frm.set_read_only();
frm.fields
diff --git a/frappe/desk/doctype/onboarding_step/onboarding_step.json b/frappe/desk/doctype/onboarding_step/onboarding_step.json
index e1035a4343..3bc9d5f286 100644
--- a/frappe/desk/doctype/onboarding_step/onboarding_step.json
+++ b/frappe/desk/doctype/onboarding_step/onboarding_step.json
@@ -15,6 +15,7 @@
"action",
"column_break_7",
"reference_document",
+ "is_single",
"reference_report",
"report_reference_doctype",
"report_type",
@@ -57,7 +58,7 @@
"fieldname": "action",
"fieldtype": "Select",
"label": "Action",
- "options": "Create Entry\nUpdate Settings\nView Report\nWatch Video",
+ "options": "Create Entry\nUpdate Settings\nShow Form Tour\nView Report\nWatch Video",
"reqd": 1
},
{
@@ -65,7 +66,7 @@
"fieldtype": "Column Break"
},
{
- "depends_on": "eval:doc.action == \"Create Entry\" || doc.action == \"Update Settings\"",
+ "depends_on": "eval:doc.action == \"Create Entry\" || doc.action == \"Update Settings\" || doc.action == \"Create Entry\" || doc.action == \"Show Form Tour\"",
"fieldname": "reference_document",
"fieldtype": "Link",
"label": "Reference Document",
@@ -127,10 +128,18 @@
"fieldtype": "Data",
"label": "Report Reference Doctype",
"read_only": 1
+ },
+ {
+ "default": "0",
+ "depends_on": "eval:doc.action == \"Create Entry\" || doc.action == \"Update Settings\" || doc.action == \"Create Entry\" || doc.action == \"Show Form Tour\"",
+ "fetch_from": "reference_document.issingle",
+ "fieldname": "is_single",
+ "fieldtype": "Check",
+ "label": "Is Single"
}
],
"links": [],
- "modified": "2020-05-04 12:53:19.276952",
+ "modified": "2020-05-11 13:24:05.457160",
"modified_by": "Administrator",
"module": "Desk",
"name": "Onboarding Step",
From 5c241255516edfbc62e1ace935746611ab03551d Mon Sep 17 00:00:00 2001
From: Shivam Mishra
diff --git a/frappe/website/web_template/full_width_image/full_width_image.html b/frappe/website/web_template/full_width_image/full_width_image.html
index 19bd17801a..6a0f40e7bc 100644
--- a/frappe/website/web_template/full_width_image/full_width_image.html
+++ b/frappe/website/web_template/full_width_image/full_width_image.html
@@ -1 +1 @@
-{{ c('image_with_blur', src=url, alt=description, class="w-full") }}
+{{ c('image_with_blur', src=url, alt=description, class="full-width-image") }}
diff --git a/frappe/website/web_template/hero/hero.html b/frappe/website/web_template/hero/hero.html
index e7b69ab782..5f96dacc7c 100644
--- a/frappe/website/web_template/hero/hero.html
+++ b/frappe/website/web_template/hero/hero.html
@@ -1,20 +1,23 @@
-
-
+
+
+
{{ title }}
{%- if subtitle -%}
-
+
{{ subtitle }}
{%- endif -%}
{%- if primary_action or secondary_action -%}
-
+
{%- if primary_action -%}
- {{ c('button', label=primary_action_label, url=primary_action, variant="primary", size="large") }}
+
+ {{ primary_action_label }}
+
{%- endif -%}
{%- if secondary_action -%}
- {{ c('button', label=secondary_action_label, url=secondary_action, variant="secondary", size="large", class="ml-4") }}
+
+ {{ secondary_action_label }}
+
{%- endif -%}
{%- endif -%}
diff --git a/frappe/website/web_template/hero_with_right_image/hero_with_right_image.html b/frappe/website/web_template/hero_with_right_image/hero_with_right_image.html
index 015bf8b222..b14f1ef054 100644
--- a/frappe/website/web_template/hero_with_right_image/hero_with_right_image.html
+++ b/frappe/website/web_template/hero_with_right_image/hero_with_right_image.html
@@ -1,37 +1,33 @@
-
-
+
+
-
+
{{ title }}
{%- if subtitle -%}
-
+
{{ subtitle }}
{%- endif -%}
-
+
{%- if primary_action -%}
- {{ c('button', label=primary_action_label, url=primary_action, variant="primary", size="large") }}
+
+ {{ primary_action_label }}
+
{%- endif -%}
{%- if secondary_action -%}
- {{ c('button', label=secondary_action_label, url=secondary_action, variant="secondary", size="large", class="ml-4") }}
+
+ {{ secondary_action_label }}
+
{%- endif -%}
{%- if image -%}
{{ c('image_with_blur',
- class=["hidden md:block max-h-144 object-contain", "w-full md:w-6/12" if contain_image else "md:max-w-md lg:max-w-lg xl:max-w-xl xxl:max-w-2xl"],
+ class=["hero-image", "contain-image" if contain_image else ""],
src=image,
alt="")
}}
{%- endif -%}
-
-{%- if not contain_image -%}
-
-{%- endif -%}
diff --git a/frappe/website/web_template/markdown/markdown.html b/frappe/website/web_template/markdown/markdown.html
index b086dd327c..4f09d6aa88 100644
--- a/frappe/website/web_template/markdown/markdown.html
+++ b/frappe/website/web_template/markdown/markdown.html
@@ -1,3 +1,5 @@
-
- {{ frappe.utils.md_to_html(content) }}
+
+
+ {{ frappe.utils.md_to_html(content) }}
+
diff --git a/frappe/website/web_template/section_with_cards/section_with_cards.html b/frappe/website/web_template/section_with_cards/section_with_cards.html
index d408275b44..1f0f71a15b 100644
--- a/frappe/website/web_template/section_with_cards/section_with_cards.html
+++ b/frappe/website/web_template/section_with_cards/section_with_cards.html
@@ -1,47 +1,41 @@
{%- macro card(title, content, url) -%}
+{%- set col_classes = resolve_class({
+ 'col-12 col-sm-6 col-lg-3': card_size == 'Small',
+ 'col-12 col-sm-6 col-lg-4': card_size == 'Medium',
+ 'col-12 col-md-6': card_size == 'Large',
+}) -%}
{%- set card_classes = resolve_class({
- 'p-6': card_size == 'Small',
- 'p-7': card_size == 'Medium',
- 'p-8': card_size == 'Large'
+ 'card-sm': card_size == 'Small',
+ 'card-md': card_size == 'Medium',
+ 'card-lg': card_size == 'Large'
}) -%}
-{%- set title_classes = resolve_class({
- 'text-base font-semibold': card_size == 'Small',
- 'text-lg md:text-xl font-semibold': card_size == 'Medium',
- 'text-xl md:text-2xl font-bold': card_size == 'Large'
-}) -%}
-{%- set content_classes = resolve_class({
- 'text-sm': card_size == 'Small',
- 'text-base': card_size == 'Medium',
- 'text-base xxl:text-lg': card_size == 'Large'
-}) -%}
-
-
- {{ title }}
- {{ content or '' }}
-
+
{%- endmacro -%}
{%- if title -%}
-{{ title }}
+{{ title }}
{%- endif -%}
{%- if subtitle -%}
-{{ subtitle }}
+{{ subtitle }}
{%- endif -%}
{%- set card_size = card_size or 'Small' -%}
-{%- set classes = resolve_class({
- 'mt-8': title,
- 'sm:grid-cols-2 lg:grid-cols-4': card_size == 'Small',
- 'sm:grid-cols-2 lg:grid-cols-3': card_size == 'Medium',
- 'sm:grid-cols-2': card_size == 'Large',
-}) -%}
-
- {%- for index in ['1', '2', '3', '4', '5', '6', '7', '8'] -%}
- {%- set title = values['card_' + index + '_title'] -%}
- {%- set content = values['card_' + index + '_content'] -%}
- {%- set url = values['card_' + index + '_url'] -%}
- {%- if title -%}
- {{ card(title, content, url) }}
- {%- endif -%}
- {%- endfor -%}
+
+
+ {%- for index in ['1', '2', '3', '4', '5', '6', '7', '8'] -%}
+ {%- set title = values['card_' + index + '_title'] -%}
+ {%- set content = values['card_' + index + '_content'] -%}
+ {%- set url = values['card_' + index + '_url'] -%}
+ {%- if title -%}
+ {{ card(title, content, url) }}
+ {%- endif -%}
+ {%- endfor -%}
+
diff --git a/frappe/website/web_template/section_with_cta/section_with_cta.html b/frappe/website/web_template/section_with_cta/section_with_cta.html
index 415392f751..313f49dde3 100644
--- a/frappe/website/web_template/section_with_cta/section_with_cta.html
+++ b/frappe/website/web_template/section_with_cta/section_with_cta.html
@@ -1,21 +1,19 @@
-
-
- {{ title }}
- {{ subtitle }}
-
- {{ c('button', label=cta_label, url=cta_url, variant="primary", size="large") }}
-
+
+
+ {{ title }}
+ {{ subtitle }}
+
+ {{ cta_label }}
+
{%- if cta_description -%}
-
+
{{ cta_description }}
{%- endif -%}
{%- if show_confetti -%}
-
-
-
-
-
+
+
+
{%- endif -%}
diff --git a/frappe/website/web_template/section_with_image/section_with_image.html b/frappe/website/web_template/section_with_image/section_with_image.html
index 9a7753cc4a..3cd9d97872 100644
--- a/frappe/website/web_template/section_with_image/section_with_image.html
+++ b/frappe/website/web_template/section_with_image/section_with_image.html
@@ -1,5 +1,5 @@
-{{ title }}
-{{ subtitle }}
+{{ title }}
+{{ subtitle }}
-{{ c('image_with_blur', src=image, alt=image_description, class="w-full mt-8 rounded-xl") }}
+{{ c('image_with_blur', src=image, alt=image_description, class="section-image") }}
diff --git a/frappe/website/web_template/section_with_left_image/section_with_left_image.html b/frappe/website/web_template/section_with_left_image/section_with_left_image.html
index d2d1568708..3daaf87ffb 100644
--- a/frappe/website/web_template/section_with_left_image/section_with_left_image.html
+++ b/frappe/website/web_template/section_with_left_image/section_with_left_image.html
@@ -1,9 +1,9 @@
-
-
+
+
-
- {{ title }}
- {{ content }}
+
+ {{ title }}
+ {{ content }}
diff --git a/frappe/website/web_template/section_with_tabs/section_with_tabs.html b/frappe/website/web_template/section_with_tabs/section_with_tabs.html
index 67b4ac9426..a03b99b139 100644
--- a/frappe/website/web_template/section_with_tabs/section_with_tabs.html
+++ b/frappe/website/web_template/section_with_tabs/section_with_tabs.html
@@ -1,39 +1,43 @@
-{{ title }}
-{{ subtitle }}
+{{ title }}
+{{ subtitle }}
-
-
- {% set ns = namespace(tabs=[]) %}
+
+ {% set ns = namespace(tabs=[]) %}
- {%- for index in ['1', '2', '3', '4', '5', '6'] -%}
+ {%- for index in ['1', '2', '3', '4', '5', '6'] -%}
- {%- set buttonid = 'id-' + frappe.utils.generate_hash('TabButton', 12) -%}
- {%- set panelid = 'id-' + frappe.utils.generate_hash('TabPanel', 12) -%}
+ {%- set buttonid = 'id-' + frappe.utils.generate_hash('TabButton', 12) -%}
+ {%- set panelid = 'id-' + frappe.utils.generate_hash('TabPanel', 12) -%}
- {%- set tab = {
- 'title': values['tab_' + index + '_title'],
- 'content': values['tab_' + index + '_content'],
- 'buttonid': buttonid,
- 'panelid': panelid, }
- -%}
+ {%- set tab = {
+ 'title': values['tab_' + index + '_title'],
+ 'content': values['tab_' + index + '_content'],
+ 'buttonid': buttonid,
+ 'panelid': panelid, }
+ -%}
- {%- if tab.title and tab.content -%}
- {%- set ns.tabs = ns.tabs + [tab] -%}
- {%- endif -%}
+ {%- if tab.title and tab.content -%}
+ {%- set ns.tabs = ns.tabs + [tab] -%}
+ {%- endif -%}
- {%- endfor -%}
-
- {%- for tab in ns.tabs -%}
- {%- set first_tab = true if loop.index0 == 0 else false -%}
-
- {%- endfor -%}
-
+ {%- endfor -%}
+
{%- for tab in ns.tabs -%}
{%- set first_tab = true if loop.index0 == 0 else false -%}
-
+
+ {%- for tab in ns.tabs -%}
+ {%- set first_tab = true if loop.index0 == 0 else false -%}
+
{{ frappe.utils.md_to_html(tab.content) }}
@@ -41,71 +45,3 @@
{%- endfor -%}
-
-
From fcf9c9d1397a4c46c61cd1e8c246a3ec783a9c0b Mon Sep 17 00:00:00 2001
From: Faris Ansari
Date: Mon, 11 May 2020 15:54:22 +0530
Subject: [PATCH 119/336] fix: Separate footer group links with normal links
- Add icon for footer item
- Obey "Right" value for footer item
---
frappe/templates/includes/footer/footer.html | 61 ++++++++++---------
.../includes/footer/footer_grouped_links.html | 28 +++++++++
.../includes/footer/footer_links.html | 27 ++++++++
3 files changed, 86 insertions(+), 30 deletions(-)
create mode 100644 frappe/templates/includes/footer/footer_grouped_links.html
create mode 100644 frappe/templates/includes/footer/footer_links.html
diff --git a/frappe/templates/includes/footer/footer.html b/frappe/templates/includes/footer/footer.html
index 7fe6a955f7..671e928d32 100644
--- a/frappe/templates/includes/footer/footer.html
+++ b/frappe/templates/includes/footer/footer.html
@@ -1,45 +1,46 @@
-{%- if theme.based_on == 'Bootstrap 4' or doctype != 'Web Page' -%}
{{ title }}
{%- if subtitle -%} -+
{{ subtitle }}
{%- endif -%} {%- if primary_action or secondary_action -%} -
+
{%- if primary_action -%}
- {{ c('button', label=primary_action_label, url=primary_action, variant="primary", size="large") }}
+
+ {{ primary_action_label }}
+
{%- endif -%}
{%- if secondary_action -%}
- {{ c('button', label=secondary_action_label, url=secondary_action, variant="secondary", size="large", class="ml-4") }}
+
+ {{ secondary_action_label }}
+
{%- endif -%}
{%- endif -%}
diff --git a/frappe/website/web_template/hero_with_right_image/hero_with_right_image.html b/frappe/website/web_template/hero_with_right_image/hero_with_right_image.html
index 015bf8b222..b14f1ef054 100644
--- a/frappe/website/web_template/hero_with_right_image/hero_with_right_image.html
+++ b/frappe/website/web_template/hero_with_right_image/hero_with_right_image.html
@@ -1,37 +1,33 @@
-
-
+
+
-
-{%- if not contain_image -%}
-
-{%- endif -%}
diff --git a/frappe/website/web_template/markdown/markdown.html b/frappe/website/web_template/markdown/markdown.html
index b086dd327c..4f09d6aa88 100644
--- a/frappe/website/web_template/markdown/markdown.html
+++ b/frappe/website/web_template/markdown/markdown.html
@@ -1,3 +1,5 @@
-
-
+
{%- if image -%}
{{ c('image_with_blur',
- class=["hidden md:block max-h-144 object-contain", "w-full md:w-6/12" if contain_image else "md:max-w-md lg:max-w-lg xl:max-w-xl xxl:max-w-2xl"],
+ class=["hero-image", "contain-image" if contain_image else ""],
src=image,
alt="")
}}
{%- endif -%}
+
{{ title }}
{%- if subtitle -%}
-
+
{{ subtitle }}
{%- endif -%} -
+
{%- if primary_action -%}
- {{ c('button', label=primary_action_label, url=primary_action, variant="primary", size="large") }}
+
+ {{ primary_action_label }}
+
{%- endif -%}
{%- if secondary_action -%}
- {{ c('button', label=secondary_action_label, url=secondary_action, variant="secondary", size="large", class="ml-4") }}
+
+ {{ secondary_action_label }}
+
{%- endif -%}
- {{ frappe.utils.md_to_html(content) }}
+
+
diff --git a/frappe/website/web_template/section_with_cards/section_with_cards.html b/frappe/website/web_template/section_with_cards/section_with_cards.html
index d408275b44..1f0f71a15b 100644
--- a/frappe/website/web_template/section_with_cards/section_with_cards.html
+++ b/frappe/website/web_template/section_with_cards/section_with_cards.html
@@ -1,47 +1,41 @@
{%- macro card(title, content, url) -%}
+{%- set col_classes = resolve_class({
+ 'col-12 col-sm-6 col-lg-3': card_size == 'Small',
+ 'col-12 col-sm-6 col-lg-4': card_size == 'Medium',
+ 'col-12 col-md-6': card_size == 'Large',
+}) -%}
{%- set card_classes = resolve_class({
- 'p-6': card_size == 'Small',
- 'p-7': card_size == 'Medium',
- 'p-8': card_size == 'Large'
+ 'card-sm': card_size == 'Small',
+ 'card-md': card_size == 'Medium',
+ 'card-lg': card_size == 'Large'
}) -%}
-{%- set title_classes = resolve_class({
- 'text-base font-semibold': card_size == 'Small',
- 'text-lg md:text-xl font-semibold': card_size == 'Medium',
- 'text-xl md:text-2xl font-bold': card_size == 'Large'
-}) -%}
-{%- set content_classes = resolve_class({
- 'text-sm': card_size == 'Small',
- 'text-base': card_size == 'Medium',
- 'text-base xxl:text-lg': card_size == 'Large'
-}) -%}
-
-
-
+ {{ frappe.utils.md_to_html(content) }}
+
{{ title }}
-{{ content or '' }}
- + {%- endmacro -%} {%- if title -%} -{{ title }}
+{{ title }}
{%- endif -%} {%- if subtitle -%} -{{ subtitle }}
+{{ subtitle }}
{%- endif -%} {%- set card_size = card_size or 'Small' -%} -{%- set classes = resolve_class({ - 'mt-8': title, - 'sm:grid-cols-2 lg:grid-cols-4': card_size == 'Small', - 'sm:grid-cols-2 lg:grid-cols-3': card_size == 'Medium', - 'sm:grid-cols-2': card_size == 'Large', -}) -%} -
- {%- for index in ['1', '2', '3', '4', '5', '6', '7', '8'] -%}
- {%- set title = values['card_' + index + '_title'] -%}
- {%- set content = values['card_' + index + '_content'] -%}
- {%- set url = values['card_' + index + '_url'] -%}
- {%- if title -%}
- {{ card(title, content, url) }}
- {%- endif -%}
- {%- endfor -%}
+
+
diff --git a/frappe/website/web_template/section_with_cta/section_with_cta.html b/frappe/website/web_template/section_with_cta/section_with_cta.html
index 415392f751..313f49dde3 100644
--- a/frappe/website/web_template/section_with_cta/section_with_cta.html
+++ b/frappe/website/web_template/section_with_cta/section_with_cta.html
@@ -1,21 +1,19 @@
-
+ {%- for index in ['1', '2', '3', '4', '5', '6', '7', '8'] -%}
+ {%- set title = values['card_' + index + '_title'] -%}
+ {%- set content = values['card_' + index + '_content'] -%}
+ {%- set url = values['card_' + index + '_url'] -%}
+ {%- if title -%}
+ {{ card(title, content, url) }}
+ {%- endif -%}
+ {%- endfor -%}
+
-
-
{{ title }}
-{{ subtitle }}
-- {{ c('button', label=cta_label, url=cta_url, variant="primary", size="large") }} -
+
+
+
diff --git a/frappe/website/web_template/section_with_image/section_with_image.html b/frappe/website/web_template/section_with_image/section_with_image.html
index 9a7753cc4a..3cd9d97872 100644
--- a/frappe/website/web_template/section_with_image/section_with_image.html
+++ b/frappe/website/web_template/section_with_image/section_with_image.html
@@ -1,5 +1,5 @@
-{{ title }}
+{{ subtitle }}
+
+ {{ cta_label }}
+
{%- if cta_description -%}
-
+
{%- if show_confetti -%}
-
{{ cta_description }}
{%- endif -%}
-
-
-
-
+
+
+
{%- endif -%}
{{ title }}
-{{ subtitle }}
+{{ title }}
+{{ subtitle }}
-{{ c('image_with_blur', src=image, alt=image_description, class="w-full mt-8 rounded-xl") }} +{{ c('image_with_blur', src=image, alt=image_description, class="section-image") }} diff --git a/frappe/website/web_template/section_with_left_image/section_with_left_image.html b/frappe/website/web_template/section_with_left_image/section_with_left_image.html index d2d1568708..3daaf87ffb 100644 --- a/frappe/website/web_template/section_with_left_image/section_with_left_image.html +++ b/frappe/website/web_template/section_with_left_image/section_with_left_image.html @@ -1,9 +1,9 @@ -
-
+
+
-
-
diff --git a/frappe/website/web_template/section_with_tabs/section_with_tabs.html b/frappe/website/web_template/section_with_tabs/section_with_tabs.html
index 67b4ac9426..a03b99b139 100644
--- a/frappe/website/web_template/section_with_tabs/section_with_tabs.html
+++ b/frappe/website/web_template/section_with_tabs/section_with_tabs.html
@@ -1,39 +1,43 @@
-{{ title }}
-{{ content }}
+
+
{{ title }}
+{{ content }}
{{ title }}
-{{ subtitle }}
+{{ title }}
+{{ subtitle }}
-
-
- {% set ns = namespace(tabs=[]) %}
+
+ {% set ns = namespace(tabs=[]) %}
- {%- for index in ['1', '2', '3', '4', '5', '6'] -%}
+ {%- for index in ['1', '2', '3', '4', '5', '6'] -%}
- {%- set buttonid = 'id-' + frappe.utils.generate_hash('TabButton', 12) -%}
- {%- set panelid = 'id-' + frappe.utils.generate_hash('TabPanel', 12) -%}
+ {%- set buttonid = 'id-' + frappe.utils.generate_hash('TabButton', 12) -%}
+ {%- set panelid = 'id-' + frappe.utils.generate_hash('TabPanel', 12) -%}
- {%- set tab = {
- 'title': values['tab_' + index + '_title'],
- 'content': values['tab_' + index + '_content'],
- 'buttonid': buttonid,
- 'panelid': panelid, }
- -%}
+ {%- set tab = {
+ 'title': values['tab_' + index + '_title'],
+ 'content': values['tab_' + index + '_content'],
+ 'buttonid': buttonid,
+ 'panelid': panelid, }
+ -%}
- {%- if tab.title and tab.content -%}
- {%- set ns.tabs = ns.tabs + [tab] -%}
- {%- endif -%}
+ {%- if tab.title and tab.content -%}
+ {%- set ns.tabs = ns.tabs + [tab] -%}
+ {%- endif -%}
- {%- endfor -%}
-
- {%- for tab in ns.tabs -%}
- {%- set first_tab = true if loop.index0 == 0 else false -%}
-
- {%- endfor -%}
-
+ {%- endfor -%}
+ -
{%- for tab in ns.tabs -%}
{%- set first_tab = true if loop.index0 == 0 else false -%}
-
+
Date: Mon, 11 May 2020 15:54:22 +0530
Subject: [PATCH 119/336] fix: Separate footer group links with normal links
- Add icon for footer item
- Obey "Right" value for footer item
---
frappe/templates/includes/footer/footer.html | 61 ++++++++++---------
.../includes/footer/footer_grouped_links.html | 28 +++++++++
.../includes/footer/footer_links.html | 27 ++++++++
3 files changed, 86 insertions(+), 30 deletions(-)
create mode 100644 frappe/templates/includes/footer/footer_grouped_links.html
create mode 100644 frappe/templates/includes/footer/footer_links.html
diff --git a/frappe/templates/includes/footer/footer.html b/frappe/templates/includes/footer/footer.html
index 7fe6a955f7..671e928d32 100644
--- a/frappe/templates/includes/footer/footer.html
+++ b/frappe/templates/includes/footer/footer.html
@@ -1,45 +1,46 @@
-{%- if theme.based_on == 'Bootstrap 4' or doctype != 'Web Page' -%}
+ {%- for tab in ns.tabs -%}
+ {%- set first_tab = true if loop.index0 == 0 else false -%}
+
-
-
From fcf9c9d1397a4c46c61cd1e8c246a3ec783a9c0b Mon Sep 17 00:00:00 2001
From: Faris Ansari
{{ frappe.utils.md_to_html(tab.content) }}
@@ -41,71 +45,3 @@
{%- endfor -%}