[Rt-commit] r13098 - in rt/branches/3.8-TESTING: share/html/Elements

jesse at bestpractical.com jesse at bestpractical.com
Mon Jun 9 21:13:23 EDT 2008


Author: jesse
Date: Mon Jun  9 21:13:22 2008
New Revision: 13098

Modified:
   rt/branches/3.8-TESTING/   (props changed)
   rt/branches/3.8-TESTING/share/html/Elements/Menu
   rt/branches/3.8-TESTING/share/html/Elements/PageLayout

Log:
 r32534 at 31b:  jesse | 2008-06-09 20:55:11 -0400
 * Code cleanup. Add "last" classes on menu items since IE has no pseudo elements


Modified: rt/branches/3.8-TESTING/share/html/Elements/Menu
==============================================================================
--- rt/branches/3.8-TESTING/share/html/Elements/Menu	(original)
+++ rt/branches/3.8-TESTING/share/html/Elements/Menu	Mon Jun  9 21:13:22 2008
@@ -47,49 +47,53 @@
 %# END BPS TAGGED BLOCK }}}
 <ul<% !$level ? ' id="system-menu"' : ''|n %><% $menu_class ? qq[ class="$menu_class"] : ''|n %>>
 <div<% $menu_class ? qq[ class="$menu_class"] : ''|n %>><div class="wrapper">
