tjobrien / date_and_time-samples Goto Github PK
View Code? Open in Web Editor NEWcombines JQueryUI datepicker and event_calendar in a Rails 3.0 project
Home Page: http://www.bootstraptechnology.com
combines JQueryUI datepicker and event_calendar in a Rails 3.0 project
Home Page: http://www.bootstraptechnology.com
A small project that uses JQuery datepicker, formtastic, event_calendar, validates_timeliness and chronic. The issue I was trying to solve was how to integrate all these and allow users to choose a date and time easily. IMHO that is choose a date from a calendar, then choose the time from select boxes. Because this is an event, a User nust also choose duration. 1. JQuery - look at application.js....I changed the default Date format of the datepicker to YY-MM-DD. Chronic can parse DD-MM-YY to a correct date format for ActiveRecord, but I needed a way to validate user input. My app uses YY-MM-DD format, so not an inconvenient trade off. 2. Event_calendar The event_calendar needs a start_at and end_at to create the calendar. I take the start_at_date, start_at_hour, start_at_minute and am_pm attributes and parse a start_date from those values in the Event befor_save callback. In the same method, I create the end_at by using rails some_integer.minutes.since self.start_at I use the all_day flag. As the has_event_calendar method has a before_save call in it, the date parsing I needed to create these dates was failing. I put the has_event_calendar below the before_save :date_parser call and then event_calendar can do its thing as it has a start_date. 3. The rest is pretty straight forward...there are few extra date and time fields in the views/events/_form.html.erb so you can see how those look too. 4. No testing..I know.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.