Sha256: 43b5239c626dee27fd4feeceb955ba3869049af947a5cf5556250bae4b6e6ce6

Contents?: true

Size: 1014 Bytes

Versions: 4

Compression:

Stored size: 1014 Bytes

Contents

//= require apprise-min

(function( $ ) {
  $.fn.appriseConfirm = function(options) {
    if (options == undefined)
      options = {}
    defaultAppriseOptions = options;

    this.click(function(event) {
      $linkToVerify = $(this)

      var appriseOptions = defaultAppriseOptions
      $.each($linkToVerify.data(), function(key, val){
        if ($.inArray(key, ['confirm', 'verify', 'textNo', 'textYes', 'textCancel', 'textOk', 'animate']) >= 0) {
          appriseOptions[key] = val
          if (key == 'verify') {
            appriseOptions['confirm'] = false
          }
        }
      })

      if (appriseOptions['confirm'] == undefined && appriseOptions['verify'] == undefined) {
        appriseOptions['confirm'] = true
      }

      message = $linkToVerify.attr('data-apprise-confirm')
      apprise(message, appriseOptions, function(r){
        if (r) { $.rails.handleMethod($linkToVerify) }
      })

      event.preventDefault();
      return false;
    });
    return this;
  }
})( jQuery );

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
apprise-me-0.0.5 lib/assets/javascripts/apprise-me.js
apprise-me-0.0.4 lib/assets/javascripts/apprise-me.js
apprise-me-0.0.3 lib/assets/javascripts/apprise-me.js
apprise-me-0.0.2 lib/assets/javascripts/apprise-me.js