Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mkhairi/alertifyjs-rails
AlertifyJS as gem for rails asset pipeline
https://github.com/mkhairi/alertifyjs-rails
alert alertify confirm-dialog flash-messages notice rails rubygem rubyonrails
Last synced: 2 days ago
JSON representation
AlertifyJS as gem for rails asset pipeline
- Host: GitHub
- URL: https://github.com/mkhairi/alertifyjs-rails
- Owner: mkhairi
- License: mit
- Created: 2014-09-19T07:38:09.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2019-10-15T03:02:40.000Z (over 5 years ago)
- Last Synced: 2025-01-14T11:47:35.899Z (12 days ago)
- Topics: alert, alertify, confirm-dialog, flash-messages, notice, rails, rubygem, rubyonrails
- Language: Ruby
- Homepage: http://www.alertifyjs.com
- Size: 146 KB
- Stars: 23
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# alertifyjs-rails [![Gem Version](https://badge.fury.io/rb/alertifyjs-rails.svg)](http://badge.fury.io/rb/alertifyjs-rails)
This gem provides [alertify.js](http://alertifyjs.com/) for Rails.
## Installation
In your Gemfile:
```ruby
gem 'alertifyjs-rails'
```or system wide:
```console
$ gem install alertifyjs-rails
```## Usage
The alertify files will be added to the asset pipeline and available for you to use. Add the following line to `app/assets/javascripts/application.js`
```javascript
//= require alertify
```Optional js(coffe script) replace browser confirm dialog
* if you use jquery-ujs
```javascript
//= require alertify/confirm-modal
```* if you use rails-ujs (default rails 5)
```javascript
//= require alertify/confirm-ujs
```In order to get the CSS, add the following line to `app/assets/stylesheets/application.css`
```css
/*
*= require alertify
*= require alertify/default
*= require alertify/bootstrap
*/
```or if you using scss `app/assets/stylesheets/application.scss`
```scss
@import "alertify";
@import "alertify/default";
@import "alertify/bootstrap";
```flash helper, add the following line in layout
```html
<%= alertify_flash %>
```
or with wait timeout option
```html
<%= alertify_flash(wait: 20) %>
```
or in your js request format
```js
<%= alertify_flash_now %>
````**notes
The default content security policy for Rails 5.2 blocked the functionality of this flash helper. An initial workaround is to add :unsafe_inline as an option to the policy.script_src in development```ruby
policy.script_src :self, :https, :unsafe_inline```
More option? read [alertify.js](http://alertifyjs.com/) documentation [here](http://alertifyjs.com/)