Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Website Enhancements #11285

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
14af050
feat: Section with Collapsible Content
netchampfaris Aug 17, 2020
c073492
feat: Section with Image align center
netchampfaris Aug 17, 2020
40a0c69
feat: Footer
netchampfaris Aug 17, 2020
a1cfcbf
fix: Default styling for h3
netchampfaris Aug 17, 2020
6fa69eb
fix: overflow auto in grid field
netchampfaris Aug 17, 2020
fbbfce5
fix: Remove margin bottom of last child in md
netchampfaris Aug 17, 2020
8c90543
fix: Add template validation in web_blocks
netchampfaris Aug 17, 2020
db69a4e
fix: Syntax highlighting for Custom SCSS field
netchampfaris Aug 17, 2020
f53fab8
fix: Fields is not mandatory in Web Template
netchampfaris Aug 17, 2020
9afc6a7
feat: Support for Table field via Table Break in Web Template
netchampfaris Aug 17, 2020
6138e0b
fix: empty init file
netchampfaris Aug 17, 2020
e010947
fix: revert overflow auto
netchampfaris Aug 17, 2020
03aed4d
fix: Apply vertical margin only in sidebar layout
netchampfaris Aug 18, 2020
6c46cbd
fix: Hero image layout reflow on lazy load
netchampfaris Aug 18, 2020
b7facef
feat: Section with Features
netchampfaris Aug 18, 2020
3b43425
feat: Hero align center style
netchampfaris Aug 18, 2020
a73a547
fix: Footer styles
netchampfaris Aug 18, 2020
ba5cc11
fix: Collapsible icon
netchampfaris Aug 18, 2020
3a5927d
fix: Responsive styling for Section with Features
netchampfaris Aug 18, 2020
629c4af
feat: Section with Embed
netchampfaris Aug 18, 2020
5305873
fix: Set common css variables on root
netchampfaris Aug 18, 2020
4889ce1
fix: Conditionally render subtitle
netchampfaris Aug 18, 2020
6692211
feat: Customizable navbar and footer with Web Template
netchampfaris Aug 21, 2020
67b9b0d
fix: Show Edit DocType button in Singles Form in dev mode
netchampfaris Aug 21, 2020
58a819c
fix: import
netchampfaris Aug 21, 2020
c555e81
feat: Extended spacing scale
netchampfaris Aug 21, 2020
ab80058
fix: Set og:type to website for web page
netchampfaris Sep 10, 2020
4a58f22
fix: Ignore SVG images
netchampfaris Sep 10, 2020
dff53d6
feat: Slideshow Web Template
netchampfaris Sep 10, 2020
3b2819b
fix: Set _context_dict always
Sep 10, 2020
687298f
fix: Indicator check
netchampfaris Sep 11, 2020
e662047
fix: Web Template
netchampfaris Sep 11, 2020
08fdf40
fix(Small CTA: Hide subtitle and cta if not set
netchampfaris Sep 11, 2020
87ca4f4
fix: Print error to avoid silent failure
netchampfaris Sep 11, 2020
a86af4b
feat: Support style tags in Web Template
netchampfaris Sep 11, 2020
20ead21
fix: UX
netchampfaris Sep 11, 2020
1f2b099
fix: Move navbar styles to navbar.scss
netchampfaris Sep 11, 2020
85a3a8b
fix: Delete old theme files if theme is custom
netchampfaris Sep 11, 2020
cc9fdd6
fix: Check if file exists before generating base64
netchampfaris Sep 11, 2020
7a31983
fix: Succinct syntax for rendering web templates
netchampfaris Sep 11, 2020
627aff4
fix: Handle jpe files in image_to_base64
netchampfaris Sep 14, 2020
8f0f17e
fix: Render web blocks using web_template.render
netchampfaris Sep 14, 2020
327ae73
fix: Default 3 columns for features section
netchampfaris Sep 14, 2020
12dbb64
fix: Conditionally render subtitle and image
netchampfaris Sep 14, 2020
95f015e
fix: Navbar CTA undo margin in mobile view
netchampfaris Sep 14, 2020
e5d5347
fix: Better label for hero button action
netchampfaris Sep 15, 2020
327642e
feat: Align center in markdown template
netchampfaris Sep 15, 2020
df0548b
fix: Fallback image alt
netchampfaris Sep 15, 2020
12476fe
fix: Clear sitemap cache along with website cache
netchampfaris Sep 15, 2020
7e2fed4
fix: match multiline scripts and styles
netchampfaris Sep 15, 2020
773aa6b
fix: Render html as text to prevent html injection
netchampfaris Sep 15, 2020
68fc825
feat: Split section with image
netchampfaris Sep 15, 2020
4e6135a
fix: Set type as Section
netchampfaris Sep 15, 2020
404f22f
fix: Prevent shrink in collapsible icon
netchampfaris Sep 16, 2020
de8c021
fix: Scope card styles to section-with-cards
netchampfaris Sep 18, 2020
4a38a31
fix: Set max width on hero title
netchampfaris Sep 18, 2020
fd9576a
fix: Brand input styles
netchampfaris Sep 18, 2020
bbdbc0d
Merge remote-tracking branch 'upstream/develop' into aaaa-website-enh…
netchampfaris Sep 18, 2020
958d5f5
style: sider suggestions
netchampfaris Sep 18, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions frappe/hooks.py
Expand Up @@ -43,6 +43,11 @@
"assets/css/report.min.css",
]

