Skip to content

Instantly share code, notes, and snippets.

@kindlychung
Created October 28, 2015 23:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kindlychung/b9ada54783614cd835d6 to your computer and use it in GitHub Desktop.
Save kindlychung/b9ada54783614cd835d6 to your computer and use it in GitHub Desktop.
package code.snippet
import net.liftweb.common.Logger
import net.liftweb.util.CssSel
import net.liftweb.util.Helpers._
import scala.xml.Text
/**
* Created by IDEA on 28/10/15.
*/
class ListUser extends Logger {
def log(text: String): Unit = {
text match {
case str if str.length == 0 => error("user with no name")
case str if str == "Forbidden" => warn("this user shouldn't have access")
case str => debug("User name: " + str)
}
}
def list: CssSel = {
val users = List("John", "Sarah", "Peter", "Sam", "", "Forbidden")
info("listing users")
"li .name *" #> users.map {
user => {
log(user)
Text(user)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment