A tiny Rails engine that helps you loading remote links into a bootstrap modal.
Switch branches/tags
Clone or download
Permalink
Failed to load latest commit information.
app simplify usage Sep 28, 2018
bin create gem Sep 26, 2018
config create gem Sep 26, 2018
lib fix homepage in gemspec Sep 28, 2018
test create gem Sep 26, 2018
.gitignore ignore *.gem Sep 26, 2018
CHANGELOG.MD fix homepage in gemspec Sep 28, 2018
Gemfile create gem Sep 26, 2018
Gemfile.lock create gem Sep 26, 2018
MIT-LICENSE create gem Sep 26, 2018
README.md simplify usage Sep 28, 2018
Rakefile create gem Sep 26, 2018
remote_bootstrap_modal.gemspec fix homepage in gemspec Sep 28, 2018

README.md

Remote Bootstrap Modal

A tiny Rails engine that helps you loading remote links into a bootstrap modal.

It was created based on the following post: https://jtway.co/5-steps-to-add-remote-modals-to-your-rails-app-8c21213b4d0c

Installation

Add this line to your application's Gemfile:

gem 'remote_bootstrap_modal'

And then execute:

$ bundle

Or install it yourself as:

$ gem install remote_bootstrap_modal

Requirements

  • Rails
  • Bootstrap

Usage

  1. Make sure you have bootstrap in your application
  2. Add this gem to your Gemfile
  3. Add the following div <div id="modal-holder"></div> to your application layout (the modal will be rendered inside it)
  4. Add //= require remote_bootstrap_modal to your app/assets/javascripts/application.js (after jquery)
  5. Set the formats you need to respond with respond_to (ex: respond_to :html, :json)
  6. Call respond_modal_with in your controller passing the arguments you need
  7. Pass data: { modal: true } to links you want to load into a modal (ex: link_to 'Customers', customers_path, class: 'btn btn-default', data: { modal: true })

Customization

It is an engine, you can override any file to customize, you can create a app/views/layouts/modal.html.erb for instance with the modal layout you want.

License

The gem is available as open source under the terms of the MIT License.