Sha256: fa8f871c5b4400499341b87956f86a183f0deeef5984c4913cf9042d47c9a018

Contents?: true

Size: 1.25 KB

Versions: 2

Compression:

Stored size: 1.25 KB

Contents

Trestle.confirmation = {};

Trestle.confirmation.DEFAULTS = {
  rootSelector:   'body',
  singleton:      true,
  popout:         true,
  title:          Trestle.i18n['admin.confirmation.title'] || 'Are you sure?',
  btnOkIcon:      '',
  btnOkClass:     'btn-primary',
  btnOkLabel:     Trestle.i18n['admin.confirmation.ok'] || 'OK',
  btnCancelIcon:  '',
  btnCancelClass: 'btn-default',
  btnCancelLabel: Trestle.i18n['admin.confirmation.cancel'] || 'Cancel',
  copyAttributes: ''
};

Trestle.confirmation.CONFIRM = $.extend({}, Trestle.confirmation.DEFAULTS, {
  selector: '[data-toggle="confirm"]'
});

Trestle.confirmation.DELETE = $.extend({}, Trestle.confirmation.DEFAULTS, {
  selector:   '[data-toggle="confirm-delete"]',
  btnOkClass: 'btn-danger',
  btnOkLabel: Trestle.i18n['admin.confirmation.delete'] || 'Delete'
});

Trestle.ready(function() {
  // This must be bound to an element beneath document so
  // that it is fired before any jquery_ujs events.
  var root = $('body');

  // Ensure it is only initialized once
  if (root.data('bs.confirmation')) return;

  // Delete confirmation
  new $.fn.confirmation.Constructor(root, Trestle.confirmation.DELETE);

  // General confirmation
  new $.fn.confirmation.Constructor(root, Trestle.confirmation.CONFIRM);
});

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
trestle-0.8.11 app/assets/javascripts/trestle/components/_confirmation.js
trestle-0.8.10 app/assets/javascripts/trestle/components/_confirmation.js