lib/assets/javascripts/up/modal.js.coffee in upjs-rails-0.4.1 vs lib/assets/javascripts/up/modal.js.coffee in upjs-rails-0.4.2

- old
+ new

@@ -54,10 +54,20 @@ if u.isFunction(template) template(config) else template + rememberHistory = -> + $popup = $('.up-modal') + $popup.attr('up-previous-url', up.browser.url()) + $popup.attr('up-previous-title', document.title) + + discardHistory = -> + $popup = $('.up-modal') + $popup.removeAttr('up-previous-url') + $popup.removeAttr('up-previous-title') + createHiddenModal = (selector, width, height, sticky) -> $modal = $(templateHtml()) $modal.attr('up-sticky', '') if sticky $modal.attr('up-previous-url', up.browser.url()) $modal.attr('up-previous-title', document.title) @@ -66,10 +76,11 @@ $dialog.css('height', height) if u.isPresent(height) $content = $dialog.find('.up-modal-content') $placeholder = u.$createElementFromSelector(selector) $placeholder.appendTo($content) $modal.appendTo(document.body) + rememberHistory() $modal.hide() $modal updated = ($modal, animation) -> $modal.show() @@ -141,9 +152,10 @@ ) up.destroy($modal, options) autoclose = -> unless $('.up-modal').is('[up-sticky]') + discardHistory() close() ###* Opens the target of this link in a modal dialog: