[
https://issues.apache.org/jira/browse/OFBIZ-12310?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17409603#comment-17409603
]
ASF subversion and git services commented on OFBIZ-12310:
---------------------------------------------------------
Commit 26a9dc73366a3f37a716d7d7e54b378a3ac2fc4d in ofbiz-framework's branch
refs/heads/trunk from Nicolas Malin
[ https://gitbox.apache.org/repos/asf?p=ofbiz-framework.git;h=26a9dc7 ]
Implemented: Rendering widget screen from ftl with the current context
(OFBIZ-12310)
Currently, when you would be rendering a widget screen from a ftl template, you
can use a element screen present on context to call the renderer :
${screens.render("component://common/widget/CommonScreens.xml#countries")}
This rendering is realized with the context present when the object screen has
been initialized.
To simplify the screen call from freemarker template, I implemented a new macro
ofbizScreen
You can call a Ofbiz screen with the ftl context with simple macro
<@ofbizScreen>component://mycomponent/widget/MyComponentScreens.xml#MyScreen</@ofbizScreen>
You can also write
<@ofbizScreen
location="component://mycomponent/widget/MyComponentScreens.xml"
name="MyScreen"/>
Or set a default location on your context
action :
context.defaultTemplateLocation =
"component://mycomponent/widget/MyComponentScreens.xml"
widget :
<@ofbizScreen>MyScreen</@ofbizScreen>
When the screen would be call, the context to rendering the screen would be use
the current context:
<#list contactMechs as contactMech>
<#assign contactMechId = contactMech.contachMechId/>
<@ofbizScreen>component://mycomponent/widget/MyComponentScreens.xml#DisplayContactMech</@ofbizScreen>
</#list>
> Rendering widget screen from ftl with the current context
> ---------------------------------------------------------
>
> Key: OFBIZ-12310
> URL: https://issues.apache.org/jira/browse/OFBIZ-12310
> Project: OFBiz
> Issue Type: Improvement
> Components: framework/widget
> Affects Versions: Trunk
> Reporter: Nicolas Malin
> Assignee: Nicolas Malin
> Priority: Minor
> Labels: ftl, macro, rendering, screen
> Attachments: OFBIZ-12310.patch
>
>
> Currently when you would be rendering a widget screen from a ftl template,
> you can use a element screen present on context to call the renderer :
> {code:java}
> ${screens.render("component://common/widget/CommonScreens.xml#countries")}
> {code}
> This rendering is realized with the context present when the object screen
> has been initialized.
> To simplify the screen call from freemarker template, I implemented a new
> macro *ofbizScreen*
> You can call a Ofbiz screen with the ftl context with simple macro
> {code:java}
> <@ofbizScreen>component://mycomponent/widget/MyComponentScreens.xml#MyScreen</@ofbizScreen>{code}
> You can also write
> {code:java}
> <@ofbizScreen
> location="component://mycomponent/widget/MyComponentScreens.xml"
> name="MyScreen"/>{code}
> Or set a default location on your context
> action :
> {code:java}
> context.defaultTemplateLocation =
> "component://mycomponent/widget/MyComponentScreens.xml"{code}
> widget :
> {code:java}
> <@ofbizScreen>MyScreen</@ofbizScreen>{code}
> When the screen would be call, the context to rendering the screen would be
> use the current context:
> {code:java}
> <#list contactMechs as contactMech>
> <#assign contactMechId = contactMech.contachMechId/>
>
> <@ofbizScreen>component://mycomponent/widget/MyComponentScreens.xml#DisplayContactMech</@ofbizScreen>
> </#list>
> {code}
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)