Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

* Added docs to most of the objects in n.l.builtin.snippet

  • Loading branch information...
commit dd5dde242ab9431d8e852b06b734ee9f0870dc86 1 parent 02397ca
@fmpwizard fmpwizard authored
View
23 web/webkit/src/main/scala/net/liftweb/builtin/snippet/CSS.scala
@@ -1,5 +1,5 @@
/*
- * Copyright 2007-2011 WorldWide Conferencing, LLC
+ * Copyright 2007-2012 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,6 +30,16 @@ object CSS extends DispatchSnippet {
case "fancyType" => _ => fancyType
}
+ /**
+ * Add
+ *
+ * <pre name="code" class="xml">
+ * &lt;style class="lift:CSS.blueprint"></style>
+ * </pre>
+ *
+ * to your template and Lift will replace it with the path to the blueprint css styles
+ * (screen and print media)
+ */
def blueprint: NodeSeq = {
<xml:group>
<link rel="stylesheet" href={"/" + LiftRules.resourceServerPath +
@@ -45,6 +55,17 @@ object CSS extends DispatchSnippet {
""")
}
+ /**
+ * Add
+ *
+ * <pre name="code" class="xml">
+ * &lt;style class="lift:CSS.fancyType"></style>
+ * </pre>
+ *
+ * to your template and Lift will replace it with the path to the blueprint fancy-type plugin
+ * css styles
+ * (screen media)
+ */
def fancyType: NodeSeq = {
<link rel="stylesheet" href={"/" + LiftRules.resourceServerPath +
"/blueprint/plugins/fancy-type/screen.css"}
View
12 web/webkit/src/main/scala/net/liftweb/builtin/snippet/Children.scala
@@ -27,6 +27,18 @@ object Children extends DispatchSnippet {
case _ => render _
}
+ /**
+ * Returns the child nodes:
+ *
+ * <pre name="code" class="xml">
+ * &lt;lift:Children>
+ * &lt;div class="lift:MySnippet">
+ * &lt;/div>
+ * &lt;div class="lift:MyOtherSnippet">
+ * &lt;/div>
+ * &lt;/lift>
+ * </pre>
+ */
def render(kids: NodeSeq): NodeSeq = kids
}
View
24 web/webkit/src/main/scala/net/liftweb/builtin/snippet/Comet.scala
@@ -1,5 +1,5 @@
/*
- * Copyright 2007-2011 WorldWide Conferencing, LLC
+ * Copyright 2007-2012 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,6 +30,26 @@ object Comet extends DispatchSnippet with LazyLoggable {
case _ => render _
}
+ /**
+ *
+ * A typical comet tag could look like:
+ *
+ * <pre name="code" class="xml">
+ * &lt;lift:comet type=&lt;Your comet class> name=&lt;Optional, the name of this comet instance>>{xhtml}</lift:comet>
+ * </pre>
+ *
+ * For the name, you have three options
+ * <ul>
+ * <li>You can set a fix name using <pre><code>name="MyComet"</code></pre>
+ * <li>You can use a query parameter, for a url like foo?=id=122, your comet could take the
+ * name "122" if you use: <pre><code>metaname=id</code></pre>
+ * <li>You could assign a random name by using <pre><code>randomname=true</code></pre>
+ * </ul>
+ *
+ *
+ * @param kids The NodeSeq that is enclosed by the comet tags
+ * @return
+ */
def render(kids: NodeSeq) : NodeSeq = {
Props.inGAE match {
@@ -43,7 +63,7 @@ object Comet extends DispatchSnippet with LazyLoggable {
cometActor.parentTag.scope, Group(xml)) %
(new UnprefixedAttribute("id", Text(spanId), Null)) %
(timeb.filter(_ > 0L).map(time => (new PrefixedAttribute("lift", "when", Text(time.toString), Null))) openOr Null)
-
+
private def buildComet(kids: NodeSeq) : NodeSeq = {
val theType: Box[String] = S.attr.~("type").map(_.text)
val name: Box[String] = S.currentAttr("name") or
View
5 web/webkit/src/main/scala/net/liftweb/builtin/snippet/HTML5.scala
@@ -1,5 +1,5 @@
/*
- * Copyright 2009-2011 WorldWide Conferencing, LLC
+ * Copyright 2009-2012 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +22,9 @@ import scala.xml._
import net.liftweb.http._
import net.liftweb.common._
+/**
+ * Sets the DocType to html5
+ */
object HTML5 extends DispatchSnippet {
def dispatch : DispatchIt = {
View
26 web/webkit/src/main/scala/net/liftweb/builtin/snippet/LazyLoad.scala
@@ -1,5 +1,5 @@
/*
- * Copyright 2007-2011 WorldWide Conferencing, LLC
+ * Copyright 2007-2012 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,7 +31,8 @@ import Helpers._
/**
- *
+ * Enclose your snippet tags on your template with LazyLoad and the snippet will execute
+ * on a different thread, which avoids blocking the page render.
*/
object LazyLoad extends DispatchSnippet {
private object myFuncName extends TransientRequestVar(Helpers.nextFuncName)
@@ -41,6 +42,27 @@ object LazyLoad extends DispatchSnippet {
case _ => render _
}
+ /**
+ * Enclose your snippet like this:
+ *
+ * <pre name="code" class="xml">
+ * &lt;div class="lift:LazyLoad">
+ * &lt;div class="lift:MyLongRunningSnippet">&lt;/div>
+ * &lt;/div>
+ * </pre>
+ *
+ * You can add the template attribute to the LazyLoad tag and instead of
+ * showing the spinning circle, it will render your template.
+ *
+ *
+ * <pre name="code" class="xml">
+ * &lt;div class="lift:LazyLoad?template=&#39;my-nice-wait-message-template&#39;">
+ * &lt;div class="lift:MyLongRunningSnippet">&lt;/div>
+ * &lt;/div>
+ * </pre>
+ *
+ *
+ */
def render(xhtml: NodeSeq): NodeSeq = {
(for {
session <- S.session ?~ ("FIXME: Invalid session")
View
6 web/webkit/src/main/scala/net/liftweb/builtin/snippet/SkipDocType.scala
@@ -1,5 +1,5 @@
/*
- * Copyright 2009-2011 WorldWide Conferencing, LLC
+ * Copyright 2009-2012 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +27,10 @@ object SkipDocType extends DispatchSnippet {
case _ => render _
}
+ /**
+ * Useful if you need to omit the DocType from the returned html
+ * (calling the page from JavaScript, etc
+ */
def render(kids: NodeSeq): NodeSeq = {
S.skipDocType = true
kids
View
17 web/webkit/src/main/scala/net/liftweb/builtin/snippet/TestCond.scala
@@ -1,5 +1,5 @@
/*
- * Copyright 2009-2011 WorldWide Conferencing, LLC
+ * Copyright 2009-2012 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,17 +21,14 @@ package snippet
import scala.xml._
import net.liftweb.http._
+/**
+ * Use this builtin snippet to either show or hide some html
+ * based on the user being logged in or not.
+ */
object TestCond extends DispatchSnippet {
def dispatch : DispatchIt = {
- case "loggedin" |
- "logged_in" |
- "LoggedIn" | "loggedIn" => loggedIn _
-
- case "loggedout" |
- "logged_out" |
- "LoggedOut" |
- "loggedOut"
- => loggedOut _
+ case "loggedin" | "logged_in" | "LoggedIn" | "loggedIn" => loggedIn _
+ case "loggedout" | "logged_out" | "LoggedOut" | "loggedOut" => loggedOut _
}
def loggedIn(xhtml: NodeSeq): NodeSeq =
View
10 web/webkit/src/main/scala/net/liftweb/builtin/snippet/WithParam.scala
@@ -25,12 +25,22 @@ import net.liftweb.common._
object WithParamVar extends RequestVar[Map[String, NodeSeq]](Map.empty)
+/**
+ * Evaluates the body and stores it in the WithParam RequestVar map.
+ * This map is used in builtin.snippet.Surround to bind content to named sections.
+ * Note that the WithParam snippet is also mapped to "bind-at"
+ */
object WithParam extends DispatchSnippet {
def dispatch : DispatchIt = {
case _ => render _
}
+ /**
+ * Evaluates the body and stores it in the WithParam RequestVar map.
+ * This map is used in builtin.snippet.Surround to bind content to named sections.
+ * Note that the WithParam snippet is also mapped to "bind-at"
+ */
def render(kids: NodeSeq) : NodeSeq = {
(for {
ctx <- S.session ?~ ("FIX"+"ME: Invalid session")
View
12 web/webkit/src/main/scala/net/liftweb/builtin/snippet/XmlGroup.scala
@@ -27,6 +27,18 @@ object XmlGroup extends DispatchSnippet {
case _ => render _
}
+ /**
+ * Returns the child nodes:
+ *
+ * <pre name="code" class="xml">
+ * &lt;lift:XmlGroup>
+ * &lt;div class="lift:MySnippet">
+ * &lt;/div>
+ * &lt;div class="lift:MyOtherSnippet">
+ * &lt;/div>
+ * &lt;/lift>
+ * </pre>
+ */
def render(kids: NodeSeq): NodeSeq = kids
}
View
6 web/webkit/src/main/scala/net/liftweb/http/auth/Role.scala
@@ -35,7 +35,7 @@ object AuthRole {
}
/**
- * A Role may be assingned to a resource denominated by a path. A subject
+ * A Role may be assigned to a resource denominated by a path. A subject
* that is assigned to the same role or to a role higher into the roles hierarchy
* will have access to requested resource.
*/
@@ -44,7 +44,7 @@ trait Role {
private var childs: List[Role] = Nil
/**
- * The name ofthe role
+ * The name of the role
*/
def name: String
@@ -70,7 +70,7 @@ trait Role {
def getChildRoles = childs
/**
- * Retuns the parent node
+ * Returns the parent node
*/
def getParent = parent
Please sign in to comment.
Something went wrong with that request. Please try again.