doctype_js = {
"Web Page": "public/js/frappe/utils/web_template.js",
"Website Settings": "public/js/frappe/utils/web_template.js"
}

web_include_js = [
"website_script.js"
]
Expand Down
3 changes: 2 additions & 1 deletion frappe/patches.txt
Expand Up @@ -309,4 +309,5 @@ frappe.patches.v12_0.set_default_password_reset_limit
frappe.patches.v13_0.set_route_for_blog_category
frappe.patches.v13_0.enable_custom_script
frappe.patches.v13_0.update_newsletter_content_type
frappe.patches.v13_0.delete_event_producer_and_consumer_keys
execute:frappe.db.set_value('Website Settings', 'Website Settings', {'navbar_template': 'Standard Navbar', 'footer_template': 'Standard Footer'})
frappe.patches.v13_0.delete_event_producer_and_consumer_keys
2 changes: 1 addition & 1 deletion frappe/public/js/frappe/dom.js
Expand Up @@ -34,7 +34,7 @@ frappe.dom = {
},
remove_script_and_style: function(txt) {
const evil_tags = ["script", "style", "noscript", "title", "meta", "base", "head"];
const regex = new RegExp(evil_tags.map(tag => `<${tag}>.*<\\/${tag}>`).join('|'));
const regex = new RegExp(evil_tags.map(tag => `<${tag}>.*<\\/${tag}>`).join('|'), 's');
if (!regex.test(txt)) {
// no evil tags found, skip the DOM method entirely!
return txt;
Expand Down
4 changes: 4 additions & 0 deletions frappe/public/js/frappe/form/controls/markdown_editor.js
Expand Up @@ -44,5 +44,9 @@ frappe.ui.form.ControlMarkdownEditor = frappe.ui.form.ControlCode.extend({
.then(() => {
this.update_preview();
});
},

set_disp_area(value) {
this.disp_area && $(this.disp_area).text(value);
}
});
6 changes: 3 additions & 3 deletions frappe/public/js/frappe/form/toolbar.js
Expand Up @@ -186,7 +186,7 @@ frappe.ui.form.Toolbar = Class.extend({
},
set_indicator: function() {
var indicator = frappe.get_indicator(this.frm.doc);
if (this.frm.save_disabled && [__('Saved'), __('Not Saved')].includes(indicator[0])) {
if (this.frm.save_disabled && indicator && [__('Saved'), __('Not Saved')].includes(indicator[0])) {
return;
}
if(indicator) {
Expand Down Expand Up @@ -272,12 +272,12 @@ frappe.ui.form.Toolbar = Class.extend({
});
}

if (frappe.user_roles.includes("System Manager") && me.frm.meta.issingle === 0) {
if (frappe.user_roles.includes("System Manager")) {
let is_doctype_form = me.frm.doctype === 'DocType';
let doctype = is_doctype_form ? me.frm.docname : me.frm.doctype;
let is_doctype_custom = is_doctype_form ? me.frm.doc.custom : false;

if (doctype != 'DocType' && !is_doctype_custom) {
if (doctype != 'DocType' && !is_doctype_custom && me.frm.meta.issingle === 0) {
this.page.add_menu_item(__("Customize"), function() {
if (me.frm.meta && me.frm.meta.custom) {
frappe.set_route('Form', 'DocType', doctype);
Expand Down
71 changes: 71 additions & 0 deletions frappe/public/js/frappe/utils/web_template.js
@@ -0,0 +1,71 @@
function open_web_template_values_editor(template, current_values = {}) {
return new Promise(resolve => {
frappe.model.with_doc("Web Template", template).then((doc) => {
let d = new frappe.ui.Dialog({
title: __("Edit Values"),
fields: get_fields(doc),
primary_action(values) {
d.hide();
resolve(values);
},
});
d.set_values(current_values);
d.show();

d.sections.forEach((sect) => {
let fields_with_value = sect.fields_list.filter(
(field) => current_values[field.df.fieldname]
);

if (fields_with_value.length) {
sect.collapse(false);
}
});
});
});

function get_fields(doc) {
let normal_fields = [];
let table_fields = [];

let current_table = null;
for (let df of doc.fields) {
if (current_table) {
current_table.fields = current_table.fields || [];

if (df.fieldtype != 'Table Break') {
current_table.fields.push(df);
} else {
table_fields.push(df);
current_table = df;
}
} else if (df.fieldtype != 'Table Break') {
normal_fields.push(df);
} else {
table_fields.push(df);
current_table = df;
}
}

let fields = [
...normal_fields,
...table_fields.map(tf => {
let data = current_values[tf.fieldname] || [];
return {
label: tf.label,
fieldname: tf.fieldname,
fieldtype: 'Table',
fields: tf.fields.map((df, i) => ({
...df,
in_list_view: i <= 1,
columns: tf.fields.length == 1 ? 10 : 5
})),
data,
get_data: () => data
};
})
];

return fields;
}
}
14 changes: 13 additions & 1 deletion frappe/public/scss/base.scss
Expand Up @@ -33,7 +33,7 @@ h1 {

h2 {
font-size: $font-size-xl;
font-weight: bold;
font-weight: 700;
margin-bottom: 0.75rem;

@include media-breakpoint-up(sm) {
Expand All @@ -44,3 +44,15 @@ h2 {
}
}

h3 {
font-size: $font-size-base;
font-weight: 600;
margin-bottom: 0.5rem;

@include media-breakpoint-up(sm) {
font-size: $font-size-lg;
}
@include media-breakpoint-up(md) {
font-size: $font-size-xl;
}
}
28 changes: 28 additions & 0 deletions frappe/public/scss/css_variables.scss
@@ -0,0 +1,28 @@
:root {
--gray-50: #{$gray-50};
--gray-100: #{$gray-100};
--gray-200: #{$gray-200};
--gray-300: #{$gray-300};
--gray-400: #{$gray-400};
--gray-500: #{$gray-500};
--gray-600: #{$gray-600};
--gray-700: #{$gray-700};
--gray-800: #{$gray-800};
--gray-900: #{$gray-900};

--black: #{$black};
--primary: #{$primary};
--primary-light: #{$primary-light};
--light: #{$light};

--font-size-xs: #{$font-size-xs};
--font-size-sm: #{$font-size-sm};
--font-size-base: #{$font-size-base};
--font-size-lg: #{$font-size-lg};
--font-size-xl: #{$font-size-xl};
--font-size-2xl: #{$font-size-2xl};
--font-size-3xl: #{$font-size-3xl};
--font-size-4xl: #{$font-size-4xl};
--font-size-5xl: #{$font-size-5xl};
--font-size-6xl: #{$font-size-6xl};
}
82 changes: 82 additions & 0 deletions frappe/public/scss/footer.scss
@@ -0,0 +1,82 @@
.web-footer {
padding: 5rem 0;
min-height: 140px;
}

.footer-logo {
min-width: 5rem;
height: 1.5rem;
object-fit: contain;
object-position: left;
}

.footer-child-item {
margin-top: 0.5rem;
}

.footer-link, .footer-child-item a {
font-size: $font-size-sm;
font-weight: 500;
color: $gray-700;

&:hover {
color: $primary;
text-decoration: none;
}
}

.footer-col-right {
@include media-breakpoint-up(sm) {
text-align: right;
}
}

.footer-col-left, .footer-col-right {
padding-top: 0.8rem;
padding-bottom: 1rem;
line-height: 2;

&:empty {
padding: 0;
}
}

.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-group {
margin-top: 2rem;
}

.footer-group-label {
color: $text-muted;
font-size: $font-size-sm;
margin-bottom: 0.5rem;
}

.footer-grouped-links {
margin-bottom: 2rem;
}

.footer-group-links {
display: flex;
flex-direction: column;
flex-wrap: wrap;
max-height: 10rem;
margin-bottom: 0;
}

.footer-info {
border-top: 1px solid $border-color;
color: $text-muted;
font-size: $font-size-sm;
}
4 changes: 4 additions & 0 deletions frappe/public/scss/markdown.scss
Expand Up @@ -10,6 +10,10 @@
margin-top: 0;
}

> :last-child {
margin-bottom: 0;
}

ul,
ol {
padding-left: 2.5rem;
Expand Down
59 changes: 59 additions & 0 deletions frappe/public/scss/navbar.scss
@@ -0,0 +1,59 @@
.navbar-light {
border-bottom: 1px solid $border-color;
}

.navbar-brand {
img {
display: inline-block;
max-width: 150px;
max-height: 25px;
}
}

.navbar-cta {
@include media-breakpoint-up(lg) {
margin-left: 1rem;
}
}


.navbar.bg-dark {
.dropdown-menu {
font-size: 0.75rem;
background-color: $dark;
border-radius: 0;
}

.nav-link {
white-space: nowrap;
color: $light;

&:hover {
color: $primary;
}
}

.nav-item {
padding: 0rem 1rem;
}

.dropdown-item {
color: $light;

&:hover {
background-color: $dark;
color: $primary;
}
}
}

.navbar-light .navbar-nav .nav-link {
color: $gray-700;
font-size: $font-size-sm;
font-weight: 500;

&:hover,
&:focus, &.active {
color: $primary;
}
}