[MGNLSTK-808] CalendarModel's getWeeksInMonth method returns 1 for months having less than 31 days Created: 31/Oct/11 Updated: 04/Nov/15 Resolved: 04/Nov/15 |
|
| Status: | Closed |
| Project: | Magnolia Standard Templating Kit (closed) |
| Component/s: | paragraphs |
| Affects Version/s: | 1.4.5 |
| Fix Version/s: | Backlog |
| Type: | Bug | Priority: | Neutral |
| Reporter: | Matt Dertinger | Assignee: | Philipp Bärfuss |
| Resolution: | Won't Do | Votes: | 0 |
| Labels: | stk | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
| Template: |
|
| Acceptance criteria: |
Empty
|
| Date of First Response: | |
| Visible to: |
Mark Montri, Yun Qian
|
| Description |
|
Hi, Currently, it looks like the STK's CalendarModel's getWeeksInMonth method returns 1 for months having less than 31 days. As an example, see the stkExtrasCalendar paragraph, you can see the resulting behavior on the demopublic site here: http://demopublic.magnolia-cms.com/demo-project/news-and-events/events-overview.2011.11.html Notice, only the first week of the month is displayed. If you cycle through the months, you'll notice that months that have 31 days display all weeks of the month, while those having less than 31 days only display the first week. Note: For some reason, calling the model.weeksInMonth in the freemarker template before the list 1 .. model.weeksInMonth as x seems to fix the display issue. Here's an example: templating-kit/paragraphs/features/calendar.ftl <tbody>
<tr>
<td colspan="7">${model.weeksInMonth!}</td>
</tr>
[#list 1 .. model.weeksInMonth as x]
<tr>
<th class="cw">${model.getCalendarItem(x, 1).week}</th>
[#list 1 .. 7 as y]
[#assign item = model.getCalendarItem(x, y)]
<td ${cmsfn.createAttribute("class", item.cssClass)}>
[#if item.visible]
[#if item.link??]
<a href="${item.link}">${item.day}</a>
[#else]
${item.day}
[/#if]
[/#if]
</td>
[/#list]
</tr>
[/#list]
</tbody>
Note: I've also fixed the markup in the example above, in the actual source code, the anchor tag isn't closed and the closing td tag is in the wrong location. That issue has already been reported here: Please let me know if you have any additional questions. Cheers, |
| Comments |
| Comment by Christian Ringele [ 01/Nov/11 ] |
|
Hi Matt, When opening the link you added, the calendar opens as expected showing all weeks of the month. Christian |
| Comment by Matt Dertinger [ 01/Nov/11 ] |
|
Hi Christian, It's peculiar. Yesterday the demopublic link I referenced wasn't showing the other weeks. However, today it is displaying properly. The same thing was happening on some other instances we were running, which look ok today. However, we are still getting the issue on c-e.com. I've attached a screenshot. If it helps, we have been testing in Google Chrome with the following locale settings in the request header: Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3 Cheers, |
| Comment by Matt Dertinger [ 01/Nov/11 ] |
|
Hi Christian, We just activated the revised template I submitted a patch for on Cheers, |
| Comment by Michael Mühlebach [ 04/Nov/15 ] |
|
Given the thousands of other issues we have open that are more highly requested, we won't be able to address this issue in the foreseeable future. Instead we will focus on issues with a higher impact, and more votes. |