Skip to content

Instantly share code, notes, and snippets.

@timperrett
Created June 1, 2010 08:39
Show Gist options
  • Save timperrett/420719 to your computer and use it in GitHub Desktop.
Save timperrett/420719 to your computer and use it in GitHub Desktop.
val xml =
{ if(S.errors.isEmpty) Nil else List(MsgsErrorMeta.get, f(S.errors), S.??("msg.error"), LiftRules.noticesContainerId + "_error") } ++
{ if(S.warnings.isEmpty) Nil else List((MsgsWarningMeta.get, f(S.warnings), S.??("msg.warning"), LiftRules.noticesContainerId + "_warn")) } ++
{ if (S.notices.isEmpty) Nil else List((MsgsNoticeMeta.get, f(S.notices), S.??("msg.notice"), LiftRules.noticesContainerId + "_notice")) } flatMap {
msg => msg._1 match {
case Full(meta) => <div id={msg._4}>{func(msg._2 _, meta.title openOr "",
meta.cssClass.map(new UnprefixedAttribute("class", _, Null)) openOr Null)}</div>
case _ => <div id={msg._4}>{func(msg._2 _, msg._3, Null)}</div>
}
}
val xml = List((MsgsErrorMeta.get, f(S.errors), S.??("msg.error"), LiftRules.noticesContainerId + "_error"),
(MsgsWarningMeta.get, f(S.warnings), S.??("msg.warning"), LiftRules.noticesContainerId + "_warn"),
(MsgsNoticeMeta.get, f(S.notices), S.??("msg.notice"), LiftRules.noticesContainerId + "_notice")) flatMap {
msg => msg._1 match {
case Full(meta) => <div id={msg._4}>{func(msg._2 _, meta.title openOr "",
meta.cssClass.map(new UnprefixedAttribute("class", _, Null)) openOr Null)}</div>
case _ => <div id={msg._4}>{func(msg._2 _, msg._3, Null)}</div>
}
}
@mariusdanciu
Copy link

val xml =
(( if(S.errors.isEmpty) Nil else List(MsgsErrorMeta.get, f(S.errors), S.??("msg.error"), LiftRules.noticesContainerId + "_error") ) ++
( if(S.warnings.isEmpty) Nil else List((MsgsWarningMeta.get, f(S.warnings), S.??("msg.warning"), LiftRules.noticesContainerId + "_warn")) ) ++
( if (S.notices.isEMpty) Nill else List((MsgsNoticeMeta.get, f(S.notices), S.??("msg.notice"), LiftRules.noticesContainerId + "_notice") ) ) flatMap {
msg => msg._1 match {
case Full(meta) =>

{func(msg._2 _, meta.title openOr "",
meta.cssClass.map(new UnprefixedAttribute("class", _, Null)) openOr Null)}

case _ =>
{func(msg._2 _, msg._3, Null)}

}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment