new <html-script> widget

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

new <html-script> widget

James Yong-2
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
Reply | Threaded
Open this post in threaded view
|

Re: new <html-script> widget

Deepak Dixit-5
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 <[hidden email]> 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
>
Reply | Threaded
Open this post in threaded view
|

Re: new &lt;html-script> widget

James Yong-2
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 <[hidden email]> 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 <[hidden email]> 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
> >
>