Project

apprise-me

0.0
No commit activity in last 3 years
No release in over 3 years
Automatically uses apprise for confirms sent as a parameter to link_to
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

 Project Readme

apprise-me

This gem utilizes apprise confirms for any link_to with confirm as a parameter. It uses the apprise project found at https://github.com/ThrivingKings/Apprise for the Rails asset pipeline (available since Rails 3.1).

Note: This ignores links that have :remote => true set. Those links will continue to use the browser's default confirm.

Usage

To make use of this project add the following lines to 'app/assets/javascripts/application.js':

//= require apprise-me

$(document).ready(function(){
  $("a[data-apprise-confirm]").appriseConfirm()
})

and add the following line to 'app/assets/stylesheets/application.css'

*= require apprise-me

This will activate apprise confirms for any link_to made with the confirm parameter:

= link_to 'Remove User', user_path, :method => 'delete', :confirm => "Remove this user?"

Installation

In your Gemfile, add this line:

gem "apprise-me"

Then, run bundle install.

Options

You can pass any apprise options to appriseConfirm. I use this as a default:

$("a[data-apprise-confirm]").appriseConfirm({ verify: true, animate: 200 })

Any link_to can override apprise options with data attributes. Like this:

= link_to 'Remove User', user_path, :method => 'delete', :confirm => "Remove this user?", 'data-animate' => 1000, "data-text-yes" => 'Oh yeah', "data-text-no" => 'Nah'

You can find list of apprise options at the apprise project homepage: http://thrivingkings.com/apprise/