You are here: Browse Railsplugins Unobtrusive Date Picker
Location: United States, Chapel Hill, NC
= Unobtrusive Date-Picker Widget Plugin
This is a helper for creating a date or date-time picker that uses the Unobtrusive Date-Picker Widgit(sic) (http://www.frequency-decoder.com/2006/10/02/unobtrusive-date-picker-widgit-update) to add a clickable calendar image that will bring up a calendar picker if javascript is available. It replicates as much of the API of the Rails `date_select`, and `datetime_select` form helpers.
It also uses the 12 Hour Time plugin (http://code.google.com/p/rails-twelve-hour-time-plugin/) so that 12 Hour times can be processed by Active Record.
You may want to consider compressing the javascript files with Dean Edward’s Packer (http://dean.edwards.name/packer/) or Douglas Crockford’s JSMin (http://www.crockford.com/javascript/jsmin.html) before deploying your application.
== Usage
To be able to use the date-picker methods below you need to include the javascript library file and CSS stylesheet in the <head> of your layout template. You can do this either by manually including the files via a `javascript_include_tag` and a `stylesheet_link_tag` (the files are both named “datepicker”), OR by using the included `unobtrusive_datepicker_includes` helper method, which will do this for you.
There are 4 main methods: – unobtrusive_date_picker – unobtrusive_datetime_picker – unobtrusive_date_picker_tags – unobtrusive_datetime_picker_tags
Options (* indicates same functionality as is in Rails helpers): – *:order => the order the selects should be positioned in – *:include_blank => include a blank option at the top of every select – *:start_year => year that the year select should start on (defaults to 5 below either the year of the date value or current year) – *:end_year => year that the year select should end on (defaults to 5 above either the year of the date value or current year) – *:minute_step => how many minutes apart each minute option should be – example: (:minute_step => 5) would result in [0, 15, 30, 45] as options – *:use_short_month => use short month names (Jan, Feb, etc.) instead of long names (January) for option text – *:use_month_numbers => use month numbers instead of names for option text – *:add_month_numbers => add month numbers to names for option text (“1 – January”) – :highlight_days => which days of the week should be highlighted in the datepicker (by default Saturday and Sunday) – Excepts either a string of number representing days of the week (0 = Monday, 1 = Tuesday … 6 = Sunday) – Or a singular symbol for one day of the week – Or an array of symbols representing days of the week, i.e. [:Monday, :Sunday] – :range_low => the low range of acceptable dates (not times) for this input – managed by the Javascript, thus should be enforced with your own validations – Excepts: – One of the following symbols: :today, :tomorrow, :yesterday – A string representation of a date – A Date, DateTime, or Time object – :range_high => the high range of acceptable dates (not times) for this input – Excepts same options as :range_low; also managed by javascript – :disable_days => days of the week that may not be selected – Excepts the same format as :highlight_days – Also managed by javascript – :no_transparency => if set to true it disables the fade in/out visual effect of the datepicker
Homepage: http://code.google.com/p/rails-unobtrusive-date-picker/
Categories: Unclassified