Преглед на файлове

categories and decode adjustments

George Baugh преди 2 години
родител
ревизия
b59fe87f6e
променени са 4 файла, в които са добавени 10 реда и са изтрити 5 реда
  1. 3 1
      lib/Trog/Data/FlatFile.pm
  2. 2 1
      lib/Trog/Routes/HTML.pm
  3. 0 3
      www/templates/html/categories.tx
  4. 5 0
      www/templates/html/components/categories.tx

+ 3 - 1
lib/Trog/Data/FlatFile.pm

@@ -12,6 +12,7 @@ use File::Slurper;
 use File::Copy;
 use Mojo::File;
 use Path::Tiny();
+use Capture::Tiny qw{capture_merged};
 
 use lib 'lib';
 use Trog::SQLite::TagIndex;
@@ -71,7 +72,8 @@ sub read ( $self, $query = {} ) {
             print "Failed to Read $item:\n$@\n";
             next;
         }
-        my $parsed = eval { $parser->decode($slurped) };
+        my $parsed;
+        capture_merged { $parsed = eval { $parser->decode($slurped) } };
         if ( !$parsed ) {
 
             # Try and read it in binary in case it was encoded incorrectly the first time

+ 2 - 1
lib/Trog/Routes/HTML.pm

@@ -251,7 +251,8 @@ sub index ( $query, $content = '', $i_styles = [] ) {
     return $topbar if ref $topbar eq 'ARRAY';
     my $footbar   = Trog::Renderer->render( template => $footbar,   data => $query, component => 1, contenttype => 'text/html' );
     return $footbar if ref $footbar eq 'ARRAY';
-    my $categorybar   = Trog::Renderer->render( template => $categorybar,   data => $query, component => 1, contenttype => 'text/html' );
+    my $categorybar   = Trog::Renderer->render( template => $categorybar,   data => { %$query, categories => \@series}, component => 1, contenttype => 'text/html' );
+    DEBUG(\@series);
     return $categorybar if ref $categorybar eq 'ARRAY';
 
     return finish_render(

+ 0 - 3
www/templates/html/categories.tx

@@ -1,3 +0,0 @@
-: for $categories -> $category {
-<a href="<: $category.local_href :>"   title="<: $category.title :>" class="topbar"><: $category.title :></a>
-: }

+ 5 - 0
www/templates/html/components/categories.tx

@@ -0,0 +1,5 @@
+<span id="categories">
+: for $categories -> $category {
+<a href="<: $category.local_href :>"   title="<: $category.title :>" class="topbar"><: $category.title :></a>
+: }
+</span>