Sha256: d4cb2d36dc036f5b42ffe60fde4e0c9d1e99098d348bc49f52d1790a4a560416

Contents?: true

Size: 1.57 KB

Versions: 1

Compression:

Stored size: 1.57 KB

Contents

var ConfirmationPopup = (function($) {
  'use strict';

  var _manageConfirmationPopup = function() {
    $(document).on('click', '.js-confirmation-popup-trigger', function(event) {
      var $this = $('.js-confirmation-popup-trigger');

      var $confirmationPopup = $('.js-confirmation-popup');
      var $confirmationPopupQuestion = $confirmationPopup.find('.js-confirmation-popup-question');
      var $confirmationPopupAnswerOk = $confirmationPopup.find('.js-confirmation-popup-answer-success');
      var $confirmationPopupAnswerNope = $confirmationPopup.find('.js-confirmation-popup-answer-nope');

      var location = $this.attr('href');
      var data_method = $this.data( "fake-method");

      var messageOk = $this.data('popup-ok');
      var messageNo = $this.data('popup-no');
      var messageText = $this.data('popup-text');

      // Set property data
      $confirmationPopupQuestion.text(messageText);
      $confirmationPopupAnswerOk.text(messageOk);
      $confirmationPopupAnswerOk.attr('href', location);
      $confirmationPopupAnswerOk.attr( "data-method", data_method);
      $confirmationPopupAnswerNope.text(messageNo);

      event.preventDefault();


      setTimeout(function() {
        $('body').addClass('is-confirmation-popup-open');
      }, 300);

    });
  };

  var _nopePopup = function() {
    $(document).on('click', '.js-confirmation-popup-answer-nope', function() {
      $('body').removeClass('is-confirmation-popup-open');
    });
  };

  var init = function() {
    _manageConfirmationPopup();
    _nopePopup();
  };

  return {
    init: init
  };

})(jQuery);

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lato_view-1.1.5 app/assets/javascripts/lato_view/build/ConfirmationPopup.js