Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dei79/jquery-modal-rails
The simplest possible modal for jQuery for the Rails 3.1+ asset pipeline
https://github.com/dei79/jquery-modal-rails
Last synced: 6 days ago
JSON representation
The simplest possible modal for jQuery for the Rails 3.1+ asset pipeline
- Host: GitHub
- URL: https://github.com/dei79/jquery-modal-rails
- Owner: dei79
- License: mit
- Created: 2012-06-19T17:58:58.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2021-03-31T17:46:44.000Z (almost 4 years ago)
- Last Synced: 2025-01-14T02:08:00.576Z (13 days ago)
- Language: Ruby
- Size: 675 KB
- Stars: 64
- Watchers: 6
- Forks: 59
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
###Currently I moved to angular-js for all my web applications. Because of that I do not maintain this project any more. It would be a pleasure for me to hand this project over to an other developer. Please just send me a note or create a issue if you are the one.
jquery-modal-rails
==================The simplest possible modal for jQuery for the Rails 3.1+ asset pipeline based on https://github.com/kylefox/jquery-modal
## Usage
In your Gemfile, add:
```ruby
group :assets do
gem 'jquery-ui-rails'
gem 'jquery-modal-rails'
end
```## Require Everything
To require the jQuery modal modules, add the following to your application.js:
```javascript
//= require jquery.ui.all
//= require jquery.modal
```Also add the jQuery modal CSS to your application.css:
```css
/*
*= require jquery.ui.all
*= require jquery.modal
*/
```All images required by jQuery Modal are automatically served through the asset
pipeline, so you are good to go! For example, this code will open a given DIV
as a modal dialog```rails
The basic dialog window is an overlay positioned within the viewport and is protected from page content
(like select elements) shining through with an iframe. It has a title bar and a content area, and can be moved,
resized and closed with the 'x' icon by default.
<%= link_to_modal "Demo Form", "#demo-form", :class=>"button" %>
```Opening an existing view via AJAX as a modal dialog is that easy:
```rails
<%= link_to_modal "New User", new_user_path, :class=>"button" %>
```## Forms-Support
The link_to_modal helper offers forms support. The following parameter ensures that every form which is part
of the received html content will be submitted via AJAX request. As a requirement the controller action needs
to support JSON```rails
<%= link_to_modal 'New User', new_user_path, :remote => true %>
```## Cancel or Close buttons
All anchors generated with the link_to helper can be marked as a dialog close button. Just use the following
sample:```rails
<%= link_to 'Cancel', users_path, :rel => "modal:close" %>
```## Contributors
Thank you to the following wonderful people and projects for contributing to jquery-modal-rails:
* @kylefox with https://github.com/kylefox/jquery-modal
* @joliss with https://github.com/joliss/jquery-ui-rails