Files
iD/modules/ui/confirm.js
Bryan Housel 8af6d65e33 Switch from uiModal to uiConfirm, adjust styles
A few things going on in this commit:
- uiConfirm already has an OK button, so I'm trying to use that instead of uiModal.
- The confirm OK button cancels, which is maybe a problem. I might change it.
- Dispatch a change event instead of trying to call a function back in uiBackground
- Remove some of the custom css, since we already have some shared button css
- add utilNoAuto to textarea (this just prevents autocomplete and other
  annoying behaviors especially in Safari)
2018-08-11 11:38:05 -04:00

40 lines
937 B
JavaScript

import { t } from '../util/locale';
import { uiModal } from './modal';
export function uiConfirm(selection) {
var modalSelection = uiModal(selection);
modalSelection.select('.modal')
.classed('modal-alert', true);
var section = modalSelection.select('.content');
section.append('div')
.attr('class', 'modal-section header');
section.append('div')
.attr('class', 'modal-section message-text');
var buttons = section.append('div')
.attr('class', 'modal-section buttons cf');
modalSelection.okButton = function() {
buttons
.append('button')
.attr('class', 'button ok-button action col4')
.on('click.confirm', function() {
modalSelection.remove();
})
.text(t('confirm.okay'))
.node()
.focus();
return modalSelection;
};
return modalSelection;
}