[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.9.7-855-gdc0d9db

Thomas Sibley trs at bestpractical.com
Mon Dec 13 18:12:13 EST 2010


The branch, 3.9-trunk has been updated
       via  dc0d9db721b8c606cdbb93c476c8496746a18c48 (commit)
      from  493ec8355b9b1adcfa603f699f3cc2caade28de3 (commit)

Summary of changes:
 lib/RT/Interface/Web/Menu.pm        |   10 +++++-----
 share/html/Elements/Menu            |    7 +++++--
 share/html/NoAuth/css/base/main.css |    1 +
 share/html/NoAuth/css/base/nav.css  |    3 +++
 4 files changed, 14 insertions(+), 7 deletions(-)
 create mode 100644 share/html/NoAuth/css/base/nav.css

- Log -----------------------------------------------------------------
commit dc0d9db721b8c606cdbb93c476c8496746a18c48
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Mon Dec 13 17:09:38 2010 -0500

    Detect the active menu item and make use of it in the display

diff --git a/lib/RT/Interface/Web/Menu.pm b/lib/RT/Interface/Web/Menu.pm
index 0d3fa62..b5a6eea 100644
--- a/lib/RT/Interface/Web/Menu.pm
+++ b/lib/RT/Interface/Web/Menu.pm
@@ -227,14 +227,14 @@ sub child {
 
         # Activate it
         if ( defined $path and length $path ) {
-
-            # XXX TODO cleanup for mod_perl
-            my $base_path = '';
-            chomp($base_path);
+            my $base_path = $HTML::Mason::Commands::r->path_info;
+            my $query     = $HTML::Mason::Commands::m->cgi_object->query_string;
+            $base_path .= "?$query" if defined $query and length $query;
 
             $base_path =~ s/index\.html$//;
             $base_path =~ s/\/+$//;
-            $path      =~ s/\/+$//;
+            $path =~ s/index\.html$//;
+            $path =~ s/\/+$//;
 
             if ( $path eq $base_path ) {
                 $self->{children}{$key}->active(1);
diff --git a/share/html/Elements/Menu b/share/html/Elements/Menu
index de57805..6e99314 100755
--- a/share/html/Elements/Menu
+++ b/share/html/Elements/Menu
@@ -50,9 +50,12 @@
 % for my $child ($menu->children) {
 %   my $item_id = lc(($parent_id? $parent_id."-" : "") .$child->key);
 %   $item_id =~ s/\s/-/g;
+%   my @classes;
+%   push @classes, 'has-children' if $child->has_children;
+%   push @classes, 'active'       if $child->active;
 <%" " x ($depth+1)%><li id="li-<%$item_id%>"\
-% if ($child->has_children) {
- class="has-children"\
+% if (@classes) {
+ class="<% join ' ', @classes %>"\
 % }
 >\
 % if ($child->raw_html) {
diff --git a/share/html/NoAuth/css/base/main.css b/share/html/NoAuth/css/base/main.css
index 1d833cc..10da5cc 100644
--- a/share/html/NoAuth/css/base/main.css
+++ b/share/html/NoAuth/css/base/main.css
@@ -56,6 +56,7 @@
 @import "collection.css";
 @import "forms.css";
 @import "misc.css";
+ at import "nav.css";
 @import "ticket-form.css";
 @import "rights-editor.css";
 @import "theme-editor.css";
diff --git a/share/html/NoAuth/css/base/nav.css b/share/html/NoAuth/css/base/nav.css
new file mode 100644
index 0000000..053af2a
--- /dev/null
+++ b/share/html/NoAuth/css/base/nav.css
@@ -0,0 +1,3 @@
+.sf-menu li.active > .menu-item {
+    font-weight: bold;
+}

-----------------------------------------------------------------------


More information about the Rt-commit mailing list