Skip to content

Instantly share code, notes, and snippets.

@kevin4936
Created July 28, 2012 02:35
Show Gist options
  • Save kevin4936/3191484 to your computer and use it in GitHub Desktop.
Save kevin4936/3191484 to your computer and use it in GitHub Desktop.
users.html
def listUsers(xhtml : NodeSeq) : NodeSeq = {
var searchText = "";
def searchUser() : NodeSeq = {
val usersList = User.findByName(searchText);
def showUserView(user : User): NodeSeq = {
SetHtml("usersList", NodeSeq.Empty)
<ul type="none">
<li>
{user.firstName}
</li>
</ul>
}
<div>{usersList.flatMap(user => showUserView(user))}</div>
}
bind("userPage", xhtml,
"searchText" -%> SHtml.text(searchText,searchText = _ ,"maxlength" -> "15"),
"submit" -%> SHtml.submit("Search", searchUser),
"usersList" -%> searchUser()
);
}
<lift:userPage.listUsers>
<form class="lift:form.ajax">
<userPage:searchText style="width:150px;padding-top:0px;margin-top:0px;"/>
<userPage:submit type="submit" value="Search"/>
</form>
<userPage:usersList id="usersList"/>
</lift:userPage.listUsers>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment