Browse Source

[fix] enable website_theme

version-14
Rushabh Mehta 9 years ago
parent
commit
07bdc7b111
6 changed files with 66 additions and 91 deletions
  1. +1
    -2
      frappe/hooks.py
  2. +4
    -0
      frappe/website/doctype/website_theme/website_theme.js
  3. +42
    -73
      frappe/website/doctype/website_theme/website_theme.json
  4. +1
    -2
      frappe/website/doctype/website_theme/website_theme.py
  5. +5
    -5
      frappe/website/website_theme/standard/standard.json
  6. +13
    -9
      frappe/www/website_theme.css

+ 1
- 2
frappe/hooks.py View File

@@ -44,7 +44,6 @@ web_include_js = [

bootstrap = "assets/frappe/css/bootstrap.css"
web_include_css = [
"assets/frappe/css/font/open-sans/open-sans.css",
"assets/css/frappe-web.css"
]
website_route_rules = [
@@ -99,7 +98,7 @@ doc_events = {
"after_insert": "frappe.email.doctype.email_alert.email_alert.trigger_email_alerts",
"validate": [
"frappe.email.doctype.email_alert.email_alert.trigger_email_alerts",
],
],
"on_update": [
"frappe.desk.notifications.clear_doctype_notifications",
"frappe.email.doctype.email_alert.email_alert.trigger_email_alerts",


+ 4
- 0
frappe/website/doctype/website_theme/website_theme.js View File

@@ -18,7 +18,11 @@ frappe.ui.form.on("Website Theme", "onload_post_render", function(frm) {
});

frappe.ui.form.on("Website Theme", "refresh", function(frm) {
frm.set_intro(__('Default theme is set in {0}', ['<a href="#Form/Website Settings">'
+ __('Website Settings') + '</a>']));

frm.toggle_display(["module", "custom"], !frappe.boot.developer_mode);

if (!frm.doc.custom && !frappe.boot.developer_mode) {
frm.set_read_only();
frm.disable_save();


+ 42
- 73
frappe/website/doctype/website_theme/website_theme.json View File

@@ -3,11 +3,13 @@
"allow_import": 1,
"allow_rename": 0,
"autoname": "field:theme",
"beta": 0,
"creation": "2015-02-18 12:46:38.168929",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "Setup",
"editable_grid": 0,
"fields": [
{
"allow_on_submit": 0,
@@ -66,7 +68,7 @@
"bold": 0,
"collapsible": 0,
"default": "1",
"description": "This must be checked if the below style settings are applicable",
"description": "",
"fieldname": "apply_style",
"fieldtype": "Check",
"hidden": 0,
@@ -142,6 +144,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "apply_style",
"description": "Link to your Bootstrap theme",
"fieldname": "bootstrap",
"fieldtype": "Code",
@@ -193,18 +196,16 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "",
"fieldname": "font_size",
"fieldtype": "Select",
"fieldname": "apply_text_styles",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Font Size",
"label": "Apply Text Styles",
"length": 0,
"no_copy": 0,
"options": "\n12px\n13px\n14px\n15px\n16px\n17px\n18px",
"permlevel": 0,
"precision": "",
"print_hide": 0,
@@ -220,17 +221,19 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "Add the name of a \"Google Web Font\" e.g. \"Open Sans\"",
"fieldname": "text_webfont",
"fieldtype": "Data",
"default": "",
"depends_on": "apply_text_styles",
"fieldname": "font_size",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Google Font (Text)",
"label": "Font Size",
"length": 0,
"no_copy": 0,
"options": "\n12px\n13px\n14px\n15px\n16px\n17px\n18px",
"permlevel": 0,
"precision": "",
"print_hide": 0,
@@ -246,15 +249,16 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "apply_text_styles",
"description": "Add the name of a \"Google Web Font\" e.g. \"Open Sans\"",
"fieldname": "heading_webfont",
"fieldname": "text_webfont",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Google Font (Heading)",
"label": "Google Font (Text)",
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -272,13 +276,16 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break_18",
"fieldtype": "Column Break",
"depends_on": "apply_text_styles",
"description": "Add the name of a \"Google Web Font\" e.g. \"Open Sans\"",
"fieldname": "heading_webfont",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Google Font (Heading)",
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -296,6 +303,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "apply_text_styles",
"fieldname": "text_color",
"fieldtype": "Data",
"hidden": 0,
@@ -321,6 +329,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "apply_text_styles",
"fieldname": "link_color",
"fieldtype": "Data",
"hidden": 0,
@@ -346,17 +355,15 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "heading_style",
"fieldtype": "Select",
"fieldname": "column_break_18",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Heading Style",
"length": 0,
"no_copy": 0,
"options": "\nUPPERCASE\nTitle Case\nlowercase",
"permlevel": 0,
"precision": "",
"print_hide": 0,
@@ -372,16 +379,18 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "apply_style",
"fieldname": "section_break_8",
"fieldtype": "Section Break",
"depends_on": "apply_text_styles",
"fieldname": "heading_style",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Heading Style",
"length": 0,
"no_copy": 0,
"options": "\nUPPERCASE\nTitle Case\nlowercase",
"permlevel": 0,
"precision": "",
"print_hide": 0,
@@ -397,6 +406,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "apply_text_styles",
"fieldname": "top_bar_color",
"fieldtype": "Data",
"hidden": 0,
@@ -422,6 +432,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "apply_text_styles",
"fieldname": "top_bar_text_color",
"fieldtype": "Data",
"hidden": 0,
@@ -447,55 +458,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "no_sidebar",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Hide Sidebar",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break_11",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "apply_text_styles",
"fieldname": "footer_color",
"fieldtype": "Data",
"hidden": 0,
@@ -521,6 +484,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "apply_text_styles",
"fieldname": "footer_text_color",
"fieldtype": "Data",
"hidden": 0,
@@ -545,7 +509,7 @@
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"collapsible": 1,
"depends_on": "apply_style",
"fieldname": "section_break_4",
"fieldtype": "Section Break",
@@ -554,6 +518,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Background",
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -698,6 +663,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "apply_style",
"fieldname": "js",
"fieldtype": "Code",
"hidden": 0,
@@ -723,13 +689,14 @@
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
"image_view": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2016-02-22 09:39:16.920883",
"modified": "2016-08-03 02:16:20.733994",
"modified_by": "Administrator",
"module": "Website",
"name": "Website Theme",
@@ -777,10 +744,12 @@
"write": 1
}
],
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"search_fields": "",
"sort_field": "modified",
"sort_order": "DESC",
"title_field": ""
"title_field": "",
"track_seen": 0
}

+ 1
- 2
frappe/website/doctype/website_theme/website_theme.py View File

@@ -63,7 +63,6 @@ def use_theme(theme):

def add_website_theme(context):
bootstrap = frappe.get_hooks("bootstrap")[0]
web_include_css = context.web_include_css
context.theme = frappe._dict()

if not context.disable_website_theme:
@@ -76,7 +75,7 @@ def add_website_theme(context):

context.no_sidebar = website_theme.no_sidebar

context.web_include_css = ["website_theme.css"] + context.web_include_css
context.web_include_css = context.web_include_css + ["website_theme.css"]

context.web_include_css = [bootstrap] + context.web_include_css



+ 5
- 5
frappe/website/website_theme/standard/standard.json View File

@@ -1,5 +1,6 @@
{
"apply_style": 0,
"apply_style": 1,
"apply_text_styles": 1,
"creation": "2015-02-19 13:37:33.925909",
"custom": 0,
"docstatus": 0,
@@ -8,17 +9,16 @@
"footer_color": "",
"footer_text_color": "",
"heading_style": "",
"heading_webfont": "Open Sans",
"heading_webfont": "Fira Sans",
"idx": 17,
"link_color": "",
"modified": "2016-04-21 02:34:26.091046",
"modified": "2016-08-03 02:19:05.701516",
"modified_by": "Administrator",
"module": "Website",
"name": "Standard",
"no_sidebar": 0,
"owner": "Administrator",
"text_color": "",
"text_webfont": "Open Sans",
"text_webfont": "Fira Sans",
"theme": "Standard",
"top_bar_color": "",
"top_bar_text_color": ""

+ 13
- 9
frappe/www/website_theme.css View File

@@ -1,6 +1,6 @@
{%- if False and theme and theme.apply_style -%}
{%- if theme and theme.apply_style -%}

{%- set font_family_sans_serif = '"Helvetica Neue", Helvetica, Arial, sans-serif' -%}
{%- set font_family_sans_serif = '-apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif' -%}
{%- set heading_selectors = "h1, h2, h3, h4, h5, h6" -%}

{{ theme.webfont_import or "" }}
@@ -17,19 +17,22 @@ body {
{%- endif %}

{# text #}
{% if theme.text_webfont -%}
font-family: "{{ theme.text_webfont }}", {{ font_family_sans_serif }};
{% if theme.apply_text_styles %}
{% if theme.text_webfont -%}
font-family: "{{ theme.text_webfont }}", {{ font_family_sans_serif }};

{%- endif %}
{%- endif %}

{% if theme.font_size -%}
font-size: {{ theme.font_size }};
{%- endif %}
{% if theme.font_size -%}
font-size: {{ theme.font_size }};
{%- endif %}

color: {{ theme.text_color }};
color: {{ theme.text_color }};
{% endif %}
}

{# links #}
{% if theme.apply_text_styles %}
a {
color: {{ theme.link_color }};
}
@@ -52,6 +55,7 @@ a:active {
text-transform: {{ theme.heading_style }};
}
{%- endif %}
{% endif %}

{% include "frappe/templates/includes/website_theme/navbar.css" %}



Loading…
Cancel
Save