I’ve just had my first patch accepted on an open source project. Quite chuffed with that! As of this weekend, the Rails calendar_helper plugin is now at version 0.21. My changes are very minimal, and only really to do with the markup.

Firstly, the default table markup’s had an overhaul. The date now goes into a %lt;caption> tag, outside the <thead>, as is appropriate. The <th>‘s in the thead now have scope="col" applied to them, again, as is appropriate.

The only other change is optional. If you pass in an option of :accessible => true, any dates in the grid which fall outside the current month will have <span> class="hidden"> monthName</span> appended to them. It could be reasonably inferred that plain numbers are dates that relate to the caption of the table, but the numbers outside the current month should probably be clarified.

You can come up with your own method of hiding content marked as .hidden; at NPG, we use the following:

.hidden {
	position:absolute;
 	left:0px;
 	top:-500px;
 	width:1px;
 	height:1px;
 	overflow:hidden;
}

but really, use whatever you’re most comfortable with.

You can get the plugin from Geoffrey Grosenbach’s subversion:

http://topfunky.net/svn/plugins/calendar_helper/

via the usual Rails plugin installation method.

4 comments on this entry.

  • chriso | 9 Jul 2007

    Hey wow! I had some code in that patch too – and it was my first ever open source patch as well!

    (My own submission was rather more modest than yours – I just added code to display the current day on the calendar).

  • ax | 16 Nov 2007

    Hi,
    can you please give some hints on changing the calendar helper to get the AJAXy “prev/next month” links (like on the http://rubyonrailsworkshops.com site)?

    Thanks a lot in advance.
    Axplains

  • Jules | 22 Mar 2008

    Looks good. I am new to RoR, I would like to have a select form that lets the user select a month & year which then shows the selected month & year. How can I link the form with the calendar?