diff --git a/app/controller.php b/app/controller.php
index 640bb7af6..a3dae528b 100644
--- a/app/controller.php
+++ b/app/controller.php
@@ -14,7 +14,15 @@ function beforeroute($f3) {
$f3->set('active',$f3->get('menu["'.$uri.'"]'));
}
- function afterroute() {
+ function afterroute($f3) {
+ // Collect errors.
+ if ($results=$f3->get('results')) {
+ $f3->set('errors', array_reduce($results, function($carry, $item){
+ if (!$item['status']) $carry[]=$item;
+ return $carry;
+ }, array()));
+ }
+
echo \Preview::instance()->render('layout.htm');
}
diff --git a/ui/layout.htm b/ui/layout.htm
index 5dc5bc3c2..20b4ae927 100644
--- a/ui/layout.htm
+++ b/ui/layout.htm
@@ -24,9 +24,23 @@
{{ @active }}
- {~ foreach (@results as @i=>@result): ~}
-
- {{ @i+1 }}
+
+
Errors
+ {~ if (@errors): ~}
+ {~ foreach (@errors as @result): ~}
+
+ {{ @result.id }}
+ {{ @result.text }} {~ if (@result.source) echo '('.@result.source.')' ~}
+
+ {~ endforeach ~}
+ {~ else: ~}
+
No errors.
+ {~ endif ~}
+
+
Tests
+ {~ foreach (@results as @result): ~}
+
+ {{ @result.id }}
{{ @result.text }} {~ if (!@result.status && @result.source) echo '('.@result.source.')' ~}
{~ endforeach ~}