Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/atrox/sweetify

SweetAlert flash messages for Ruby on Rails
https://github.com/atrox/sweetify

flash-messages rails sweetalert

Last synced: 4 months ago
JSON representation

SweetAlert flash messages for Ruby on Rails

Awesome Lists containing this project

README

        

# Sweetify - SweetAlert for Rails

[![Gem](https://img.shields.io/gem/v/sweetify.svg?style=flat-square)](https://rubygems.org/gems/sweetify)

This gem allows you to use [SweetAlert](http://t4t5.github.io/sweetalert/) or [SweetAlert2](https://github.com/limonte/sweetalert2) for your flash messages.
_See the examples below, to see how to use it_

## Installation
**Note: This package does not provide the client-side files of SweetAlert. You have to provide them yourself.**

Add this line to your application's Gemfile:

```ruby
gem 'sweetify'
```

And then execute:
```bash
$ bundle
```

Next up, create the file `sweetify.rb` in your initializers to specify the library you are using (SweetAlert or SweetAlert2):
```ruby
# possible options: 'sweetalert', 'sweetalert2' - default is 'sweetalert2'
Sweetify.sweetalert_library = 'sweetalert2'
```

Next add the following line to the bottom of your application's layout file:
```html
...

<%= render 'sweetify/alert' %>