lib/assets/javascripts/up/modal.js.coffee in upjs-rails-0.18.0 vs lib/assets/javascripts/up/modal.js.coffee in upjs-rails-0.18.1
- old
+ new
@@ -166,12 +166,11 @@
$dialog.css('max-width', options.maxWidth) if u.isPresent(options.maxWidth)
$dialog.css('height', options.height) if u.isPresent(options.height)
$content = $modal.find('.up-modal-content')
# Create an empty element that will match the
# selector that is being replaced.
- $placeholder = u.$createElementFromSelector(target)
- $placeholder.appendTo($content)
+ u.$createPlaceholder(target, $content)
$modal.appendTo(document.body)
$modal
unshifters = []
@@ -308,20 +307,20 @@
options.history = if up.browser.canPushState() then u.option(options.history, u.castedAttr($link, 'up-history'), config.history) else false
options.confirm = u.option(options.confirm, $link.attr('up-confirm'))
animateOptions = up.motion.animateOptions(options, $link)
up.browser.confirm(options.confirm).then ->
- if up.bus.nobodyPrevents('up:modal:open', url: url)
+ if up.bus.nobodyPrevents('up:modal:open', url: url, message: 'Opening modal')
wasOpen = isOpen()
close(animation: false) if wasOpen
options.beforeSwap = -> createFrame(target, options)
promise = up.replace(target, url, u.merge(options, animation: false))
unless wasOpen
promise = promise.then ->
up.animate($('.up-modal'), options.animation, animateOptions)
promise = promise.then ->
- up.emit('up:modal:opened')
+ up.emit('up:modal:opened', message: 'Modal opened')
promise
else
# Although someone prevented opening the modal, keep a uniform API for
# callers by returning a Deferred that will never be resolved.
u.unresolvablePromise()
@@ -358,20 +357,20 @@
@stable
###
close = (options) ->
$modal = $('.up-modal')
if $modal.length
- if up.bus.nobodyPrevents('up:modal:close', $element: $modal)
+ if up.bus.nobodyPrevents('up:modal:close', $element: $modal, message: 'Closing modal')
options = u.options(options,
animation: config.closeAnimation,
url: $modal.attr('up-covered-url')
title: $modal.attr('up-covered-title')
)
currentUrl = undefined
promise = up.destroy($modal, options)
promise = promise.then ->
unshiftElements()
- up.emit('up:modal:closed')
+ up.emit('up:modal:closed', message: 'Modal closed')
promise
else
# Although someone prevented the destruction,
# keep a uniform API for callers by returning
# a Deferred that will never be resolved.