Sha256: 1cd3eb08f86a4c360f393f8da90c4754b1e72c1a987e4d85b17b71e5f4078ab9

Contents?: true

Size: 967 Bytes

Versions: 3

Compression:

Stored size: 967 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

3 entries across 3 versions & 1 rubygems

Version Path
trestle-0.9.2 frontend/js/components/confirmation.js
trestle-0.9.1 frontend/js/components/confirmation.js
trestle-0.9.0 frontend/js/components/confirmation.js