[MGNLDEMO-413] Carousel freemarker syntax failure Created: 03/Feb/23 Updated: 23/Oct/23 Resolved: 18/Aug/23 |
|
| Status: | Closed |
| Project: | Magnolia Demo Projects |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.6.9 |
| Type: | Bug | Priority: | Major |
| Reporter: | David Caviedes Marquez | Assignee: | Anh Vu |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | quickwin | ||
| Σ Remaining Estimate: | 0d | Remaining Estimate: | 0d |
| Σ Time Spent: | 1d 6.5h | Time Spent: | 1d 4.5h |
| Σ Original Estimate: | Not Specified | Original Estimate: | Not Specified |
| Sub-Tasks: |
|
|||||||||||||||||||||||||
| Template: | ||||||||||||||||||||||||||
| Acceptance criteria: |
Empty
|
|||||||||||||||||||||||||
| Task DoD: |
[X]*
Doc/release notes changes? Comment present?
[X]*
Downstream builds green?
[X]*
Solution information and context easily available?
[X]*
Tests
[X]*
FixVersion filled and not yet released
[X] 
Architecture Decision Record (ADR)
|
|||||||||||||||||||||||||
| Bug DoR: |
[ ]*
Steps to reproduce, expected, and actual results filled
[ ]*
Affected version filled
|
|||||||||||||||||||||||||
| Date of First Response: | ||||||||||||||||||||||||||
| Epic Link: | DevX Bucket | |||||||||||||||||||||||||
| Sprint: | DevX 44 | |||||||||||||||||||||||||
| Story Points: | 1 | |||||||||||||||||||||||||
| Team: | ||||||||||||||||||||||||||
| Work Started: | ||||||||||||||||||||||||||
| Approved: |
Yes
|
| Description |
| Comments |
| Comment by Fabian Mangold [ 26/Jul/23 ] |
|
V&B has just reported that issue as well, when playing around on our public Demo instance. The first suggested fix (using the "c" builtin is the way to go, given the fact the second approach has been deprecated in newer Freemarker releases). The following snippet should do the trick: [#-- We only want to render the javascript when not in edit mode --] [#if !cmsfn.editMode] <script type="text/javascript"> $(document).ready(function () { $("#" + "${slideShowId}").slick({ [#if content.slickConfig?has_content] ${content.slickConfig?replace("<br/>", " ")} [#else] dots: ${(content.dots!true)?c}, arrows: ${(content.arrows!true)?c}, fade: ${(content.fade!false)?c}, variableWidth: ${(content.variableWidth!false)?c}, slidesToShow: ${content.slidesToShow!"2"}, autoplay: ${(content.autoplay!false)?c}, autoplaySeconds: ${content.autoplaySeconds!"5"}, nextArrow: '<button type="button" class="slick-next"><span class="glyphicon glyphicon-chevron-right"></span></button>', prevArrow: '<button type="button" class="slick-prev"><span class="glyphicon glyphicon-chevron-left"></span></button>' [/#if] }); // Add lazypreload to all lazy images in carousel $("#" + "${slideShowId} img.lazyload").addClass("lazypreload"); }); </script> Any chance to have this integrated ASAP ? Thanks, |
| Comment by Anh Vu [ 17/Aug/23 ] |
|
Note: Because currently the 6.3 version does not use magnolia-travel-demo module, this ticket only fix the issue for 6.2 version |
| Comment by Fabian Mangold [ 17/Aug/23 ] |
|
After a discussion with anh.vu, my fix is actually buggy, as missing values cannot be cast to C. (Doing so will actually throw an NPE and ultimately abort the Freemarker script). If the value the c built-in is applied on is null/missing, it will stop the template processing with error, just like most other built-ins. If instead you want to output a null literal, see the cn built-in. So, the right way to go, is:
${(content.dots!true)?c}
The. code snipped above has been adjusted accordingly. |