[MAGNOLIA-3672] Expose string property as booleans as well. Created: 28/Apr/11 Updated: 29/Apr/11 Resolved: 29/Apr/11 |
|
| Status: | Closed |
| Project: | Magnolia |
| Component/s: | core, freemarker |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Neutral |
| Reporter: | Magnolia International | Assignee: | Philipp Bärfuss |
| Resolution: | Not an issue | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
| Template: |
|
| Patch included: |
Yes
|
| Acceptance criteria: |
Empty
|
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
| Testcase included: |
Yes
|
| Date of First Response: |
| Description |
|
Since there are many places/cases where we store boolean properties as string properties in jcr (i.e a checkbox from a dialog), it's quite cumbersome to convert those in FreeMarker. Instead of what I'd expect to write: [#if content.myProperty]<p>Hello world</p>[/#if] one currently has to write something along these lines [#if content.myProperty!'false'=='true']<p>Hello world</p>[/#if] ... which is admittedly annoying, awkward and downright ugly. Here's a patch that shows we could expose strings as models of both strings and booleans to FreeMarker |
| Comments |
| Comment by Magnolia International [ 28/Apr/11 ] |
|
Ok, feel free to discard this issue:
I probably got confused because of a double negative (and parenthesis) in my use-case: [#if !(content.hideTitleOnPage!false)]... |
| Comment by Philipp Bärfuss [ 29/Apr/11 ] |
|
I think that we have already to many of this magic transformations and that we shouldn't add yet another one. The type has to be specified properly. Lets hope for more adequate default values in 5.0 |