forked from bryanlarsen/agility-gitorial-patches
-
Notifications
You must be signed in to change notification settings - Fork 1
/
34-filtering-stories-by-status-dryml.patch
31 lines (25 loc) · 1.31 KB
/
34-filtering-stories-by-status-dryml.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
filtering-stories-by-status-dryml
From: Bryan Larsen <[email protected]>
## Filtering stories by status
Rapid's `<table-plus>` is giving us some nice searching and sorting features on the project page. We can easily add some filtering into the mix, so that it's easy to, say, see only new stories.
First we'll add the filter control to the header of the table-plus. Rapid provides a `<filter-menu>` tag which is just what we need. We want to add it to the header section, before the stuff that's already there. In DRYML, you can prepend or append content to any named parameter. `<table-plus>` has a `header:` parameter, so we can use `<prepend-header:>`, like this:
SHOW_PATCH
---
app/views/projects/show.dryml | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/app/views/projects/show.dryml b/app/views/projects/show.dryml
index 0ea6a1d..e79d1d0 100644
--- a/app/views/projects/show.dryml
+++ b/app/views/projects/show.dryml
@@ -1,6 +1,11 @@
<show-page>
<collection: replace>
<table-plus with="&@stories" fields="this, tasks_count, status">
+ <prepend-header:>
+ <div class="filter">
+ Display by status: <filter-menu param-name="status" options="&StoryStatus.all"/>
+ </div>
+ </prepend-header:>
<empty-message:>No stories match your criteria</empty-message:>
</table-plus>
</collection:>