Browse code

Fix navigation active tab issue

hiromipaw authored on12/01/2017 12:53:37
Showing3 changed files
... ...
@@ -8,9 +8,11 @@ about/corepeople.html.en
8 8
 about/financials.html.en
9 9
 about/gsoc.html.en
10 10
 about/jobs-browserhacker.html.en
11
+about/jobs-comm-director.html.en
11 12
 about/jobs-controller.html.en
12 13
 about/jobs-coredev.html.en
13 14
 about/jobs-dircomms.html.en
15
+about/jobs-execadmin.html.en
14 16
 about/jobs-extdev.html.en
15 17
 about/jobs-lead-automation.html.en
16 18
 about/jobs-pluggabletransport.html.en
... ...
@@ -11,7 +11,7 @@
11 11
     <a href="<page docs/documentation>">Documentation &raquo; </a>
12 12
     <a href="<page docs/tor-doc-osx>">Tor Dev Manual</a>
13 13
   </div>
14
-  <div id="maincol">  
14
+  <div id="maincol">
15 15
     <:
16 16
     	die "Missing git clone at $(TORGIT)" unless -d "$(TORGIT)";
17 17
     	my $man = `GIT_DIR=$(TORGIT) git show $(DEVTAG):doc/tor.1.txt | asciidoc -d manpage -s -o - -`;
... ...
@@ -27,4 +27,4 @@
27 27
   <!-- END SIDECOL -->
28 28
 </div>
29 29
 <!-- END CONTENT -->
30
-#include <foot.wmi>  
30
+#include <foot.wmi>
... ...
@@ -24,7 +24,7 @@
24 24
    <ifneq "$(REDIRECT)" "" "<meta http-equiv="refresh" content="0;url=$(DOCROOT)/$(REDIRECT)">">
25 25
    <ifneq "$(REDIRECT_GLOBAL)" "" "<meta http-equiv="refresh" content="0;url=$(REDIRECT_GLOBAL)">">
26 26
 
27
-   # begin WML to generate css/js paths 
27
+   # begin WML to generate css/js paths
28 28
    <ifneq "$(STYLESHEET)" "" "<link href="$(DOCROOT)/$(STYLESHEET)" rel="stylesheet">">
29 29
    <ifeq "$(STYLESHEET)" "" "<link href="$(DOCROOT)/css/master.css" rel="stylesheet">">
30 30
 
... ...
@@ -39,7 +39,7 @@
39 39
    <link href="$(DOCROOT)/css/ie6.css" rel="stylesheet">
40 40
    <![endif]-->
41 41
  #  <script language="javascript" type="text/javascript" src="$(DOCROOT)/global.js"></script>
42
-   # end WML to generate css/js paths 
42
+   # end WML to generate css/js paths
43 43
 </head>
44 44
 <body>
45 45
 <div id="wrap">
... ...
@@ -63,23 +63,25 @@
63 63
             my $lang = "$(LANG)";
64 64
 
65 65
             for my $key (@keys) {
66
-              my ($dir, $base) = $key =~ m,^(?:(.*)/)?(.*?)$,;  
66
+              my ($dir, $base) = $key =~ m,^(?:(.*)/)?(.*?)$,;
67 67
 
68
-              # in directory of active link, set class active 
68
+              # in directory of active link, set class active. This rule should be improved with proper structuring of the links.
69 69
               my $class;
70
-              if ((defined $dir) and ($WML_SRC_DIRNAME =~/$dir/) or ($WML_SRC_BASENAME eq $base)) {
71
-                $class = 'class="active"';
70
+              if ((index($page, 'contact') ne -1) and (index($base, 'overview') ne -1)) {
71
+                $class = '';
72
+              } elsif ((defined $dir) and ($WML_SRC_DIRNAME =~/$dir/) and (index($key, 'contact') eq -1) or ($WML_SRC_BASENAME eq $base)) {
73
+                $class = 'class="active '.$base.' '.$page.'"';
72 74
               } else {
73 75
                 $class = '';
74 76
               }
75 77
 
76 78
 	            $dir = '.' unless defined $dir;
77
-                
79
+
78 80
               # translated version
79 81
               if (-e "$(DOCROOT)/$dir/$lang/$base.wml") {
80 82
                   printf '<li><a '.$class.' href="%s">%s</a></li>'."\n",
81 83
                          stripDotSlashs("$(DOCROOT)/$dir/$base.html.$(LANG)"),$navigation{$key};
82
-              } 
84
+              }
83 85
               # english version
84 86
               elsif (-e "$(DOCROOT)/$dir/en/$base.wml") {
85 87
               	printf '<li><a '.$class.' href="%s">%s</a></li>'."\n",
... ...
@@ -108,14 +110,14 @@ docdir: $(DOCROOT)/; dir: $dir; base: $base -> $(DOCROOT)/$dir/$lang/$base.wml),
108 110
               my $val = shift @calltoaction;
109 111
               push @keys, $key;
110 112
               $calltoaction{$key} = $val;
111
-            } 
113
+            }
112 114
 
113 115
             my $page = $WML_SRC_BASENAME;
114 116
             my $lang = "$(LANG)";
115 117
             for my $key (@keys) {
116
-              my ($dir, $base) = $key =~ m,^(?:(.*)/)?(.*?)$,;  
118
+              my ($dir, $base) = $key =~ m,^(?:(.*)/)?(.*?)$,;
117 119
 
118
-              # in directory, set active 
120
+              # in directory, set active
119 121
               my $class;
120 122
               if ((defined $dir) and ($WML_SRC_DIRNAME =~/$dir/) or ($WML_SRC_BASENAME eq $base)) {
121 123
               #if ($WML_SRC_BASENAME eq $base) {
... ...
@@ -129,7 +131,7 @@ docdir: $(DOCROOT)/; dir: $dir; base: $base -> $(DOCROOT)/$dir/$lang/$base.wml),
129 131
               if (-e "$(DOCROOT)/$dir/$lang/$base.wml") {
130 132
                   printf '<li class="donate"><a '.$class.' href="%s">%s</a></li>'."\n",
131 133
                          stripDotSlashs("$(DOCROOT)/$dir/$base.html.$(LANG)"),$calltoaction{$key};
132
-              } 
134
+              }
133 135
               # default to english version
134 136
               elsif (-e "$(DOCROOT)/$dir/en/$base.wml") {
135 137
               	printf '<li class="donate"><a '.$class.' href="%s">%s</a></li>'."\n",
... ...
@@ -137,7 +139,7 @@ docdir: $(DOCROOT)/; dir: $dir; base: $base -> $(DOCROOT)/$dir/$lang/$base.wml),
137 139
               } else {
138 140
                 warn "$WML_SRC_FILENAME has a [page $key] (parses to docdir: $(DOCROOT)/; dir: $dir; base: $base -> $(DOCROOT)/$dir/$lang/$base.wml), but that doesn't exist.";
139 141
               }
140
-            }    
142
+            }
141 143
           }:>
142 144
         </ul>
143 145
       </div>