diff --git a/app/assets/javascripts/blacklight/modal.js b/app/assets/javascripts/blacklight/modal.js index e3c9a04c59..416824a533 100644 --- a/app/assets/javascripts/blacklight/modal.js +++ b/app/assets/javascripts/blacklight/modal.js @@ -1,40 +1,40 @@ //= require blacklight/core -/* +/* The blacklight modal plugin can display some interactions inside a Bootstrap - modal window, including some multi-page interactions. + modal window, including some multi-page interactions. - It supports unobtrusive Javascript, where a link or form that would have caused + It supports unobtrusive Javascript, where a link that would have caused a new page load is changed to display it's results inside a modal dialog, by this plugin. The plugin assumes there is a Bootstrap modal div on the page with id #blacklight-modal to use as the modal -- the standard Blacklight - layout provides this. + layout provides this. - To make a link or form have their results display inside a modal, add - `data-blacklight-modal="trigger"` to the link or form. (Note, form itself not submit input) + To make a link have its results display inside a modal, add + `data-blacklight-modal="trigger"` to the link. With Rails link_to helper, you'd do that like: link_to something, link, data: { blacklight_modal: "trigger" } - The results of the link href or form submit will be displayed inside - a modal -- they should include the proper HTML markup for a bootstrap modal's + The results of the link href will be displayed inside + a modal -- it should include the proper HTML markup for a bootstrap modal's contents. Also, you ordinarily won't want the Rails template with wrapping navigational elements to be used. The Rails controller could suppress the layout when a JS AJAX request is detected, OR the response can include a `
` -- only the contents of the container will be placed inside the modal, the rest of the - page will be ignored. + page will be ignored. If you'd like to have a link or button that closes the modal, you can just add a `data-dismiss="modal"` to the link, standard Bootstrap convention. But you can also have an href on this link for non-JS contexts, we'll make sure - inside the modal it closes the modal and the link is NOT followed. + inside the modal it closes the modal and the link is NOT followed. - Link or forms inside the modal will ordinarily cause page loads + Links inside the modal will ordinarily cause page loads when they are triggered. However, if you'd like their results to stay within the modal, just add `data-blacklight-modal="preserve"` - to the link or form. + to the link. Here's an example of what might be returned, demonstrating most of the devices available: @@ -43,7 +43,7 @@
- +