将Bootstrap-Image-Gallery添加到Rails项目 [英] Add Bootstrap-Image-Gallery to a Rails project

查看:72
本文介绍了将Bootstrap-Image-Gallery添加到Rails项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为Bootstrap找到了一个不错的图片库插件,但不确定如何将其集成到我的rails项目中.

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

我认为我可以使用Rails(3.1)供应商的文件夹.

I figured I could use Rails (3.1) vendor's folder.

这就是我所做的.我将这些文件克隆到了vendor/assets文件夹中:

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?

我当前的application.js:

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

我当前的application.css:

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

推荐答案

好吧,时间在这里利用资产管道,可能会有更好的方法,但是现在我只复制CSS,图像和js到您现有的项目中(像示例中一样,将它们暂时分开)

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)

然后在您的视图中,您可以自由添加html(如示例中所示)

Then in your view you are free to add your html (like in the example)

这篇关于将Bootstrap-Image-Gallery添加到Rails项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