Commit e80ea85d authored by Romain Courteaud's avatar Romain Courteaud

erp5_web_js_style: factorize default css definition

parent ece3ae41
......@@ -11,6 +11,7 @@
web_site python: here.getWebSiteValue();
web_section python: here.getWebSectionValue();
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='');
global_definitions_macros here/global_definitions/macros;">
<tal:block metal:use-macro="global_definitions_macros/header_definitions" />
......@@ -20,7 +21,7 @@
<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1" />
<title tal:content="python: here.getTranslatedTitle() or web_section.getTranslatedTitle()"></title>
<noscript>
<link rel="stylesheet" href="jsstyle.css">
<link rel="stylesheet" tal-attributes="href no_style_css_url">
</noscript>
<tal:block tal:condition="favicon_url">
<link rel="icon" tal:attributes="href favicon_url" />
......@@ -33,7 +34,8 @@
<link rel="prerender" tal:attributes="href no_style_gadget_url">
</tal:block>
</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>
<main>
......
......@@ -297,11 +297,12 @@
style_gadget,
body = gadget.element,
style_gadget_url = body.getAttribute("data-nostyle-gadget-url"),
style_css_url = body.getAttribute("data-nostyle-css-url"),
parsed_content;
if (!style_gadget_url) {
// 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);
......@@ -329,7 +330,7 @@
});
}, function (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 () {
// Set again the page content after the css is loaded
// to prevent ugly rendering
......
......@@ -10,6 +10,7 @@
web_site python: here.getWebSiteValue();
web_section python: here.getWebSectionValue();
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='');
global_definitions_macros here/global_definitions/macros;">
<tal:block metal:use-macro="global_definitions_macros/header_definitions" />
......@@ -19,7 +20,7 @@
<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1" />
<title tal:content="python: here.getTranslatedTitle() or web_section.getTranslatedTitle()"></title>
<noscript>
<link rel="stylesheet" href="jsstyle.css">
<link rel="stylesheet" tal-attributes="href no_style_css_url">
</noscript>
<tal:block tal:condition="favicon_url">
<link rel="icon" tal:attributes="href favicon_url" />
......@@ -32,7 +33,8 @@
<link rel="prerender" tal:attributes="href no_style_gadget_url">
</tal:block>
</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>
<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