Add Bootstrap-Image-Gallery to a Rails project

白昼怎懂夜的黑 提交于 2020-01-06 07:34:20

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!