CalendarModel's getWeeksInMonth method returns 1 for months having less than 31 
days
------------------------------------------------------------------------------------

                 Key: MGNLSTK-808
                 URL: http://jira.magnolia-cms.com/browse/MGNLSTK-808
             Project: Magnolia Standard Templating Kit
          Issue Type: Bug
          Components: paragraphs
    Affects Versions: 1.4.5
            Reporter: Matt Dertinger
            Assignee: Philipp Bärfuss


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:

{code|title=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>
{code}

*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


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.magnolia-cms.com/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       


----------------------------------------------------------------
For list details, see: http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to