docs: update templates to remove global content for devsite builds
Change-Id: I8c8d052248cebe6408d8c18b44baadd03f3bc96c
diff --git a/tools/droiddoc/templates-sdk/assets/js/docs.js b/tools/droiddoc/templates-sdk/assets/js/docs.js
index eec97b2..3d34352 100644
--- a/tools/droiddoc/templates-sdk/assets/js/docs.js
+++ b/tools/droiddoc/templates-sdk/assets/js/docs.js
@@ -142,6 +142,9 @@
}
}
+ // Need a copy of the pagePath before it gets changed in the next block;
+ // it's needed to perform proper tab highlighting in offline docs (see rootDir below)
+ var pagePathOriginal = pagePath;
if (SITE_ROOT.match(/\.\.\//) || SITE_ROOT == '') {
// If running locally, SITE_ROOT will be a relative path, so account for that by
// finding the relative URL to this page. This will allow us to find links on the page
@@ -169,9 +172,8 @@
// highlight Develop tab
} else if ($("body").hasClass("develop") || $("body").hasClass("google")) {
$("#header li.develop a").addClass("selected");
-
// In Develop docs, also highlight appropriate sub-tab
- var rootDir = pagePath.substring(1,pagePath.indexOf('/', 1));
+ var rootDir = pagePathOriginal.substring(1,pagePathOriginal.indexOf('/', 1));
if (rootDir == "training") {
$("#nav-x li.training a").addClass("selected");
} else if (rootDir == "guide") {
diff --git a/tools/droiddoc/templates-sdk/components/masthead.cs b/tools/droiddoc/templates-sdk/components/masthead.cs
index 9f19906..ba1d382 100644
--- a/tools/droiddoc/templates-sdk/components/masthead.cs
+++ b/tools/droiddoc/templates-sdk/components/masthead.cs
@@ -1,4 +1,6 @@
<?cs def:custom_masthead() ?>
+<a name="top"></a>
+<?cs if:!devsite ?><?cs # leave out the global header for devsite; it's in devsite template ?>
<!-- Header -->
<div id="header">
<div class="wrap" id="header-wrap">
@@ -60,11 +62,8 @@
<li><a href="http://source.android.com">Android Open Source Project</a></li>
</ul>
-<?cs ############ TODO: Remove when we're happy with Devsite ############# ?>
- <?cs # Use differenc lang switcher for devsite and gae server ?>
- <?cs if:devsite ?>
- <div class="header">Language</div>
- <?cs elif:android.whichdoc == "online" ?>
+ <?cs # Include language switcher only in online docs ?>
+ <?cs if:android.whichdoc == "online" ?>
<div class="header">Language</div>
<div id="language" class="locales">
<select name="language" onChange="changeLangPref(this.value, true)">
@@ -83,7 +82,7 @@
//-->
</script>
<?cs /if ?>
- <?cs # End of devsite vs. gae version of lang switcher ?>
+ <?cs # End of lang switcher ?>
<br class="clearfix" />
@@ -194,8 +193,7 @@
</div>
-
-<?cs if:training || guide || reference || tools || develop || google ?>
+ <?cs if:training || guide || reference || tools || develop || google ?>
<!-- Secondary x-nav -->
<div id="nav-x">
<div class="wrap">
@@ -240,6 +238,10 @@
</div>
<!-- /Sendondary x-nav -->
+ <?cs /if ?>
+
<?cs /if ?>
+<?cs # end if/else !devsite ?>
+
<?cs
/def ?>
diff --git a/tools/droiddoc/templates-sdk/docpage.cs b/tools/droiddoc/templates-sdk/docpage.cs
index 3e5c24f..b6d808d 100644
--- a/tools/droiddoc/templates-sdk/docpage.cs
+++ b/tools/droiddoc/templates-sdk/docpage.cs
@@ -9,7 +9,6 @@
elif:distribute ?>distribute<?cs
/if ?><?cs
if:page.trainingcourse ?> trainingcourse<?cs /if ?>" itemscope itemtype="http://schema.org/Article">
-<a name="top"></a>
<?cs include:"header.cs" ?>
<div <?cs if:fullpage
diff --git a/tools/droiddoc/templates-sdk/head_tag.cs b/tools/droiddoc/templates-sdk/head_tag.cs
index d84a3be..6774ca6 100644
--- a/tools/droiddoc/templates-sdk/head_tag.cs
+++ b/tools/droiddoc/templates-sdk/head_tag.cs
@@ -1,4 +1,18 @@
<head>
+<?cs ####### If building devsite, add some meta data needed for when generating the top nav ######### ?>
+<?cs
+ if:devsite ?><?cs
+ if:guide||develop||training||reference||tools||sdk||google
+ ?><meta name="top_category" value="develop" /><?cs
+ elif:google
+ ?><meta name="top_category" value="google" /><?cs
+ elif:reference && !(reference.gms || reference.gcm)
+ ?><meta name="top_category" value="css-fullscreen" /><?cs
+ /if ?>
+ <?cs
+ /if
+?><?cs # END if/else devsite ?>
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?cs if:page.metaDescription ?>
<meta name="Description" content="<?cs var:page.metaDescription ?>">
@@ -30,11 +44,7 @@
/if ?>
<script type="text/javascript">
var toRoot = "<?cs var:toroot ?>";
- <?cs if:devsite ?>
- var devsite = true;
- <?cs else ?>
- var devsite = false;
- <?cs /if ?>
+ var devsite = <?cs if:devsite ?>true<?cs else ?>false<?cs /if ?>;
</script>
<script src="<?cs var:toroot ?>assets/js/docs.js" type="text/javascript"></script>
<?cs if:reference.gms || reference.gcm || google?>