lib/assets/javascripts/up/popup.js.coffee in upjs-rails-0.2.1 vs lib/assets/javascripts/up/popup.js.coffee in upjs-rails-0.2.2
- old
+ new
@@ -1,11 +1,26 @@
###*
Pop-up overlays
===============
+
+Instead of linking to another page fragment, you can also choose
+to "roll up" any target CSS selector in a popup overlay.
+Popup overlays close themselves if the user clicks somewhere outside the
+popup area.
-For modal dialogs see [up.modal](/up.modal).
+For modal dialogs see [up.modal](/up.modal) instead.
+\#\#\# Incomplete documentation!
+
+We need to work on this page:
+
+- Show the HTML structure of the popup elements, and how to style them via CSS
+- Explain how to position popup using `up-origin`
+- Explain how dialogs auto-close themselves when a fragment changes behind the popup layer
+- Document method parameters
+
+
@class up.popup
###
up.popup = (->
u = up.util
@@ -168,11 +183,10 @@
<a href="/decks" up-popup=".deck_list">Switch deck</a>
<a href="/settings" up-popup=".options" up-sticky>Settings</a>
@method a[up-popup]
@ujs
- @param up-target
@param [up-sticky]
@param [up-origin]
###
up.on('click', 'a[up-popup]', (event, $link) ->
event.preventDefault()
@@ -207,10 +221,14 @@
###
up.on('click', '[up-close]', (event, $element) ->
if $element.closest('.up-popup')
close()
)
-
+
+ # The framework is reset between tests, so also close
+ # a currently open popup.
+ up.bus.on 'framework:reset', close
+
open: open
close: close
source: source
defaults: defaults