-
Bug
-
Resolution: Won't Do
-
Neutral
-
1.4.5
-
-
Empty show more show less
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:
<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: MGNLSTK-686
Please let me know if you have any additional questions.
Cheers,
Matt