0.0
No commit activity in last 3 years
No release in over 3 years
An awesome replacement for JavaScript's alert. By t4t5.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.10
~> 10.0
 Project Readme

Sweetalert

Gem Version

A ruby gem for sweetalert developed by t4t5 A beautiful replacement for JavaScript's "alert"

Sweet Alert in Action

Live Demo

Installation

Add this line to your application's Gemfile:

gem 'sweetalertify'

And then execute:

$ bundle

Or install it yourself as:

$ gem install sweetalertify

Usage

To your application.js file, add:

//= require sweetalert-dev

Then, in your application.css, add:

@import "sweetalert";

Basic message:

swal("Hello world!");

A warning message, with a function attached to the "Confirm"-button:

swal({
  title: "Are you sure?",
  text: "You will not be able to recover this imaginary file!",
  type: "warning",
  showCancelButton: true,
  confirmButtonColor: "#DD6B55",
  confirmButtonText: "Yes, delete it!",
  closeOnConfirm: false,
  html: false
}, function(){
  swal("Deleted!",
  "Your imaginary file has been deleted.",
  "success");
});

Customizations

Visit the official Sweetalert repo for customizations and a more detailed usage guide

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/rahullakhaney/sweetalert.

Follow me on Twitter to see my #20in20 challenge

License

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