Created
August 20, 2009 17:24
-
-
Save bjartek/171210 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lift/src/main/scala/net/liftweb/http/SHtml.scala b/lift/src/main/scala/net/liftweb/http/SHtml.scala | |
index 2239ab3..3a761f1 100644 | |
--- a/lift/src/main/scala/net/liftweb/http/SHtml.scala | |
+++ b/lift/src/main/scala/net/liftweb/http/SHtml.scala | |
@@ -377,19 +377,7 @@ object SHtml { | |
*/ | |
def ajaxSelectObj[T](options: Seq[(T, String)], default: Box[T], | |
onSubmit: T => JsCmd, attrs: (String, String)*): Elem = { | |
- | |
- val secure = options.map{case (obj, txt) => (obj, randomString(20), txt)} | |
- val defaultNonce = default.flatMap(d => secure.find(_._1 == d).map(_._2)) | |
- val nonces = secure.map{case (obj, nonce, txt) => (nonce, txt)} | |
- def process(nonce: String): JsCmd = | |
- secure.find(_._2 == nonce).map(x => onSubmit(x._1)) getOrElse Noop | |
- // (nonces, defaultNonce, SFuncHolder(process)) | |
- | |
- ajaxSelect_*(nonces, | |
- defaultNonce, | |
- Empty, | |
- SFuncHolder(process _), | |
- attrs:_*) | |
+ ajaxSelectObj_(options, default, Empty, onSubmit, attrs:_*); | |
} | |
/** | |
@@ -403,7 +391,12 @@ object SHtml { | |
def ajaxSelectObj[T](options: Seq[(T, String)], default: Box[T], | |
jsFunc: Call, | |
onSubmit: T => JsCmd, attrs: (String, String)*): Elem = { | |
+ ajaxSelectObj_(options, default, Full(jsFunc), onSubmit, attrs:_*); | |
+ } | |
+ def ajaxSelectObj_[T](options: Seq[(T, String)], default: Box[T], | |
+ jsFunc: Option[Call], | |
+ onSubmit: T => JsCmd, attrs: (String, String)*): Elem = { | |
val secure = options.map{case (obj, txt) => (obj, randomString(20), txt)} | |
val defaultNonce = default.flatMap(d => secure.find(_._1 == d).map(_._2)) | |
val nonces = secure.map{case (obj, nonce, txt) => (nonce, txt)} | |
@@ -413,11 +406,12 @@ object SHtml { | |
ajaxSelect_*(nonces, | |
defaultNonce, | |
- Full(jsFunc), | |
+ jsFunc, | |
SFuncHolder(process _), | |
attrs:_*) | |
} | |
+ | |
def ajaxSelect(opts: Seq[(String, String)], deflt: Box[String], | |
func: String => JsCmd, attrs: (String, String)*): Elem = | |
ajaxSelect_*(opts, deflt, Empty, SFuncHolder(func), attrs :_*) | |
-- | |
1.6.4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment