Commit 4ea070d9 authored by Romain Courteaud's avatar Romain Courteaud

erp5_web_js_style: factorize default css definition

parent 7d2df410
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
web_site python: here.getWebSiteValue(); web_site python: here.getWebSiteValue();
web_section python: here.getWebSectionValue(); web_section python: here.getWebSectionValue();
no_style_gadget_url python: web_section.getLayoutProperty('configuration_style_gadget_url', default=''); no_style_gadget_url python: web_section.getLayoutProperty('configuration_style_gadget_url', default='');
no_style_css_url python: 'jsstyle.css';
favicon_url python: web_section.getLayoutProperty('configuration_favicon_url', default=''); favicon_url python: web_section.getLayoutProperty('configuration_favicon_url', default='');
global_definitions_macros here/global_definitions/macros;"> global_definitions_macros here/global_definitions/macros;">
<tal:block metal:use-macro="global_definitions_macros/header_definitions" /> <tal:block metal:use-macro="global_definitions_macros/header_definitions" />
...@@ -20,7 +21,7 @@ ...@@ -20,7 +21,7 @@
<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1" /> <meta name="viewport" content="width=device-width,height=device-height,initial-scale=1" />
<title tal:content="python: here.getTranslatedTitle() or web_section.getTranslatedTitle()"></title> <title tal:content="python: here.getTranslatedTitle() or web_section.getTranslatedTitle()"></title>
<noscript> <noscript>
<link rel="stylesheet" href="jsstyle.css"> <link rel="stylesheet" tal-attributes="href no_style_css_url">
</noscript> </noscript>
<tal:block tal:condition="favicon_url"> <tal:block tal:condition="favicon_url">
<link rel="icon" tal:attributes="href favicon_url" /> <link rel="icon" tal:attributes="href favicon_url" />
...@@ -33,7 +34,8 @@ ...@@ -33,7 +34,8 @@
<link rel="prerender" tal:attributes="href no_style_gadget_url"> <link rel="prerender" tal:attributes="href no_style_gadget_url">
</tal:block> </tal:block>
</head> </head>
<body tal:attributes="data-nostyle-gadget-url no_style_gadget_url"> <body tal:attributes="data-nostyle-gadget-url no_style_gadget_url;
data-nostyle-css-url no_style_css_url">
<tal:block tal:content="structure python: web_site.WebSite_generateNavigationHTML()"></tal:block> <tal:block tal:content="structure python: web_site.WebSite_generateNavigationHTML()"></tal:block>
<main> <main>
......
...@@ -297,11 +297,12 @@ ...@@ -297,11 +297,12 @@
style_gadget, style_gadget,
body = gadget.element, body = gadget.element,
style_gadget_url = body.getAttribute("data-nostyle-gadget-url"), style_gadget_url = body.getAttribute("data-nostyle-gadget-url"),
style_css_url = body.getAttribute("data-nostyle-css-url"),
parsed_content; parsed_content;
if (!style_gadget_url) { if (!style_gadget_url) {
// No style configured, use backend only rendering // No style configured, use backend only rendering
return rJS.declareCSS("jsstyle.css", document.head); return rJS.declareCSS(style_css_url, document.head);
} }
parsed_content = parsePageContent(gadget.element); parsed_content = parsePageContent(gadget.element);
...@@ -329,7 +330,7 @@ ...@@ -329,7 +330,7 @@
}); });
}, function (error) { }, function (error) {
console.warn('Cant load the style gadget', error); console.warn('Cant load the style gadget', error);
return new RSVP.Queue(rJS.declareCSS("jsstyle.css", document.head)) return new RSVP.Queue(rJS.declareCSS(style_css_url, document.head))
.push(function () { .push(function () {
// Set again the page content after the css is loaded // Set again the page content after the css is loaded
// to prevent ugly rendering // to prevent ugly rendering
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
web_site python: here.getWebSiteValue(); web_site python: here.getWebSiteValue();
web_section python: here.getWebSectionValue(); web_section python: here.getWebSectionValue();
no_style_gadget_url python: web_section.getLayoutProperty('configuration_style_gadget_url', default=''); no_style_gadget_url python: web_section.getLayoutProperty('configuration_style_gadget_url', default='');
no_style_css_url python: 'jsstyle.css';
favicon_url python: web_section.getLayoutProperty('configuration_favicon_url', default=''); favicon_url python: web_section.getLayoutProperty('configuration_favicon_url', default='');
global_definitions_macros here/global_definitions/macros;"> global_definitions_macros here/global_definitions/macros;">
<tal:block metal:use-macro="global_definitions_macros/header_definitions" /> <tal:block metal:use-macro="global_definitions_macros/header_definitions" />
...@@ -19,7 +20,7 @@ ...@@ -19,7 +20,7 @@
<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1" /> <meta name="viewport" content="width=device-width,height=device-height,initial-scale=1" />
<title tal:content="python: here.getTranslatedTitle() or web_section.getTranslatedTitle()"></title> <title tal:content="python: here.getTranslatedTitle() or web_section.getTranslatedTitle()"></title>
<noscript> <noscript>
<link rel="stylesheet" href="jsstyle.css"> <link rel="stylesheet" tal-attributes="href no_style_css_url">
</noscript> </noscript>
<tal:block tal:condition="favicon_url"> <tal:block tal:condition="favicon_url">
<link rel="icon" tal:attributes="href favicon_url" /> <link rel="icon" tal:attributes="href favicon_url" />
...@@ -32,7 +33,8 @@ ...@@ -32,7 +33,8 @@
<link rel="prerender" tal:attributes="href no_style_gadget_url"> <link rel="prerender" tal:attributes="href no_style_gadget_url">
</tal:block> </tal:block>
</head> </head>
<body tal:attributes="data-nostyle-gadget-url no_style_gadget_url"> <body tal:attributes="data-nostyle-gadget-url no_style_gadget_url;
data-nostyle-css-url no_style_css_url">
<tal:block tal:content="structure python: web_site.WebSite_generateNavigationHTML()"></tal:block> <tal:block tal:content="structure python: web_site.WebSite_generateNavigationHTML()"></tal:block>
<p tal:content="request/portal_status_message | nothing" id="portal_status_message"/> <p tal:content="request/portal_status_message | nothing" id="portal_status_message"/>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment