Show most recent status and priority for tweedle
This commit is contained in:
parent
a502b58061
commit
9e2b39e90f
@ -18,9 +18,10 @@ $cat.cats:{cat|
|
||||
|
||||
<form method="post" action="issues/?_method_override=put">New issue: <input type="text" name="issuename"> <input type="submit" value="Create!"></form>
|
||||
<h2>Issues</h2>
|
||||
<ul>
|
||||
<table>
|
||||
<thead><tr><th>Title</th><th>Status</th><th>Priority</th></tr></thead><tbody>
|
||||
$cat.issues:{issue|
|
||||
<li><a href="../../issue/$issue.id$/">$issue.name$</a></li>
|
||||
<tr><td><a href="../../issue/$issue.id$/">$issue.name$</a></td><td>$issue.status$</td><td>$issue.priority$</td></tr>
|
||||
}$
|
||||
</ul>
|
||||
</tbody></table>
|
||||
})$
|
||||
|
||||
@ -22,6 +22,7 @@ Anyway, here's the import list.
|
||||
> import Data.Monoid
|
||||
> import Data.Text (pack)
|
||||
> import Control.Applicative ((<$>), (<*>))
|
||||
> import Data.Maybe (fromMaybe)
|
||||
|
||||
One of the goals of Yesod is to make it work with the compiler to help you program. Instead of configuration files, it uses typeclasses to both change default behavior and enable extra features. An example of the former is error pages, while an example of the latter is authentication.
|
||||
|
||||
@ -254,9 +255,15 @@ Now we want to convert the category into an HtmlObject. By doing so, we will get
|
||||
> [ ("name", Scalar $ Text $ pack name)
|
||||
> , ("id", Scalar $ Text $ pack $ show cid)
|
||||
> ]
|
||||
> let issueHelper (Issue name _ iid) = Mapping
|
||||
> let statusHelper = fromMaybe "No status set"
|
||||
> . getLast . mconcat . map (Last . messageStatus)
|
||||
> let priorityHelper = fromMaybe "No priority set"
|
||||
> . getLast . mconcat . map (Last . messagePriority)
|
||||
> let issueHelper (Issue name messages iid) = Mapping
|
||||
> [ ("name", Scalar $ Text $ pack name)
|
||||
> , ("id", Scalar $ Text $ pack $ show iid)
|
||||
> , ("status", Scalar $ Text $ pack $ statusHelper messages)
|
||||
> , ("priority", Scalar $ Text $ pack $ priorityHelper messages)
|
||||
> ]
|
||||
> let ho = Mapping
|
||||
> [ ("cats", Sequence $ map catHelper $ subCats cat)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user