Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Made sure the built in snippets look to both mixed case and lower cas…

…e attributes
  • Loading branch information...
commit 45d5791f2cbc67ad8cd798a0340893e5ce8a5817 1 parent 19fa4d9
@dpp dpp authored
View
92 web/webkit/src/main/scala/net/liftweb/builtin/snippet/LazyLoad.scala
@@ -137,95 +137,3 @@ class AsyncRenderComet extends CometActor {
partialUpdate(js)
}
}
-
-/*
-/**
- * Buitin snippet for rendering page fragments asynchronously
- *
- */
-object LazyLoad extends DispatchSnippet {
-
- object lazyLoadCount extends RequestVar(0)
-
- def dispatch : DispatchIt = {
- case _ => render _
- }
-
- def render(xhtml: NodeSeq): NodeSeq = {
-
- (for (session <- S.session ?~ ("FIXME: Invalid session")) yield {
- val id = "lazy_"+ Helpers.nextFuncName;
-
- lazyLoadCount(lazyLoadCount.get + 1);
-
- val attrs = S.attrs
- val req = (S.request openOr Req.nil) snapshot
-
- val func: () => JsCmd = () => S.lightInit(req, session, attrs){
- Replace(id, xhtml)
- }
-
- val res = <div id={id}></div> ++ (
- if (lazyLoadCount.get == 1) {
- // Add the comet only once per page
- session.addAndInitCometActor(new AsyncRenderComet(),
- Full("AsyncRenderComet"),
- Full(id),
- NodeSeq.Empty, Map.empty)
-
- <tail><lift:comet type="AsyncRenderComet" name={id}></lift:comet></tail>
- } else {
- NodeSeq.Empty
- }
- )
-
- for (comet <- session.findComet("AsyncRenderComet");
- name <- comet.name if (name == id)) {
- comet ! Ready(func)
- }
-
- res
- }) match {
- case Full(x) => x
- case Empty => Comment("FIX"+ "ME: session or request are invalid")
- case Failure(msg, _, _) => Comment(msg)
- }
-
- }
-
-}
-
-
-private case class Ready(js: () => JsCmd)
-private case class StopClient()
-
-
-/**
- * The Comet Actor for sending down the computed page fragments
- *
- */
-class AsyncRenderComet extends CometActor {
-
- var content = NodeSeq.Empty
-
- var stopClient = false
-
- override def lifespan: Box[TimeSpan] = Full(90 seconds)
-
- def render: RenderOut = {
- content
- }
-
- override protected def localSetup() {
- ActorPing.schedule(this, StopClient, 1 minute)
- }
-
-
- override def lowPriority : PartialFunction[Any, Unit] = {
- case Ready(js) => partialUpdate(js())
- case StopClient => unWatch
- }
-}
-
-*/
-
View
6 web/webkit/src/main/scala/net/liftweb/builtin/snippet/Menu.scala
@@ -94,8 +94,8 @@ object Menu extends DispatchSnippet {
def builder(info: NodeSeq): NodeSeq = {
val outerTag: String = S.attr("outer_tag") openOr "ul"
val innerTag: String = S.attr("inner_tag") openOr "li"
- val expandAll = S.attr("expandAll").isDefined
- val linkToSelf: Boolean = S.attr("linkToSelf").map(Helpers.toBoolean) openOr false
+ val expandAll = (S.attr("expandAll") or S.attr("expandall")).isDefined
+ val linkToSelf: Boolean = (S.attr("linkToSelf") or S.attr("linktoself")).map(Helpers.toBoolean) openOr false
val expandAny: Boolean = S.attr("expand").map(Helpers.toBoolean) openOr true
@@ -399,7 +399,7 @@ object Menu extends DispatchSnippet {
*/
def item(text: NodeSeq): NodeSeq = {
val donthide = S.attr("donthide").map(Helpers.toBoolean) openOr false
- val linkToSelf = S.attr("linkToSelf").map(Helpers.toBoolean) openOr false
+ val linkToSelf = (S.attr("linkToSelf") or S.attr("linktoself")).map(Helpers.toBoolean) openOr false
for {
name <- S.attr("name").toList
View
6 web/webkit/src/main/scala/net/liftweb/builtin/snippet/Msg.scala
@@ -74,9 +74,9 @@ object Msg extends DispatchSnippet {
attr("id") match {
case Full(id) => {
// Extract the currently set CSS
- attr("errorClass").map(cls => MsgErrorMeta += (id -> cls))
- attr("warningClass").map(cls => MsgWarningMeta += (id -> cls))
- attr("noticeClass").map(cls => MsgNoticeMeta += (id -> cls))
+ (attr("errorClass") or attr("errorclass")).map(cls => MsgErrorMeta += (id -> cls))
+ (attr("warningClass") or attr("warningclass")).map(cls => MsgWarningMeta += (id -> cls))
+ (attr("noticeClass") or attr("noticeclass")).map(cls => MsgNoticeMeta += (id -> cls))
renderIdMsgs(id) ++ effects(id)
}
View
2  web/webkit/src/main/scala/net/liftweb/builtin/snippet/Msgs.scala
@@ -66,7 +66,7 @@ object Msgs extends DispatchSnippet {
*/
def render(styles: NodeSeq): NodeSeq = {
// Capture the value for later AJAX updates
- ShowAll(toBoolean(S.attr("showAll")))
+ ShowAll(toBoolean(S.attr("showAll") or S.attr("showall")))
// Extract user-specified titles and CSS classes for later use
List((NoticeType.Error, MsgsErrorMeta),
View
2  web/webkit/src/main/scala/net/liftweb/builtin/snippet/Tail.scala
@@ -63,7 +63,7 @@ object Head extends DispatchSnippet {
val xhtml = validHeadTagsOnly(_xhtml)
<head>{
- if (S.attr("withResourceId").filter(Helpers.toBoolean).isDefined) {
+ if ((S.attr("withResourceId") or S.attr("withresourceid")).filter(Helpers.toBoolean).isDefined) {
WithResourceId.render(xhtml)
} else {
xhtml
View
8 web/webkit/src/main/scala/net/liftweb/builtin/snippet/WithResourceId.scala
@@ -65,10 +65,14 @@ object WithResourceId extends DispatchSnippet {
}
- private def attrStr(attrs: MetaData, attr: String): Box[String] = attrs.get(attr) match {
+ private def attrStr(attrs: MetaData, attr: String): Box[String] = (attrs.get(attr) match {
case None => Empty
case Some(Nil) => Empty
case Some(x) => Full(x.toString)
- }
+ }) or (attrs.get(attr.toLowerCase) match {
+ case None => Empty
+ case Some(Nil) => Empty
+ case Some(x) => Full(x.toString)
+ })
}
Please sign in to comment.
Something went wrong with that request. Please try again.