Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

update to Lift2.0-RC1

  • Loading branch information...
commit bf4f317962b4613468775aacb4c76d27c1066e9b 1 parent 5d224d6
@tromberg authored
View
2  src/main/scala/be/romberg/liftweb/util/BwMappedRichText.scala
@@ -55,8 +55,6 @@ class BwMappedRichText[T<:Mapper[T]](fieldOwner: T) extends MappedText[T](fieldO
def filterUnchangedInitialText(in: String):String = {
val noWsIn = whitespaceRx.replaceAllIn(in, "")
val noWsInitial = whitespaceRx.replaceAllIn(inputInitialTextWhenEmpty, "")
- Log.info("submitted:" + noWsIn)
- Log.info("default:" + noWsInitial)
if (noWsIn == noWsInitial)
""
else
View
5 src/main/scala/be/romberg/liftweb/util/HintedField.scala
@@ -13,9 +13,8 @@ trait HintedField[FieldType <: Any,OwnerType <: Mapper[OwnerType]] extends Mappe
override def fieldId = Some(Text(Helpers.nextFuncName))
// little used now - replaced by MBindHelper
def toFormFull : NodeSeq = {
- val hintHtml : NodeSeq = if (fieldHint.isDefined) <span class="fieldhint">{fieldHint.getOrElse("")}</span> else Nil
- val reqHtml : NodeSeq = if (isRequired) <span class="fieldhint">(Required)</span> else Nil
- <label for={fieldId}>{displayName + "\u2003" + reqHtml + "\u2003" + hintHtml}</label> ++ <br /> ++ toForm.open_!
+ def req = if (isRequired) "(Required)\u2003" else ""
+ <label for={fieldId}>{Text(displayName + "\u2003")}<span class="fieldhint">{req + fieldHint.getOrElse("")}</span></label> ++ <br /> ++ toForm.open_!
}
def cssClasses : List[String] = (if (isRequired) "required" :: Nil else Nil)
View
13 src/main/scala/be/romberg/liftweb/util/MBindHelper.scala
@@ -127,9 +127,10 @@ trait MBindHelper {
* For a field hint to be displayed, the field must extend HintedField
*/
def defaultInputField[A <: Mapper[A]](field:MappedField[_,A]): NodeSeq = {
- val hint:String = if (field.isInstanceOf[HintedField[_, _]])
- field.asInstanceOf[HintedField[Any,A]].fieldHintWithRequired
- else ""
+ val hint:String = field match {
+ case hf:HintedField[_, _] => hf.fieldHintWithRequired
+ case _ => ""
+ }
BindHelpers.bind("field", currentInputTemplate,
"caption" -> field.displayName,
@@ -218,7 +219,7 @@ trait MBindHelper {
if (s.child.length > 0) _currentShowTemplate(s.child)
_currentNode(s)
val res = (specialBinding orElse ((l:String) => l match {case label =>
- data.fieldByName(label.toLowerCase).map((field:MappedField[_,A]) => defaultShowField[A](field)
+ data.fieldByName(label).map((field:MappedField[_,A]) => defaultShowField[A](field)
) openOr Text("ERROR:Field not found:" + s.label)}))(s.label)
if (s.child.length > 0) _currentShowTemplate(saveTemplate)
res
@@ -228,7 +229,7 @@ trait MBindHelper {
if (s.child.length > 0) _currentInputTemplate(s.child)
_currentNode(s)
val res = (specialBinding orElse ((l:String) => l match {case label =>
- data.fieldByName(label.toLowerCase).map((field:MappedField[_,A]) => defaultInputField[A](field)
+ data.fieldByName(label).map((field:MappedField[_,A]) => defaultInputField[A](field)
) openOr Text("ERROR:Field not found:" + s.label)}))(s.label)
if (s.child.length > 0) _currentInputTemplate(saveTemplate)
res
@@ -283,7 +284,7 @@ trait MBindHelper {
if (s.child.length > 0) _currentCaptionTemplate(s.child)
_currentNode(s)
val res = (specialBinding orElse ((l:(Option[Mapper[A]],Int,String)) => l match {case (_, _, label) =>
- data.first.fieldByName(label.toLowerCase).map((field:MappedField[_,A]) => defaultFieldCaption[A](field)
+ data.first.fieldByName(label).map((field:MappedField[_,A]) => defaultFieldCaption[A](field)
) openOr Text("ERROR:Field not found:" + label)}))(None, 0, s.label)
if (s.child.length > 0) _currentCaptionTemplate(saveTemplate)
res
Please sign in to comment.
Something went wrong with that request. Please try again.