[Jifty-commit] r4867 - in jifty/trunk: lib/Jifty/Web
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Wed Jan 16 13:57:55 EST 2008
Author: trs
Date: Wed Jan 16 13:57:55 2008
New Revision: 4867
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty/Web/Menu.pm
Log:
r31024 at zot: tom | 2008-01-16 13:54:12 -0500
Fix menu activation for menu items which are defined with link instead of url/label
Modified: jifty/trunk/lib/Jifty/Web/Menu.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Menu.pm (original)
+++ jifty/trunk/lib/Jifty/Web/Menu.pm Wed Jan 16 13:57:55 2008
@@ -151,16 +151,21 @@
@_
});
Scalar::Util::weaken($self->{children}{$key}{parent});
+
+ # Figure out the URL
+ my $child = $self->{children}{$key};
+ my $url = defined $child->link ? $child->link->url : $child->url;
+
# Activate it
- if (my $url = $self->{children}{$key}->url and Jifty->web->request) {
+ if ( defined $url and length $url and Jifty->web->request ) {
# XXX TODO cleanup for mod_perl
my $base_path = Jifty->web->request->path;
chomp($base_path);
-
- $base_path =~ s/index\.html$//g;
- $base_path =~ s/\/+$//g;
- $url =~ s/\/+$//i;
-
+
+ $base_path =~ s/index\.html$//;
+ $base_path =~ s/\/+$//;
+ $url =~ s/\/+$//;
+
if ($url eq $base_path) {
$self->{children}{$key}->active(1);
}
More information about the Jifty-commit
mailing list