问题
I found this nice Image gallery addon for Bootstrap but I am not sure how to integrate it on my rails project.
https://github.com/blueimp/Bootstrap-Image-Gallery
I figured I could use Rails (3.1) vendor's folder.
So that's what I did. I cloned those files in the vendor/assets folder:
git clone https://github.com/blueimp/Bootstrap-Image-Gallery.git
Ok now it's there, how do I use it?
How do I load these resources in my application?
my current application.js:
//= require jquery
//= require jquery_ujs
//= require_tree .
//= require bootstrap
//= require dzscalendar.js
//= require dzstooltip.js
//= require bootstrap-datepicker
//= require gmaps4rails/gmaps4rails.base
//= require gmaps4rails/gmaps4rails.googlemaps
my current application.css:
/*
*= require_self
*= require_tree .
*= require bootstrap-datepicker
*/
@import "bootswatch/cerulean/variables";
@import "bootstrap";
@import "bootswatch/cerulean/bootswatch";
@import "dzscalendar.css.scss";
@import "dzstooltip.css.scss";
@import "gmaps4rails";
@import 'font-awesome';
I tried diverse things, but it looks like I don't understand what I am doing just now.
Hope I can find some guidance here. Cheers
回答1:
Ok, time to take advantage of the asset pipeline here, there may be a better way of doing this but for now i would just copy the css, images and js into your existing project (keep them seperate for now like in the example)
Then in your view you are free to add your html (like in the example)
回答2:
See https://github.com/kristianmandrup/bootstrap-addons-rails, it's a ready-to-use gem that you include in your Gemfile, so you can require Image Gallery using asset pipeline.
来源:https://stackoverflow.com/questions/14013320/add-bootstrap-image-gallery-to-a-rails-project