Sha256: 43a1dd529fd5aefe7137dab139a6405140544ff5d6adb4be66a8c33f31e6e5f5

Contents?: true

Size: 975 Bytes

Versions: 6

Compression:

Stored size: 975 Bytes

Contents

import $ from 'jquery'

import { init } from '../core/events'
import { i18n } from '../core/i18n'

init(function (root) {
  const DEFAULTS = {
    singleton: true,
    popout: true,
    title: i18n['trestle.confirmation.title'] || 'Are you sure?',
    btnOkClass: 'btn btn-sm btn-primary',
    btnOkLabel: i18n['trestle.confirmation.ok'] || 'OK',
    btnCancelClass: 'btn btn-sm btn-light',
    btnCancelLabel: i18n['trestle.confirmation.cancel'] || 'Cancel',
    copyAttributes: 'href target data-remote data-method data-url data-params data-type'
  }

  const CONFIRM = {
    ...DEFAULTS,
    rootSelector: '[data-toggle="confirm"]'
  }

  const DELETE = {
    ...DEFAULTS,
    rootSelector: '[data-toggle="confirm-delete"]',
    btnOkClass: 'btn btn-sm btn-danger',
    btnOkLabel: i18n['trestle.confirmation.delete'] || 'Delete'
  }

  $(root).find('[data-toggle="confirm"]').confirmation(CONFIRM)
  $(root).find('[data-toggle="confirm-delete"]').confirmation(DELETE)
})

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
trestle-0.9.8 frontend/js/components/confirmation.js
trestle-0.9.7 frontend/js/components/confirmation.js
trestle-0.9.6 frontend/js/components/confirmation.js
trestle-0.9.5 frontend/js/components/confirmation.js
trestle-0.9.4 frontend/js/components/confirmation.js
trestle-0.9.3 frontend/js/components/confirmation.js