Sha256: 2416f19130dd24073c1c620e95b315e7f76ee371da6ba9b9d1487697a7e6092c

Contents?: true

Size: 1.09 KB

Versions: 4

Compression:

Stored size: 1.09 KB

Contents

var CoreButton = (function () {

  function initializeButtonConfirmation (button) {
    var buttonElement = $(button).find('.elements-button__element')
    $(buttonElement).click(function (e) {
      var dataConfirmation = $(this).attr('data-confirmation')
      if (dataConfirmation && dataConfirmation === 'true') {
        e.preventDefault()
        // find confirmation popup
        var confirmation = $(this).parent().find('.elements-button__confirmation')
        // open confirmation popup
        $(confirmation).addClass('elements-button__confirmation--active')
        // manage delete click
        $(confirmation).find('.button.popup.false').click(function (e) {
          $(confirmation).removeClass('elements-button__confirmation--active')
          e.preventDefault()
        })
      }
    })
  }

  function _initButtonConfirmation () {
    $('.elements-button').each(function () {
      initializeButtonConfirmation(this)
    })
  }

  // Init:
  function init () {
    _initButtonConfirmation()
  }

  return {
    init: init,
    initializeButtonConfirmation: initializeButtonConfirmation
  }

})()

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lato_core-2.2.2 app/assets/javascripts/lato_core/modules/CoreButton.js
lato_core-2.2.0 app/assets/javascripts/lato_core/modules/CoreButton.js
lato_core-2.1.4 app/assets/javascripts/lato_core/modules/CoreButton.js
lato_core-2.1.3 app/assets/javascripts/lato_core/modules/CoreButton.js