lib/assets/javascripts/up/modal.js.coffee in upjs-rails-0.12.0 vs lib/assets/javascripts/up/modal.js.coffee in upjs-rails-0.12.1
- old
+ new
@@ -15,10 +15,11 @@
###*
Sets default options for future modals.
@method up.modal.config
+ @property
@param {Number} [config.width]
The width of the dialog as a CSS value like `'400px'` or `50%`.
Defaults to `undefined`, meaning that the dialog will grow to fit its contents
until it reaches `config.maxWidth`. Leaving this as `undefined` will
@@ -48,14 +49,14 @@
@param {String} [config.closeAnimation='fade-out']
The animation used to close the modal. The animation will be applied
to both the dialog box and the overlay dimming the page.
###
config = u.config
- maxWidth: undefined
- minWidth: undefined
- width: undefined
- height: undefined
+ maxWidth: null
+ minWidth: null
+ width: null
+ height: null
openAnimation: 'fade-in'
closeAnimation: 'fade-out'
closeLabel: '×'
template: (config) ->
"""
@@ -153,11 +154,11 @@
is starting to open.
- Emits an [event](/up.bus) `up:modal:opened` when the opening
animation has finished and the modal contents are fully visible.
@method up.modal.follow
- @param {Element|jQuery|String} elementOrSelector
+ @param {Element|jQuery|String} linkOrSelector
The link to follow.
@param {String} [options.target]
The selector to extract from the response and open in a modal dialog.
@param {Number} [options.width]
The width of the dialog in pixels.
@@ -179,13 +180,13 @@
@param {String} [options.easing]
The timing function that controls the animation's acceleration. [`up.animate`](/up.motion#up.animate).
@return {Promise}
A promise that will be resolved when the modal has finished loading.
###
- follow = ($link, options) ->
+ follow = (linkOrSelector, options) ->
options = u.options(options)
- options.$link = $link
+ options.$link = $(linkOrSelector)
open(options)
###*
Opens a modal for the given URL.
@@ -380,10 +381,10 @@
up.on('click', 'a[up-modal]', (event, $link) ->
event.preventDefault()
if $link.is('.up-current')
close()
else
- open($link)
+ follow($link)
)
# Close the modal when someone clicks outside the dialog
# (but not on a modal opener).
up.on('click', 'body', (event, $body) ->