From: Robert 'phaylon' Sedlacek <r.sedlacek@shadowcat.co.uk>
Date: Wed, 20 Jun 2012 19:45:27 +0000 (+0000)
Subject: add a marker and a notice if the table did not contain any rows
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a3808ee65bc77be5eb2ad4b07941d8c79a0314fe;p=scpubgit%2FJSON-Tree-Viewer.git

add a marker and a notice if the table did not contain any rows
---

diff --git a/br.pl b/br.pl
index 590d940..f900028 100644
--- a/br.pl
+++ b/br.pl
@@ -195,13 +195,17 @@ sub render_table {
       <html>, <body>, "\n",
       ($data->{wrapper}||sub{@_})->(
         '', <table>, "\n",
-          (map { my $el = $_;
-            '  ', ($el->{key} eq '__error__') ? <tr class="error"> : <tr>,
-              (map {
-                <td>, $self->render_el($el, $_, $el->{$_}), </td>
-              } @{$data->{columns}}),
-            </tr>, "\n"
-          } @rows),
+          @rows
+          ? (map { my $el = $_;
+              '  ', ($el->{key} eq '__error__') ? <tr class="error"> : <tr>,
+                (map {
+                  <td>, $self->render_el($el, $_, $el->{$_}), </td>
+                } @{$data->{columns}}),
+              </tr>, "\n"
+            } @rows)
+          : (<tr class="no-rows">,
+              <td>, 'No entries in this data structure', </td>,
+            </tr>),
         '', </table>, "\n",
       ),
       </body>, </html>, "\n",