afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
afuna ([personal profile] afuna) wrote in [site community profile] changelog2010-01-30 09:38 am

[dw-free] Convert nav.bml to Template Toolkit

[commit: http://hg.dwscoalition.org/dw-free/rev/0e9ea16f6ddf]

http://bugs.dwscoalition.org/show_bug.cgi?id=2255

Fix HTML; clarify some variables.

Patch by [personal profile] foxfirefey.

Files modified:
  • cgi-bin/DW/Controller/Nav.pm
  • views/nav.tt
--------------------------------------------------------------------------------
diff -r c94773f1ac38 -r 0e9ea16f6ddf cgi-bin/DW/Controller/Nav.pm
--- a/cgi-bin/DW/Controller/Nav.pm	Sat Jan 30 09:32:28 2010 +0000
+++ b/cgi-bin/DW/Controller/Nav.pm	Sat Jan 30 09:38:11 2010 +0000
@@ -30,10 +30,11 @@ DW::Routing::Apache2->register_regex( qr
 
 # handles menu nav pages
 sub nav_handler {
+    my $opts = shift @_;
     my $r = DW::Request->get;
 
     # Check for a category like nav/read, then for a ?cat=read argument, else no category
-    my $cat = $_[0]->subpatterns->[0] || $r->get_args->{cat} || '';
+    my $cat = $opts->subpatterns->[0] || $r->get_args->{cat} || '';
 
     # this function returns an array reference of menu hashes
     my $menu_nav = DW::Logic::MenuNav->get_menu_display( $cat )
@@ -47,7 +48,7 @@ sub nav_handler {
     }
 
     # display according to the format
-    my $format = $_[0]->format;
+    my $format = $opts->format;
     if ( $format eq 'json' ) {
         # this prints out the menu navigation as JSON and returns
         $r->print( JSON::objToJson( $menu_nav ) );
diff -r c94773f1ac38 -r 0e9ea16f6ddf views/nav.tt
--- a/views/nav.tt	Sat Jan 30 09:32:28 2010 +0000
+++ b/views/nav.tt	Sat Jan 30 09:38:11 2010 +0000
@@ -14,7 +14,7 @@ the same terms as Perl itself.  For a co
 
 [% FOREACH menu = menu_nav %]
     [% IF NOT cat %]<h2 class="[% menu.name %]">[% menu.title | html %]</h2>[% END %]
-    <ul
+    <ul>
     [% FOREACH menu_item = menu.items %]
         <li><a href="[% menu_item.url | url %]">[% menu_item.text | html %]</a></li>
     [% END %]
--------------------------------------------------------------------------------