lib/ecrire/app/assets/javascripts/admin/navigation/save.js.coffee in ecrire-0.28.3 vs lib/ecrire/app/assets/javascripts/admin/navigation/save.js.coffee in ecrire-0.29.0
- old
+ new
@@ -29,11 +29,15 @@
save: (e) =>
e.preventDefault()
e.stopPropagation()
- dialog = @retrieve('#SavePost').cloneNode(true)
+ dialog = @retrieve('#SavePost')
+
+ if e.type == 'click'
+ dialog.dataset.preview = true
+
document.body.appendChild(dialog)
saved: (e) =>
@cache(true)
@@ -57,10 +61,13 @@
@on 'transitionEnd', @remove
saved: (e) =>
msg = @element().querySelector('.message')
msg.innerHTML = e.MessageHTML
- window.setTimeout @remove, 400
+ if @element().dataset.preview == 'true'
+ window.location = @element().getAttribute('href')
+ else
+ window.setTimeout @remove, 400
download: (e) =>
if e.lengthComputable
@element().querySelector('.progress').style.width = "#{50 + e.total / e.loaded * 50}%"
else