Modal windows for rails
Good day, Khabrovsk!
Immediately excuse me for my Russian, as my native language is Ukrainian.
I am a Ruby On Rails developer and have come across many times the need for modal windows in my projects. I tried many ready-made ones such as facebox, fancybox, dialogs with jQuery UI, etc.
On one of my recent projects, the customer wanted to add a confirmation dialog before deleting any resource. It was necessary to display a beautiful dialog box, and not a javascript alert that gives us rails ujs. Then we used facebox and I had to climb all over the project to finish it all for Facebook. And then I decided to write something of my own, but purely for rails, so all of the above are easy to screw anywhere.
The main feature of the gem was that standard rail configurations can be replaced only by writing one line in the application.js file. Added support for pictures so that there was no need to put something else if the project needs a simple gallery. Everything takes only 5kb. Works in all browsers and ie since the seventh version.
It looks like this:


True for IE is not such a beautiful hatch. Who needs what would it look right in all browsers the same way, you need to put the option:
Gemfile:
application.js:
applications.css:
To replace standard confirmations in applications.js add
The library has many options. You can view it here.
Demo here.
Thank you for your attention.
Immediately excuse me for my Russian, as my native language is Ukrainian.
I am a Ruby On Rails developer and have come across many times the need for modal windows in my projects. I tried many ready-made ones such as facebox, fancybox, dialogs with jQuery UI, etc.
On one of my recent projects, the customer wanted to add a confirmation dialog before deleting any resource. It was necessary to display a beautiful dialog box, and not a javascript alert that gives us rails ujs. Then we used facebox and I had to climb all over the project to finish it all for Facebook. And then I decided to write something of my own, but purely for rails, so all of the above are easy to screw anywhere.
The main feature of the gem was that standard rail configurations can be replaced only by writing one line in the application.js file. Added support for pictures so that there was no need to put something else if the project needs a simple gallery. Everything takes only 5kb. Works in all browsers and ie since the seventh version.
It looks like this:


True for IE is not such a beautiful hatch. Who needs what would it look right in all browsers the same way, you need to put the option:
$.lazybox.settings({niceClose: false})Gem can:
- Print confirmation dialogs
- Display page remout
- Display pictures
Easy installation
Gemfile:
gem 'lazybox'application.js:
//= require lazyboxapplications.css:
*= require lazyboxTo replace standard confirmations in applications.js add
$.rails.allowAction = $.lazybox.confirm;The library has many options. You can view it here.
Demo here.
Thank you for your attention.