ifad / data-confirm-modal

Makes Rails' link_to confirm: 'foo' build a Bootstrap Modal instead of calling the browser's confirm() API.
MIT License
271 stars 115 forks source link

Run smoothly on B3 and B4 #60

Closed vjt closed 6 years ago

vjt commented 6 years ago

This pull introduces conditional behaviour depending on the bootstrap version, to fix #59.

The bootstrap version is extracted from the $.fn.modal.Constructor.VERSION, as advertised on B3 Documentation.

The modal-header element in the DOM of B4 uses display:flex, and the close button uses negative margins. On the other hand, in B3, the modal-header is a display:block and the close button floats to the right. Thus, in B3 the close button must be before the modal-title, whereas in B4 it must be after.