Hi all,

While extracting the scripts from html-template to script-template and testing 
the changes, 
I found the process to be cumbersome.

So I made a change not to use script-template tag but add a multi-block 
attribute to html-template tag.
When multi-block=true, inline scripts will be extracted automatically from any 
script tag and converted to external script. 
So no need to extract script from the freemarker template. 
Coding for script-template tag is removed

Also upload an updated patch at JIRA for the new change described. 

Regards,
James 

On 2020/05/11 10:37:11, Jacques Le Roux <jacques.le.r...@les7arts.com> wrote: 
> Hi James,
> 
> Yes, it already exists. Unfortunately for years as it's a major change.
> 
> https://issues.apache.org/jira/browse/OFBIZ-9976
> 
> It will be interesting to see if after your proposed effort much work remains 
> for require.js. It could be then done...
> 
> Jacques
> 
> Le 11/05/2020 à 12:21, James Yong a écrit :
> > Hi Jacques,
> >
> > I think having RequireJs for loading dependencies, can go in another JIRA 
> > issue.
> > It requires us to change the way Javascript coding is done.
> >
> > Regards,
> > James
> >
> > On 2020/05/10 12:58:49, Jacques Le Roux <jacques.le.r...@les7arts.com> 
> > wrote:
> >> Hi James,
> >>
> >> I  know it's not all of them as you already mentioned. But could not some 
> >> these of these scripts be handled by Require.js?
> >>
> >> Jacques
> >>
> >> Le 10/05/2020 à 14:32, James Yong a écrit :
> >>> Hi Michael,
> >>>
> >>> There are CSP errors being logged in the browser console, due to the use 
> >>> of inline javascripts.
> >>>
> >>> The proposed method allow us to:
> >>> 1. convert the inline javascripts into external scripts for better CSP 
> >>> compliance.
> >>> 2. use freemarker macros in the scripts.
> >>> 3. place the extracted javascript in the same directory as the original 
> >>> freemarker template file, to save time locating and editing the 2 related 
> >>> files.
> >>>
> >>> Regards,
> >>> James
> >>>
> >>> On 2020/05/10 09:53:47, Michael Brohl <michael.br...@ecomify.de> wrote:
> >>>> Hi James,
> >>>>
> >>>> can you explain the purpose of this? Why not just use a JavaScript file
> >>>> and a decorator?
> >>>>
> >>>> Thanks,
> >>>>
> >>>> Michael Brohl
> >>>>
> >>>> ecomify GmbH - www.ecomify.de
> >>>>
> >>>>
> >>>> Am 10.05.20 um 06:53 schrieb James Yong:
> >>>>> Hi all,
> >>>>>
> >>>>> I have created a JIRA issue for this, i.e. OFBIZ-11686.
> >>>>> Decided not to have a placement attribute because script will always be 
> >>>>> placed after body tag.
> >>>>>
> >>>>> Regards,
> >>>>> James
> >>>>>
> >>>>> On 2020/05/07 11:48:32, James Yong <jamesy...@apache.org> wrote:
> >>>>>> Hi all,
> >>>>>>
> >>>>>> Propose a new <script-template> widget tag that adds an external 
> >>>>>> script inside html head tag, or after body tag. The external script 
> >>>>>> will contain the rendered result of the specified template file 
> >>>>>> location.
> >>>>>> e.g.
> >>>>>> <platform-specific>
> >>>>>>        <html>
> >>>>>>                <script-template 
> >>>>>> location="component://order/template/quote/test.ftl” placement=“head”/>
> >>>>>>
> >>>>>> will render as:
> >>>>>> <html>
> >>>>>>        <head>
> >>>>>>        …
> >>>>>>                <script src=“/ordermgr/control/js/<some random file 
> >>>>>> name>.js” type="application/javascript"/>
> >>>>>>        </head>
> >>>>>>
> >>>>>> This will allow inline script from a freemarker file, to be rendered 
> >>>>>> as external script in html.
> >>>>>>
> >>>>>> Regards,
> >>>>>> James
> >>>>>>
> 

Reply via email to