Skip to content
Browse files

Fix #1072

  • Loading branch information...
1 parent d840afd commit 850c5c44c150301d70c2f97cbf2a709146efcec2 @nafg nafg committed
Showing with 5 additions and 3 deletions.
  1. +5 −3 persistence/mapper/src/main/scala/net/liftweb/mapper/view/TableEditor.scala
View
8 persistence/mapper/src/main/scala/net/liftweb/mapper/view/TableEditor.scala
@@ -24,9 +24,11 @@ import common.{Box, Full, Empty}
import util.BindPlus._
import util.{Helpers, BindHelpers}
import Helpers._
-import http.{SHtml, S, DispatchSnippet}
+import http.{SHtml, S, DispatchSnippet, js}
import S.?
+import js.JsCmds.{Script, Run}
+
import mapper.{Mapper, MetaMapper, LongKeyedMetaMapper, MappedField}
import Util._
@@ -245,7 +247,7 @@ trait ItemsListEditor[T<:Mapper[T]] {
def customBind(item: T): NodeSeq=>NodeSeq = (ns: NodeSeq) => ns
def edit(xhtml: NodeSeq): NodeSeq = {
- def unsavedScript = (<head><script type="text/javascript">
+ def unsavedScript = (<head>{Script(Run("""
var safeToContinue = false
window.onbeforeunload = function(evt) {{ // thanks Tim!
if(!safeToContinue) {{
@@ -255,7 +257,7 @@ trait ItemsListEditor[T<:Mapper[T]] {
return reply;
}}
}}
- </script></head>)
+ """))}</head>)
val noPrompt = "onclick" -> "safeToContinue=true"
val optScript = if(
(items.added.length + items.removed.length == 0) &&

0 comments on commit 850c5c4

Please sign in to comment.
Something went wrong with that request. Please try again.