© Copyright 2019 Gonzalo Rodríguez-Baltanás Díaz - All Rights Reserved

bootstrap-datepicker-rails

An introduction on the usage of bootstrap-datepicker-rails

While creating eucalipto.eu I needed to use a Datepicker. I was using the fantastic Twitter Bootstrap framework so I looked for a datepicker that would look as good.

Andrew Rowling’s bootstrap-datepicker was the perfect choice.

So I packaged that project into a ruby gem, ready to use with Rails’ assets pipeline. And thus bootstrap-datepicker-rails was born.

Using it, is as simple as

gem 'bootstrap-datepicker-rails'

Add this line to app/assets/stylesheets/application.css

*= require bootstrap-datepicker

Add this line to app/assets/javascripts/application.js

//= require bootstrap-datepicker

And then

<input type="text" data-behaviour='datepicker' >

<script type="text/javascript">
  $(document).ready(function(){
    $('[data-behaviour~=datepicker]').datepicker();
  })
</script>

And this is how it looks:

SHARE THIS PAGE!

© Copyright 2019 Gonzalo Rodríguez-Baltanás Díaz - All Rights Reserved