At YourNextLeap we've been extensively using Twitter's Bootstrap for our new features. I wont go into the arguments for using frameworks vs not using frameworks or semantic vs non semantic html, those merit a post on their own. In this post, I wanted to talk about how we've integrated Bootstrap with our application.

This is a compilation of what we've come across so far. I plan on updating this post as I come across more utilities to integrate Bootstrap and Rails.

Pagination

Since the beginning of time, we've used the awesome will_paginate gem for all our pagination. Once we started using Bootstrap, the pagination rendered by the will_paginate helper did not fit Bootstrap's pagination styling. When searching for a solution, I came across a link renderer that renders pagination in Bootstrap's format. Using this and a custom helper that in turn calls will_paginate using our custom renderer, we could render pagination as required.

Live Validations

For validations throughout our site, we use the popular jQuery Validation plugin. Again, this did not render things like we wanted them, but, once again, github came to the rescue. As it turns out, we weren't the only ones trying to get the two libraries to work together. Based solutions from this issue on the Bootstrap repo, we were able to override the validator plugin enough to render forms and errors beautifully.

Flash Notifications

Bootstrap also includes components for alerts which have counterparts with Rails' flash messages, we use a combination of a helper and a shared notification partial to render alerts.

Comments

comments powered by Disqus

About

Web Developer by day, Redditor by night and Browncoat for life. Geek. Origamist, FOSS Supporter, Avid Reader, Pythonista.

Currently hacking on python/django @dubizzle.