[ALOY-525] Add support for new tag to group many blocks of XML code together easier
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Medium |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | Alloy 2.0.0 |
Components | XML |
Labels | n/a |
Reporter | Jeff Haynie |
Assignee | Unknown |
Created | 2013-02-18T09:05:41.000+0000 |
Updated | 2018-03-07T22:26:00.000+0000 |
Description
Right now, if you have a set of XML code in your view that needs to be conditionally executed (either platform, formFactor, etc) you have to add the same logic on each tag in the group or be forced to wrap in a View tag. Wrapping in a view tag is as performant on certain platforms like Android where the view hierarchy depth is sensitive / limited.
I'd like to introduce a new tag (IF) that will make this much easier and more capable of performing more dynamic structures.
This should support both the existing conditionals: platform and formFactor. I'd like to also introduce a cond attribute whereby you can add additional JS logic or variable which which be used to evaluate the block.
in commit: https://github.com/jhaynie/alloy/commit/62b70981ba11cf985a31b9133117f9ebc8d0e56b
I'm going to reserve this for 2.0 and likely do so via some templating engine. Rather than reinvent the wheel, and the inevitable deluge of feature requests that will follow something like this, I'll likely lean on EJS or something similar, with the ability for developers to plug in their own templating engines before the Alloy compile step.