You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by James Yong <ja...@apache.org> on 2020/05/06 16:33:34 UTC
new widget
Hi all,
There are javascript files that only applies to a specific screen.
While the javascript can be added via ftl templates, the Content Security Policy will need to be relaxed to allow inline scripts.
Using requireJs is not an appropriate solution as there is little reusability between different screens.
Propose a new <html-script> widget tag will add a script tag inside html head tag, or after body tag.
e.g.
<platform-specific>
<html>
<html-script src=“/ordermgr/js/test.js” placement=“head”/>
will render as:
<html>
<head>
…
<script src=“/ordermgr/js/test.js” type="application/javascript"/>
</head>
Regards,
James
Re: new <html-script> widget
Posted by James Yong <ja...@apache.org>.
Hi Deepak,
You are right about the options.
Wasn't aware I can set js from non-common screens.
Thanks for pointing out.
Regards,
James
On 2020/05/07 03:14:46, Deepak Dixit <de...@apache.org> wrote:
> Hi James,
>
> We can achieve this using a decorator pattern, we can set the screen level
> js file on screen and can be included in the header.
>
> Am I missing something here?
>
> Thanks & Regards
> --
> Deepak Dixit
> ofbiz.apache.org
>
>
> On Wed, May 6, 2020 at 10:03 PM James Yong <ja...@apache.org> wrote:
>
> > Hi all,
> >
> > There are javascript files that only applies to a specific screen.
> > While the javascript can be added via ftl templates, the Content Security
> > Policy will need to be relaxed to allow inline scripts.
> > Using requireJs is not an appropriate solution as there is little
> > reusability between different screens.
> >
> > Propose a new <html-script> widget tag will add a script tag inside html
> > head tag, or after body tag.
> > e.g.
> > <platform-specific>
> > <html>
> > <html-script src=“/ordermgr/js/test.js” placement=“head”/>
> >
> > will render as:
> > <html>
> > <head>
> > …
> > <script src=“/ordermgr/js/test.js”
> > type="application/javascript"/>
> > </head>
> >
> > Regards,
> > James
> >
>
Re: new widget
Posted by Deepak Dixit <de...@apache.org>.
Hi James,
We can achieve this using a decorator pattern, we can set the screen level
js file on screen and can be included in the header.
Am I missing something here?
Thanks & Regards
--
Deepak Dixit
ofbiz.apache.org
On Wed, May 6, 2020 at 10:03 PM James Yong <ja...@apache.org> wrote:
> Hi all,
>
> There are javascript files that only applies to a specific screen.
> While the javascript can be added via ftl templates, the Content Security
> Policy will need to be relaxed to allow inline scripts.
> Using requireJs is not an appropriate solution as there is little
> reusability between different screens.
>
> Propose a new <html-script> widget tag will add a script tag inside html
> head tag, or after body tag.
> e.g.
> <platform-specific>
> <html>
> <html-script src=“/ordermgr/js/test.js” placement=“head”/>
>
> will render as:
> <html>
> <head>
> …
> <script src=“/ordermgr/js/test.js”
> type="application/javascript"/>
> </head>
>
> Regards,
> James
>