-
-
Save kindlychung/b9ada54783614cd835d6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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