简体   繁体   中英

How to install jschr's bootstrap-modal in Rails

I'm trying to install jschr's bootstrap-modal found here: https://github.com/jschr/bootstrap-modal to use in my rails project.

The github page's instructions indicate to:

  • Include css/bootstrap-modal.css after the main bootstrap css files.
  • Include js/bootstrap-modalmanager.js and js/bootstrap-modal.js after the main bootstrap js files.

What does this mean? I thought bootstrap was installed in rails via inclusion in the gemfile and running bundle update/install.

How to install:

Vicente Reig created a Ruby Gem for you to use!

Follow his installation instructions to add the gem to your gemfile and then install the gem. This will add the files you need to your gem directory.

How to initialize:

You need to add two require statements:

The first in your application.js file: The first few lines will be commented out with // ,this is where you add the .js call.

//= require bootstrap-modal
//= require bootstrap-modalmanager

Do the same in your application.css file:

//= require bootstrap <--(this should already be there.)
//= require bootstrap-modal

If your application.css file doesn't have the require bootstrap line, then it might have this:

@import "bootstrap";

if so, add this:

@import "bootstrap";
@import "bootstrap-modal";

That way, bootstrap-modal loads second.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM