Object

net.liftweb.http.S

currentAttr

Related Doc: package S

Permalink

object currentAttr extends AttrHelper[Box]

Used to get an attribute by its name from the current snippet element. There are several means to getting attributes:

  // Get a Box for the attribute:
  val myAttr = S.currentAttr("test") openOr "Not found"

  // Get an attribute or return a default value:
  val myAttr = S.currentAttr("name", "Fred")

  // Apply a transform function on the attribute value, or return an Empty:
  val pageSize = S.currentAttr("count", _.toInt) openOr 20

  // There are also prefixed versions:
  val prefixedAttr = S.currentAttr("prefix", "name") openOr "Not found"

Note that this uses the data held in S.currentAttrs, which means that it will only find attributes from the current snippet element. For example, given the snippets:

<lift:MyStuff.snippetA foo="bar">
  <lift.MyStuff.snippetB>...</lift.MyStuff.snippetB>
</lift:MyStuff.snippetA>

Calling S.currentAttr("foo") from snippetB will return Empty.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. currentAttr
  2. AttrHelper
  3. AnyRef
  4. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Type Members

  1. type Info = String

    Permalink
    Definition Classes
    currentAttrAttrHelper

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def apply[T](prefix: String, key: String, f: (Info) ⇒ T, default: ⇒ T): T

    Permalink
    Definition Classes
    AttrHelper
  5. def apply[T](key: String, f: (Info) ⇒ T, default: ⇒ T): T

    Permalink
    Definition Classes
    AttrHelper
  6. def apply[T](prefix: String, key: String, f: (Info) ⇒ T): Box[T]

    Permalink
    Definition Classes
    AttrHelper
  7. def apply[T](key: String, f: (Info) ⇒ T): Box[T]

    Permalink
    Definition Classes
    AttrHelper
  8. def apply(prefix: String, key: String, default: ⇒ Info): Info

    Permalink
    Definition Classes
    AttrHelper
  9. def apply(key: String, default: ⇒ Info): Info

    Permalink
    Definition Classes
    AttrHelper
  10. def apply(prefix: String, key: String): Box[Info]

    Permalink
    Definition Classes
    AttrHelper
  11. def apply(key: String): Box[Info]

    Permalink
    Definition Classes
    AttrHelper
  12. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  13. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  14. def convert[T](in: Option[T]): Box[T]

    Permalink
    Attributes
    protected
    Definition Classes
    currentAttrAttrHelper
  15. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  16. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  17. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  18. def findAttr(prefix: String, key: String): Option[Info]

    Permalink
    Attributes
    protected
    Definition Classes
    currentAttrAttrHelper
  19. def findAttr(key: String): Option[Info]

    Permalink
    Attributes
    protected
    Definition Classes
    currentAttrAttrHelper
  20. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  21. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  22. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  23. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  24. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  25. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  26. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  27. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  28. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  31. def ~(prefix: String, key: String): Option[NodeSeq]

    Permalink

    Returns the prefixed attribute value as an Option[NodeSeq] for easy addition to the attributes

  32. def ~(key: String): Option[NodeSeq]

    Permalink

    Returns the unprefixed attribute value as an Option[NodeSeq] for easy addition to the attributes

Inherited from AttrHelper[Box]

Inherited from AnyRef

Inherited from Any

Ungrouped