-% my $sep         = 0;
-% my $postsep     = 0;
-% my $accesskey   = 1;
-% 
-% $count = 0;
-% $class = {};
-% 
-% foreach $tab (sort keys %{$toptabs}) {
-%     $count++;
-%
-%     my $current = $current_toptab || '';
-%     my $path    = $toptabs->{$tab}->{'path'} || "";
-%     
-%     $path    =~ s#/index.html$##gi;
-%     $current =~ s#/index.html$##gi;
-%     
-%     $sep     = $toptabs->{$tab}->{'separator'} ? 1 : 0;
-%
-%     my @aclass;
-%     push @aclass, 'selected'
-%            if $path eq $current;
-%
-%     push @aclass, 'odd'
-%            if $level % 2;
-%
-%     $class->{a} = join ' ', @aclass;
-%
-%     my @li;
-%     push @li, 'first'
-%            if $count == 1;
-%
-%     push @li, 'pre-separator'
-%            if $sep;
-%
-%     push @li, 'post-separator'
-%            if $postsep;
-%
-%     $class->{li} = join ' ', @li;
-%
-%     my $url = ($toptabs->{$tab}->{'path'}||'') =~ /^(?:https?|mailto):/i
-%         ? $toptabs->{$tab}->{'path'} || ''
-%         : RT->Config->Get('WebPath') . "/" . $toptabs->{$tab}->{'path'};
-%     
+<%perl>
+ my $sep         = 0;
+ my $postsep     = 0;
+ my $accesskey   = 1;
+ 
+ $count = 0;
+ $class = {};
+
+my @tabs = sort keys %$toptabs;
+ foreach $tab (@tabs) {
+     $count++;
+
+     my $current = $current_toptab || '';
+     my $path    = $toptabs->{$tab}->{'path'} || "";
+     
+     $path    =~ s#/index.html$##gi;
+     $current =~ s#/index.html$##gi;
+     
+     $sep     = $toptabs->{$tab}->{'separator'} ? 1 : 0;
+
+     my @aclass;
+     push @aclass, 'selected'
+            if $path eq $current;
+
+     push @aclass, 'odd'
+            if $level % 2;
+
+     $class->{a} = join ' ', @aclass;
+
+     my @li;
+     push @li, 'first'
+            if $count == 1;
+
+     push @li, 'pre-separator'
+            if $sep;
+
+     push @li, 'post-separator'
+            if $postsep;
+
+     push @li, 'last' if ( $tab eq $tabs[-1]);
+     $class->{li} = join ' ', @li;
+
+     my $url = ($toptabs->{$tab}->{'path'}||'') =~ /^(?:https?|mailto):/i
+         ? $toptabs->{$tab}->{'path'} || ''
+         : RT->Config->Get('WebPath') . "/" . $toptabs->{$tab}->{'path'};
+     
+</%perl>
     <li<% $class->{'li'} ? qq[ class="$class->{li}"] : ''|n %> >
     <% $count > 1 && !$postsep && qq[<span class="bullet">&#183; </span>]|n%>
     <a href="<% $url %>"

Modified: rt/branches/3.8-TESTING/share/html/Elements/PageLayout
==============================================================================
--- rt/branches/3.8-TESTING/share/html/Elements/PageLayout	(original)
+++ rt/branches/3.8-TESTING/share/html/Elements/PageLayout	Mon Jun  9 21:13:22 2008
@@ -70,34 +70,29 @@
 % 
   <ul id="page-menu" <% (($actions && %$actions) || ($subactions && %$subactions)) && q[ class="actions-present"] | n %>>
     <div><div><div>
-% if ($page_tabs) {
-%     foreach my $tab (sort keys %{$page_tabs}) {
-%         next if $tab =~ /^(?:current_toptab|this)$/;
-%         $count++;
-%
-%         my $current = $page_tabs->{current_toptab} || "";
-%         my $path    = $page_tabs->{$tab}->{'path'} || "";
-%         
-%         $path    =~ s#/index.html$##gi;
-%         $current =~ s#/index.html$##gi;
-%         
-%         $sep = $toptabs->{$tab}->{'separator'} ? 1 : 0;
-%
-%         $class->{a} = $path eq $current ? ' class="selected"' : undef;
-%
-%         my @li;
-%         push @li, 'first'
-%                if $count == 1;
-%
-%         push @li, 'pre-separator'
-%                if $sep;
-%
-%         push @li, 'post-separator'
-%                if $postsep;
-%
-%         $class->{li} = join ' ', @li;
-%     
-%
+<%perl>
+ if ($page_tabs) {
+     my @tabs = ( sort grep { $_ !~ /^(?:current_toptab|this)$/ } keys %{$page_tabs});
+     foreach my $tab ( @tabs ) {
+         $count++;
+
+         my $current = $page_tabs->{current_toptab} || "";
+         my $path    = $page_tabs->{$tab}->{'path'} || "";
+         
+         $path    =~ s#/index.html$##gi;
+         $current =~ s#/index.html$##gi;
+         
+         $sep = $toptabs->{$tab}->{'separator'} ? 1 : 0;
+         $class->{a} = $path eq $current ? ' class="selected"' : undef;
+
+         my @li;
+         push @li, 'first' if $count == 1;
+         push @li, 'pre-separator' if $sep;
+         push @li, 'post-separator' if $postsep;
+         push @li, 'last' if $tab eq $tabs[-1];
+         $class->{li} = join ' ', @li;
+     
+</%perl>
     <li<% $class->{li} ? qq[ class="$class->{li}"] : ''|n %>><% $count > 1 && !$postsep && "&#183; "|n%><a href="<%RT->Config->Get('WebPath')%>/<%$page_tabs->{$tab}->{'path'}%>"<%$class->{a}|n%><% $class->{a} ? ' name="focus"' : ''|n %>><% $page_tabs->{$tab}->{'title'} %></a></li>
 %
 %         if ($sep) {
@@ -114,31 +109,28 @@
 % if (($actions && %$actions) || ($subactions && %$subactions)) {
   <ul id="actions-menu">
     <div><div><div>
-% $sep       = 0;
-% $postsep   = 0;
-% $count     = 0;
-% $class     = { };
-%
-% for my $type ($actions, $subactions) {
-%
-% if ($type && %$type) {
-%     foreach my $action (sort keys %{$type}) {
-%         $count++;
-%
-%         $sep = $type->{$action}->{'separator'} ? 1 : 0;
-%
-%         my @li;
-%         push @li, 'first'
-%                if $count == 1;
-%
-%         push @li, 'pre-separator'
-%                if $sep;
-%
-%         push @li, 'post-separator'
-%                if $postsep;
-%
-%         $class->{li} = join ' ', @li;
-%
+<%perl>
+ $sep       = 0;
+ $postsep   = 0;
+ $count     = 0;
+ $class     = { };
+
+ for my $type ($actions, $subactions) {
+
+ if ($type && %$type) {
+     my @actions  = sort keys %{$type};
+     foreach my $action (@actions) {
+         $count++;
+         $sep = $type->{$action}->{'separator'} ? 1 : 0;
+
+         my @li;
+         push @li, 'first' if $count == 1;
+         push @li, 'pre-separator' if $sep;
+         push @li, 'post-separator' if $postsep;
+         push @li, 'last' if $action  eq $actions[-1];
+
+         $class->{li} = join ' ', @li;
+</%perl>
     <li<% $class->{li} ? qq[ class="$class->{li}"] : ''|n %>><% $count > 1 && !$postsep && qq[<span class="bullet">&#183; </span>]|n%>
 %         if ($type->{"$action"}->{'html'}) {
       <% $type->{"$action"}->{'html'} | n %>


More information about the Rt-commit mailing list