You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Jordan Shurmer (JIRA)" <ji...@apache.org> on 2016/06/27 22:47:57 UTC

[jira] [Commented] (SLING-5812) Add option to include attributes in request scope for Sightly data-sly-resource and data-sly-include

    [ https://issues.apache.org/jira/browse/SLING-5812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15351990#comment-15351990 ] 

Jordan Shurmer commented on SLING-5812:
---------------------------------------

Just because I'm curious:
Why implement this as *request* attributes. 

It seems the intention is to pass variables in to the included sightly script. Request attributes obviously work, but what do you think about a local scoped implementation? That would cut back on the possible unintentional side-affects that often come with storing global-like data. 



> Add option to include attributes in request scope for Sightly data-sly-resource and data-sly-include
> ----------------------------------------------------------------------------------------------------
>
>                 Key: SLING-5812
>                 URL: https://issues.apache.org/jira/browse/SLING-5812
>             Project: Sling
>          Issue Type: Improvement
>          Components: Scripting
>    Affects Versions: Scripting Sightly Engine 1.0.18
>            Reporter: Vlad Bailescu
>            Priority: Minor
>             Fix For: Scripting Sightly Engine 1.0.20
>
>
> A common pattern for sending information between scripts/components is setting specific attributes in request scope before including another resource or script. At the moment this cannot be done nicely in Sightly.
> It would be very helpful to set request attributes as in following examples:
> {code}<sly data-sly-include="${'script.html' @ requestAttributes=helper.attributesMap}"/>{code}
> or:
> {code}<sly data-sly-resource="${'some/path' @ resourceType='some/type', requestAttributes=helper.attributesMap}"/>{code}
> where {{attributesMap}} is a {{Map<String, Object>}}
> The attributes would be set before the actual script/resource inclusion and reset/unset back afterwards.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)