Created
November 16, 2012 16:15
-
-
Save robertberry-zz/4088610 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
package snippet | |
import code.model.User | |
import scala.xml.{NodeSeq, Text} | |
import net.liftweb.util._ | |
import net.liftweb.common._ | |
import code.lib._ | |
import Helpers._ | |
class HomePage { | |
def summary(html: NodeSeq): NodeSeq = User.currentUser match { | |
case Full(user) => { | |
val entries: NodeSeq = user.allAccounts match { | |
case Nil => Text("You have no accounts.") | |
case accounts => accounts.flatMap({account => | |
bind("acct", chooseTemplate("account", "entry", html), | |
"name" -> <a href={"/account/" + account.name.is}> | |
{account.name.is}</a>, | |
"balance" -> Text(account.balance.toString)) | |
}) | |
} | |
bind("account", html, "entry" -> entries) | |
} | |
case _ => <lift:embed what="welcome_message" /> | |
} | |
def test = "#test *" #> <p>Whut</p> | |
} |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta content="text/html; charset=UTF-8" http-equiv="content-type" /> | |
<title>Home</title> | |
</head> | |
<body class="lift:content_id=main"> | |
<div id="main" class="lift:surround?with=default;at=content"> | |
<h2>Home</h2> | |
<span class="lift:homePage.test"> | |
<span id="test">test span</span> | |
</span> | |
<lift:homePage.summary> | |
<div class="column span-24 bordered"> | |
<h3>Summary of accounts:</h3> | |
<account:entry> | |
<account:name />: <account:balance /> <br /> | |
</account:entry> | |
</div> | |
</lift:homePage.summary> | |
</div> | |
</body> | |
</html> |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta content="text/html; charset=UTF-8" http-equiv="content-type" /> | |
<title>Home</title> | |
</head> | |
<body class="lift:content_id=main"> | |
<div id="main" class="lift:surround?with=default;at=content"> | |
<h2>Home</h2> | |
<span class="lift:homePage.test"> | |
<span id="test">test span</span> | |
</span> | |
<div class="lift:homePage.summary"> | |
<div class="column span-24 bordered"> | |
<h3>Summary of accounts:</h3> | |
<account:entry> | |
<account:name />: <account:balance /> <br /> | |
</account:entry> | |
</div> | |
</div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The error message:
Error processing snippet: homepage.summary
Reason: Class Not Found