-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
81 additions
and
1 deletion.
There are no files selected for viewing
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
25 changes: 25 additions & 0 deletions
25
samples/shopwithme/src/main/scala/code/snippet/AllItemsPage.scala
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package code | ||
package snippet | ||
|
||
import model.Item | ||
|
||
import net.liftweb._ | ||
import http._ | ||
import sitemap._ | ||
import sitemap._ | ||
import util._ | ||
import Helpers._ | ||
|
||
object AllItemsPage { | ||
lazy val menu = Menu.i("Items") / "all_items" | ||
|
||
def render = | ||
"tbody *" #> Item.items.map( | ||
item => { | ||
"@name" #> ("a *" #> item.name & | ||
"a [href]" #> Menu.ParamMenuable.toLoc(AnItemPage.menu).calcHref(item)) & | ||
"@description *" #> item.description & | ||
" | ||
}) | ||
} | ||
17 changes: 17 additions & 0 deletions
17
samples/shopwithme/src/main/scala/code/snippet/AnItemPage.scala
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package code | ||
package snippet | ||
|
||
import model.Item | ||
|
||
import net.liftweb._ | ||
import http._ | ||
import sitemap._ | ||
|
||
import scala.xml.Text | ||
|
||
object AnItemPage { | ||
// create a parameterized page | ||
def menu = Menu.param[Item]("Item", Loc.LinkText(i => Text(i.name)), | ||
Item.find _, _.id) / "item" | ||
} | ||
|
13 changes: 13 additions & 0 deletions
13
samples/shopwithme/src/main/scala/code/snippet/SearchPage.scala
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package code | ||
package snippet | ||
|
||
import model.Item | ||
|
||
import net.liftweb._ | ||
import http._ | ||
import sitemap._ | ||
|
||
object SearchPage { | ||
def menu = Menu.i("Woof") / "search" | ||
} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!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"> | ||
|
||
<table class="lift:AllItemsPage"> | ||
<tbody> | ||
<tr> | ||
<td name="name"><a href="#">Name</a></td> | ||
<td name="Description">Desc</td> | ||
<td name="Price">$50.00</td> | ||
<td><button name="add_to_cart">Add to Cart</button></td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
|
||
</div> | ||
</body> | ||
</html> | ||
|