Why make yet another Rails date picker plugin!
Well for starters I have always been a huge fan of the Unobtrusive Date-Picker Widgit and there was no existing plugin for it. But then since it’s so unobtrusive why not just use the built-in methods to use it? Well because it relies on a class on the year (and not the other selects) and a very specific structure to the IDs for the <select> tags, and doing this with the existing helpers was not possible. And thus the plugin was born!
The idea from the beginning was to make very nearly identical in usage and in output to the built-in commands so as to make it as much of a drop-in replacement as possible. I also wanted to use the 12 hour time standard since most of us don’t go by a 24 hour clock. Thus similar or identical options are available, and the output will be almost identical to that made by the built-in commands, it will of course work with a form builder and take data from a passed in model object to set the selected options. In other words all the Rails goodness one expects!
December 9th, 2007 at 5:12 pm
Well, this sounds amazing and checking the widget site I cannot wait to use this plugin. Unfortunately, I have no idea how
I installed the plugin via “script/plugin install” but when I use the functions, I only get the select boxes. No image, no popup calendar, nothing! Is there anything I have to configure?
Thanks in advance. Max
March 1st, 2008 at 4:44 pm
max: You need to make sure to include the javascript and css files needed by the plugin, they should have been installed in your apps “public/” directory when you ran “script/plugin install” You can include it either by adding “<%= unobtrusive_datepicker_includes %>” to the <head> tag in your layout, or by manually including the files via the “javascript_include_tag” and “stylesheet_link_tag” helper methods. The respective file names are “datepicker.js” and “datepicker.css”.