Skip to content

Instantly share code, notes, and snippets.

@fmpwizard
Created November 9, 2014 04:03
Show Gist options
  • Save fmpwizard/d50ee9910530eca88702 to your computer and use it in GitHub Desktop.
Save fmpwizard/d50ee9910530eca88702 to your computer and use it in GitHub Desktop.
diff --git a/src/test/scala/webapptest/snippet/UploadProgressDemo.scala b/src/test/scala/webapptest/snippet/UploadProgressDemo.scala
index 822718a..8e81d0b 100644
--- a/src/test/scala/webapptest/snippet/UploadProgressDemo.scala
+++ b/src/test/scala/webapptest/snippet/UploadProgressDemo.scala
@@ -40,17 +40,18 @@ object UploadProgressDemo extends DispatchSnippet {
case "script" => UploadProgress.head _
}
- def upload(xhtml: NodeSeq): NodeSeq = {
+ def upload(html: NodeSeq): NodeSeq = {
if (S.get_?){
- val ns = "#ul-file_upload" #> SHtml.fileUpload(ul => theUpload(Full(ul)))
- ns(chooseTemplate("choose", "get", xhtml))
+ val ns = "#get ^^" #> "ignore" & "#ul-file_upload" #> SHtml.fileUpload(ul => theUpload(Full(ul)))
+ ns(html)
} else {
- val ns = "#ul-file_name" #> theUpload.is.map(v => Text(v.fileName)) &
+ val ns = "#get ^^" #> "ignore" &
+ "#ul-file_name" #> theUpload.is.map(v => Text(v.fileName)) &
"#ul-mime_type" #> theUpload.is.map(v => Box.legacyNullTest(v.mimeType).map(s => Text(s)).openOr(Text("No mime type supplied"))) &
"#ul-length" #> theUpload.is.map(v => Text(v.file.length.toString)) &
"#ul-md5" #> theUpload.is.map(v => Text(hexEncode(md5(v.file))))
- ns(chooseTemplate("choose", "post", xhtml))
+ ns(html)
}
}
diff --git a/src/test/webapp/uploadprogress.html b/src/test/webapp/uploadprogress.html
index 5be2497..87e658b 100644
--- a/src/test/webapp/uploadprogress.html
+++ b/src/test/webapp/uploadprogress.html
@@ -24,16 +24,16 @@
<p>Choose a file to upload</p>
<lift:UploadExample.upload form="post" multipart="true" id="upload">
- <choose:post>
+ <div id="post">
<p>
File name: <span id="ul-file_name"></span><br />
MIME Type: <span id="ul-mime_type"></span><br />
File length: <span id="ul-length"></span><br />
MD5 Hash: <span id="ul-md5"></span><br />
</p>
- </choose:post>
-
- <choose:get>
+ </div>
+
+ <div id="get">
<ul:file_upload/>
<input type="submit" value="Upload"/>
@@ -43,12 +43,5 @@
<div id="percents"></div>
</div>
</div>
-
-
- </choose:get>
-
- </lift:UploadExample.upload>
-
-
-
+ </lift:UploadExample.upload>
</lift:surround>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment