Skip to content

Commit

Permalink
Incorporated feedback from retnuH.
Browse files Browse the repository at this point in the history
  • Loading branch information
dchenbecker committed Apr 30, 2009
1 parent 62f1f02 commit 0c040b8
Show file tree
Hide file tree
Showing 3 changed files with 603 additions and 454 deletions.
76 changes: 62 additions & 14 deletions chap-demoapp.lyx
@@ -1,4 +1,4 @@
#LyX 1.6.1 created this file. For more info see http://www.lyx.org/
#LyX 1.6.2 created this file. For more info see http://www.lyx.org/
\lyxformat 345
\begin_document
\begin_header
Expand Down Expand Up @@ -1311,6 +1311,12 @@ case Full(user)

.
See Box in the Lift API.
We also
\end_layout

\begin_layout Plain Layout

// briefly discuss Box in Appendix C.
\end_layout

\begin_layout Plain Layout
Expand Down Expand Up @@ -2403,8 +2409,8 @@ name "lst:Embedded-Expense-table"
\end_layout

\begin_layout Standard
Before we get into the AJAX portion of the code, let's define a helper method,
shown in Listing
Before we get into the AJAX portion of the code, let's define a helper method
in our Accounts snippet class, shown in Listing
\begin_inset CommandInset ref
LatexCommand ref
reference "lst:The-table-helper-function"
Expand All @@ -2421,7 +2427,14 @@ reference "lst:The-table-helper-function"
\family typewriter
Helpers.chooseTemplate
\family default
method, Section ???) and binds each
method, Section
\begin_inset CommandInset ref
LatexCommand vref
reference "sec:BindHelpers"

\end_inset

) and binds each
\family typewriter
Expense
\family default
Expand Down Expand Up @@ -2460,52 +2473,87 @@ name "lst:The-table-helper-function"

\begin_layout Plain Layout

def buildExpenseTable(entries : List[Expense], template : NodeSeq) = {
package com.pocketchangeapp.snippet
\end_layout

\begin_layout Plain Layout

...
imports ...
\end_layout

\begin_layout Plain Layout

\end_layout

\begin_layout Plain Layout

class Accounts {
\end_layout

\begin_layout Plain Layout

...
\end_layout

\begin_layout Plain Layout

def buildExpenseTable(entries : List[Expense], template : NodeSeq) = {
\end_layout

\begin_layout Plain Layout

// Calls bind repeatedly, once for each Entry in entries
// Calls bind repeatedly, once for each Entry in entries
\end_layout

\begin_layout Plain Layout

entries.flatMap({ entry =>
entries.flatMap({ entry =>
\end_layout

\begin_layout Plain Layout

bind("entry", chooseTemplate("acct", "tableEntry", template),
bind("entry", chooseTemplate("acct", "tableEntry", template),
\end_layout

\begin_layout Plain Layout

"date" -> Text(Util.slashDate.format(entry.dateOf.is)),
"date" -> Text(Util.slashDate.format(entry.dateOf.is)),
\end_layout

\begin_layout Plain Layout

"desc" -> Text(entry.description.is),
"desc" -> Text(entry.description.is),
\end_layout

\begin_layout Plain Layout

"tags" -> Text(entry.tags.map(_.tag.is).mkString(", ")),
"tags" -> Text(entry.tags.map(_.tag.is).mkString(", ")),
\end_layout

\begin_layout Plain Layout

"amt" -> Text(entry.amount.toString),
"amt" -> Text(entry.amount.toString),
\end_layout

\begin_layout Plain Layout

"balance" -> Text(entry.currentBalance.toString))
"balance" -> Text(entry.currentBalance.toString))
\end_layout

\begin_layout Plain Layout

})
})
\end_layout

\begin_layout Plain Layout

}
\end_layout

\begin_layout Plain Layout

...
\end_layout

\begin_layout Plain Layout
Expand Down

0 comments on commit 0c040b8

Please sign in to comment.