fix: Remove theme based_on from Website Theme

This commit is contained in:
Faris Ansari 2020-05-09 15:38:08 +05:30
parent bd4828965b
commit a2a697b4d5
6 changed files with 24 additions and 91 deletions

View file

@ -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;

View file

@ -25,26 +25,10 @@
{{ head_html or "" }}
{%- endif %}
{%- if theme.based_on == 'Bootstrap 4' or doctype != 'Web Page' -%}
{%- if theme.theme_url -%}
<link type="text/css" rel="stylesheet" href="{{ theme.theme_url }}">
{%- else -%}
<link type="text/css" rel="stylesheet" href="/assets/css/frappe-web-b4.css">
{%- endif -%}
{% else %}
{%- if developer_mode -%}
<!-- load the full list of tailwind classes in development -->
<link type="text/css" rel="stylesheet" href="/assets/css/tailwind.css">
{%- else -%}
<!-- load tree-shaken classes in production -->
<!-- container for processed tailwind styles -->
<!-- tailwind-styles -->
{% endif %}
{%- if theme.theme_css -%}
<style>
{{ theme.theme_css }}
</style>
{%- endif -%}
{%- if theme.theme_url -%}
<link type="text/css" rel="stylesheet" href="{{ theme.theme_url }}">
{%- else -%}
<link type="text/css" rel="stylesheet" href="/assets/css/frappe-web-b4.css">
{%- endif -%}
{%- for link in web_include_css %}

View file

@ -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",

View file

@ -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",

View file

@ -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())

View file

@ -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 '' }}