Fix handling of empty result sets in _changes
This commit is contained in:
parent
f097313e53
commit
a270963824
2 changed files with 5 additions and 5 deletions
|
@ -247,11 +247,6 @@ impl Resource for ChangesResource {
|
||||||
.and_then(move |(mut data, head)| {
|
.and_then(move |(mut data, head)| {
|
||||||
use std::iter::Iterator;
|
use std::iter::Iterator;
|
||||||
|
|
||||||
if data.len() == 0 {
|
|
||||||
// TODO Handle degenerate case
|
|
||||||
unimplemented!("Cannot deal with empty result sets");
|
|
||||||
}
|
|
||||||
|
|
||||||
let extra_element = if data.len() > self.limit as usize {
|
let extra_element = if data.len() > self.limit as usize {
|
||||||
data.pop()
|
data.pop()
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -9,11 +9,13 @@
|
||||||
><li><a rel="first" href="{{.end}}">Most recent changes</a></li
|
><li><a rel="first" href="{{.end}}">Most recent changes</a></li
|
||||||
></ul></nav>{{/newer}}
|
></ul></nav>{{/newer}}
|
||||||
<table>
|
<table>
|
||||||
|
{{#changes?}}
|
||||||
<tr>
|
<tr>
|
||||||
<th>Article</th>
|
<th>Article</th>
|
||||||
<th>Updated</th>
|
<th>Updated</th>
|
||||||
<th>Author</th>
|
<th>Author</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
{{/changes}}
|
||||||
{{#changes}}
|
{{#changes}}
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="{{#.slug.is_empty()?}}.{{/.slug.is_empty()}}{{.slug}}">{{.title}}</a></td>
|
<td><a href="{{#.slug.is_empty()?}}.{{/.slug.is_empty()}}{{.slug}}">{{.title}}</a></td>
|
||||||
|
@ -22,6 +24,9 @@
|
||||||
</tr>
|
</tr>
|
||||||
{{/changes}}
|
{{/changes}}
|
||||||
</table>
|
</table>
|
||||||
|
{{^changes?}}
|
||||||
|
<p>No hits</p>
|
||||||
|
{{/changes}}
|
||||||
{{#older}}<nav><ul class="dense"
|
{{#older}}<nav><ul class="dense"
|
||||||
><li><a rel="next" href="{{.more}}">Older changes</a></li
|
><li><a rel="next" href="{{.more}}">Older changes</a></li
|
||||||
><li><a rel="last" href="{{.end}}">First changes</a></li
|
><li><a rel="last" href="{{.end}}">First changes</a></li
|
||||||
|
|
Loading…
Reference in a new issue