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

check if link remote is true and dismiss modal on confirm #2

Closed robincwillis closed 11 years ago

robincwillis commented 11 years ago

If someone is calling the modal from a link using an ajax helper like

<%= link_to "Delete post", @post, remote: true, method: :delete %>

it is important to dismiss the modal even if the confirm button is pressed. This small change checks for the presence of "remote: true" in the element and if found adds the 'data-dismiss' attribute to the confirm button of the modal.

vjt commented 11 years ago

Thanks!