lib/assets/javascripts/up/modal.js.coffee in upjs-rails-0.4.4 vs lib/assets/javascripts/up/modal.js.coffee in upjs-rails-0.5.0
- old
+ new
@@ -90,13 +90,13 @@
$modal.appendTo(document.body)
rememberHistory()
$modal.hide()
$modal
- updated = ($modal, animation) ->
+ updated = ($modal, animation, animateOptions) ->
$modal.show()
- up.animate($modal, animation)
+ up.animate($modal, animation, animateOptions)
###*
Opens the given link's destination in a modal overlay:
var $link = $('...');
@@ -111,15 +111,22 @@
@method up.modal.open
@param {Element|jQuery|String} elementOrSelector
@param {String} [options.url]
@param {Number} [options.width]
@param {Number} [options.height]
- @param {String} [options.animation]
@param {Boolean} [options.sticky=false]
If set to `true`, the modal remains
open even if the page changes in the background.
@param {Object} [options.history=true]
+ @param {String} [options.animation]
+ The animation to use when opening the modal.
+ @param {Number} [opts.duration]
+ The duration of the animation. See [`up.animate`](/up.motion#up.animate).
+ @param {Number} [opts.delay]
+ The delay before the animation starts. See [`up.animate`](/up.motion#up.animate).
+ @param {String} [opts.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.
###
open = (args...) ->
if u.isObject(args[0]) && !u.isElement(args[0]) && !u.isJQuery(args[0])
@@ -135,16 +142,17 @@
width = u.option(options.width, $link.attr('up-width'), config.width)
height = u.option(options.height, $link.attr('up-height'), config.height)
animation = u.option(options.animation, $link.attr('up-animation'), config.openAnimation)
sticky = u.option(options.sticky, $link.is('[up-sticky]'))
history = if up.browser.canPushState() then u.option(options.history, $link.attr('up-history'), true) else false
+ animateOptions = up.motion.animateOptions(options, $link)
close()
$modal = createHiddenModal(selector, width, height, sticky)
up.replace(selector, url,
history: history
- insert: -> updated($modal, animation)
+ insert: -> updated($modal, animation, animateOptions)
)
###*
Returns the source URL for the fragment displayed
in the current modal overlay, or `undefined` if no