InPlaceEditWithDatepicker
TODO: Write a gem description
Installation
Add this line to your application's Gemfile:
gem 'in_place_edit_with_datepicker'
And then execute:
$ bundle
Or install it yourself as:
$ gem install in_place_edit_with_datepicker
Setup
Add the following lines in your application.js in this sequence
//= require jquery
//= require jquery_ujs
//= require jquery-ui
//= require jquery-ui-timepicker-addon
//= require jquery.purr
//= require best_in_place
//= require best_in_place_datetime
//= require turbolinks
//= require_tree .
Add the following to your application.css in this sequence
*= jquery-ui-timepicker-addon
*= require_tree .
*= require_self
*/
Download the following files:
- http://trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.css and save to assets/stylesheets
- http://trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js and save to assets/javascripts
Usage
Invoke the datetimepicker and best_in_place in a js file, like so:
$(document).ready(function() {
$("#datepicker").datepicker({
changeMonth: true,
changeYear: true
});
/* Activating Best In Place */
jQuery(".best_in_place").best_in_place();
});
The gem works exactly as the best_in_place gem, say for eg:
<%= best_in_place @user, :name %>
For type datetime,
<%= best_in_place @user, :date_of_birth, as: :datetime %>
For type date,
<%= best_in_place @user, :date_of_delivery, as: :date %>
For type time,
<%= best_in_place @user, :time_of_delivery, as: :time %>
Contributing
- Fork it ( https://github.com/AasthaKesarwani1539/in_place_edit_with_datepicker/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request