diff options
author | Joe Fernandez <joefernandez@google.com> | 2015-05-05 22:07:42 -0700 |
---|---|---|
committer | Joe Fernandez <joefernandez@google.com> | 2015-05-06 22:24:31 -0700 |
commit | a9d796a4f9e198f17de6f1a27264b1b4fc9a778a (patch) | |
tree | ec7a2cd01a2b0dd4ea3197afe07818b886eba1aa /tools/droiddoc | |
parent | 29e934367b927fb13417bee77008600ad5a39dcc (diff) | |
download | build-a9d796a4f9e198f17de6f1a27264b1b4fc9a778a.zip build-a9d796a4f9e198f17de6f1a27264b1b4fc9a778a.tar.gz build-a9d796a4f9e198f17de6f1a27264b1b4fc9a778a.tar.bz2 |
docs: Add navigation heading for Develop > Preview
Change-Id: I133672c6ecb5e778f49c31d091812ed7b6dc6b24
Diffstat (limited to 'tools/droiddoc')
-rw-r--r-- | tools/droiddoc/templates-sdk/assets/js/docs.js | 37 | ||||
-rw-r--r-- | tools/droiddoc/templates-sdk/components/masthead.cs | 46 | ||||
-rw-r--r-- | tools/droiddoc/templates-sdk/customizations.cs | 128 | ||||
-rw-r--r-- | tools/droiddoc/templates-sdk/docpage.cs | 36 |
4 files changed, 123 insertions, 124 deletions
diff --git a/tools/droiddoc/templates-sdk/assets/js/docs.js b/tools/droiddoc/templates-sdk/assets/js/docs.js index ca64217..8baf3f4 100644 --- a/tools/droiddoc/templates-sdk/assets/js/docs.js +++ b/tools/droiddoc/templates-sdk/assets/js/docs.js @@ -192,6 +192,8 @@ $(document).ready(function() { subNavEl.find("li.google > a").addClass("selected"); } else if ($("body").hasClass("samples")) { subNavEl.find("li.samples > a").addClass("selected"); + } else if ($("body").hasClass("preview")) { + subNavEl.find("li.preview > a").addClass("selected"); } else { parentNavEl.removeClass('has-subnav').addClass("selected"); } @@ -2357,6 +2359,37 @@ function search_changed(e, kd, toroot) } } + // Search for Preview Guides + for (var i=0; i<PREVIEW_RESOURCES.length; i++) { + // current search comparison, with counters for tag and title, + // used later to improve ranking + var s = PREVIEW_RESOURCES[i]; + s.matched_tag = 0; + s.matched_title = 0; + var matched = false; + + // Check if query matches any tags; work backwards toward 1 to assist ranking + for (var j = s.keywords.length - 1; j >= 0; j--) { + // it matches a tag + if (s.keywords[j].toLowerCase().match(textRegex)) { + matched = true; + s.matched_tag = j + 1; // add 1 to index position + } + } + // Check if query matches the doc title, but only for current language + if (s.lang == currentLang) { + // if query matches the doc title + if (s.title.toLowerCase().match(textRegex)) { + matched = true; + s.matched_title = 1; + } + } + if (matched) { + gDocsMatches[matchedCountDocs] = s; + matchedCountDocs++; + } + } + // Rank/sort all the matched pages rank_autocomplete_doc_results(text, gDocsMatches); } @@ -3707,7 +3740,7 @@ function showSamples() { return $el; } - + function createResponsiveFlowColumn(cardSize) { var cardWidth = parseInt(cardSize.match(/(\d+)/)[1], 10); var column = $('<div>').addClass('col-' + (cardWidth / 3) + 'of6'); @@ -3732,7 +3765,7 @@ function showSamples() { while (i < resources.length) { var cardSize = cardSizes[j++ % cardSizes.length]; cardSize = cardSize.replace(/^\s+|\s+$/,''); - + var column = createResponsiveFlowColumn(cardSize).appendTo($widget); // A stack has a third dimension which is the number of stacked items diff --git a/tools/droiddoc/templates-sdk/components/masthead.cs b/tools/droiddoc/templates-sdk/components/masthead.cs index a027749..9e6a645 100644 --- a/tools/droiddoc/templates-sdk/components/masthead.cs +++ b/tools/droiddoc/templates-sdk/components/masthead.cs @@ -1,10 +1,7 @@ <?cs def:custom_masthead() ?> -<?cs if:preview ?> - <?cs call:preview_masthead() ?> -<?cs else ?> <a name="top"></a> -<!-- dialog to prompt lang pref change when loaded from hardcoded URL +<!-- dialog to prompt lang pref change when loaded from hardcoded URL <div id="langMessage" style="display:none"> <div> <div class="lang en"> @@ -180,6 +177,9 @@ <a class="dac-nav-link" href="<?cs var:toroot ?>samples/index.html">Samples</a> </li> <?cs /if ?> + <li class="dac-nav-item preview"> + <a class="dac-nav-link" href="<?cs var:toroot ?>preview/index.html">M Preview</a> + </li> </ul> </li> <li class="dac-nav-item distribute"> @@ -217,41 +217,9 @@ </nav> <!-- end navigation--> <?cs /if ?><?cs # end if/else !devsite ?> -<?cs /if ?><?cs # end if/else preview ?><?cs -/def ?> - -<?cs def:preview_masthead() ?> -<a name="top"></a> - - -<!-- Header --> -<div id="header-wrapper"> - <div id="header"><?cs call:butter_bar() ?> - <div class="wrap" id="header-wrap"> - <div class="col_3 logo landing-logo" style="width:240px"> - <a href="<?cs var:toroot ?>preview/index.html"> - <img src="<?cs var:toroot ?>assets/images/android.png" height="25" alt="Android" - style="margin:-3px 0 0" /> - </a> - </div> - <div class="col-8" style="margin:0"><h1 style="margin: 4px 0 0 0px;padding:0;line-height:16px; -color:#666;font-weight:100;font-size:27px;">L Developer Preview</h1></div> - - <?cs # ADD SEARCH AND MENU ?> - <?cs call:header_search_widget() ?> - - </div><!-- end header-wrap --> - </div><!-- /Header --> - - - <div id="searchResults" class="wrap" style="display:none;"> - <h2 id="searchTitle">Results</h2> - <div id="leftSearchControl" class="search-control">Loading...</div> - </div> -</div> <!--end header-wrapper --> - <?cs -/def ?> +<?cs +/def ?><?cs # end custom_masthead() ?> <?cs # (UN)COMMENT THE INSIDE OF THIS METHOD TO TOGGLE VISIBILITY ?> @@ -268,6 +236,6 @@ color:#666;font-weight:100;font-size:27px;">L Developer Preview</h1></div> </div> </div> -?> +?> <?cs /def ?> diff --git a/tools/droiddoc/templates-sdk/customizations.cs b/tools/droiddoc/templates-sdk/customizations.cs index 15dc3af..7c92adb 100644 --- a/tools/droiddoc/templates-sdk/customizations.cs +++ b/tools/droiddoc/templates-sdk/customizations.cs @@ -1,15 +1,15 @@ -<?cs +<?cs def:fullpage() ?> <div id="body-content"> <div> <?cs /def ?> -<?cs +<?cs def:sdk_nav() ?> <div class="wrap clearfix" id="body-content"><div class="cols"> <div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement"> <div id="devdoc-nav" class="scroll-pane"> -<?cs +<?cs include:"../../../../frameworks/base/docs/html/sdk/sdk_toc.cs" ?> @@ -26,10 +26,10 @@ def:tools_nav() ?> <div class="wrap clearfix" id="body-content"><div class="cols"> <div class="col-3" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement"> <div id="devdoc-nav" class="scroll-pane"> -<?cs +<?cs include:"../../../../frameworks/base/docs/html/tools/tools_toc.cs" ?> - - + + </div> </div> <!-- end side-nav --> <script> @@ -45,9 +45,9 @@ def:training_nav() ?> <div id="devdoc-nav" class="scroll-pane"> -<?cs +<?cs include:"../../../../frameworks/base/docs/html/training/training_toc.cs" ?> - + </div> </div> <!-- end side-nav --> @@ -72,6 +72,20 @@ def:googleplay_nav() ?> </script> <?cs /def ?><?cs +def:preview_nav() ?> + <div class="wrap clearfix" id="body-content"> + <div class="col-3" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement"> + <div id="devdoc-nav" class="scroll-pane"> +<?cs include:"../../../../frameworks/base/docs/html/preview/preview_toc.cs" ?> + </div> + </div> <!-- end side-nav --> + <script> + $(document).ready(function() { + scrollIntoView("devdoc-nav"); + }); + </script> +<?cs /def ?><?cs + def:essentials_nav() ?> <div class="wrap clearfix" id="body-content"><div class="cols"> <div class="col-3" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement"> @@ -175,9 +189,9 @@ def:guide_nav() ?> <div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement"> <div id="devdoc-nav" class="scroll-pane"> -<?cs +<?cs include:"../../../../frameworks/base/docs/html/guide/guide_toc.cs" ?> - + </div> </div> <!-- end side-nav --> @@ -196,7 +210,7 @@ def:design_nav() ?> <?cs include:"../../../../frameworks/base/docs/html/design/design_toc.cs" ?> - + </div> </div> <!-- end side-nav --> @@ -214,7 +228,7 @@ def:distribute_nav() ?> <?cs include:"../../../../frameworks/base/docs/html/distribute/distribute_toc.cs" ?> - + </div> </div> <!-- end side-nav --> @@ -252,12 +266,12 @@ def:google_nav() ?> <?cs include:"../../../../frameworks/base/docs/html/google/google_toc.cs" ?> - + </div> <script type="text/javascript"> showGoogleRefTree(); - + </script> </div> <!-- end side-nav --> <script> @@ -275,7 +289,7 @@ def:about_nav() ?> <?cs include:"../../../../frameworks/base/docs/html/about/about_toc.cs" ?> - + </div> </div> <!-- end side-nav --> @@ -306,23 +320,7 @@ def:wear_nav() ?> </script> <?cs /def ?> -<?cs -def:preview_nav() ?> - <div class="wrap clearfix" id="body-content"><div class="cols"> - <div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement"> - <div id="devdoc-nav" class="scroll-pane"> - <?cs - include:"../../../../frameworks/base/docs/html/preview/preview_toc.cs" ?> - </div> - </div> <!-- end side-nav --> - <script> - $(document).ready(function() { - scrollIntoView("devdoc-nav"); - }); - </script> -<?cs /def ?> - -<?cs # The default side navigation for the reference docs ?><?cs +<?cs # The default side navigation for the reference docs ?><?cs def:default_left_nav() ?> <?cs if:reference.gcm || reference.gms ?> <?cs call:google_nav() ?> @@ -343,15 +341,15 @@ def:default_left_nav() ?> <div id="api-nav-title">Android APIs</div> </div><!-- end nav header --> <script> - var SINCE_DATA = [ <?cs - each:since = since ?>'<?cs - var:since.name ?>'<?cs + var SINCE_DATA = [ <?cs + each:since = since ?>'<?cs + var:since.name ?>'<?cs if:!last(since) ?>, <?cs /if ?><?cs - /each + /each ?> ]; buildApiLevelSelector(); </script> - + <div id="swapper"> <div id="nav-panels"> <div id="resize-packages-nav"> @@ -366,7 +364,7 @@ def:default_left_nav() ?> <div id="classes-nav" class="scroll-pane"> -<?cs +<?cs if:subcount(class.package) ?> <ul> <?cs call:list("Annotations", class.package.annotations) ?> @@ -375,7 +373,7 @@ def:default_left_nav() ?> <?cs call:list("Enums", class.package.enums) ?> <?cs call:list("Exceptions", class.package.exceptions) ?> <?cs call:list("Errors", class.package.errors) ?> - </ul><?cs + </ul><?cs elif:subcount(package) ?> <ul> <?cs call:class_link_list("Annotations", package.annotations) ?> @@ -384,11 +382,11 @@ def:default_left_nav() ?> <?cs call:class_link_list("Enums", package.enums) ?> <?cs call:class_link_list("Exceptions", package.exceptions) ?> <?cs call:class_link_list("Errors", package.errors) ?> - </ul><?cs + </ul><?cs else ?> - <p style="padding:10px">Select a package to view its members</p><?cs + <p style="padding:10px">Select a package to view its members</p><?cs /if ?><br/> - + </div><!-- end classes --> </div><!-- end nav-panels --> @@ -429,7 +427,7 @@ def:default_left_nav() ?> }); </script> <?cs /if ?> - <?cs + <?cs /def ?> @@ -477,25 +475,27 @@ def:header_search_widget() ?> -<?cs +<?cs def:custom_left_nav() ?><?cs if:fullpage ?><?cs call:fullpage() ?><?cs elif:nonavpage ?><?cs call:no_nav() ?><?cs - elif:guide ?><?cs - call:guide_nav() ?><?cs + elif:guide ?><?cs + call:guide_nav() ?><?cs elif:design ?><?cs - call:design_nav() ?><?cs - elif:training ?><?cs - call:training_nav() ?><?cs - elif:tools ?><?cs + call:design_nav() ?><?cs + elif:training ?><?cs + call:training_nav() ?><?cs + elif:tools ?><?cs call:tools_nav() ?><?cs - elif:google ?><?cs - call:google_nav() ?><?cs + elif:google ?><?cs + call:google_nav() ?><?cs elif:samples ?><?cs call:samples_nav() ?><?cs - elif:distribute ?><?cs + elif:preview ?><?cs + call:preview_nav() ?><?cs + elif:distribute ?><?cs if:googleplay ?><?cs call:googleplay_nav() ?><?cs elif:essentials ?><?cs @@ -519,31 +519,29 @@ def:custom_left_nav() ?><?cs call:distribute_nav() ?><?cs elif:wear ?><?cs call:wear_nav() ?><?cs - elif:preview ?><?cs - call:preview_nav() ?><?cs else ?><?cs call:default_left_nav() ?> <?cs /if ?><?cs /def ?> -<?cs # appears at the bottom of every page ?><?cs +<?cs # appears at the bottom of every page ?><?cs def:custom_cc_copyright() ?> - Except as noted, this content is + Except as noted, this content is licensed under <a href="http://creativecommons.org/licenses/by/2.5/"> - Creative Commons Attribution 2.5</a>. For details and - restrictions, see the <a href="<?cs var:toroot ?>license.html">Content - License</a>.<?cs + Creative Commons Attribution 2.5</a>. For details and + restrictions, see the <a href="<?cs var:toroot ?>license.html">Content + License</a>.<?cs /def ?> -<?cs +<?cs def:custom_copyright() ?> Except as noted, this content is licensed under <a - href="http://www.apache.org/licenses/LICENSE-2.0">Apache 2.0</a>. + href="http://www.apache.org/licenses/LICENSE-2.0">Apache 2.0</a>. For details and restrictions, see the <a href="<?cs var:toroot ?>license.html"> - Content License</a>.<?cs + Content License</a>.<?cs /def ?> -<?cs +<?cs def:custom_footerlinks() ?> <a href="<?cs var:toroot ?>about/index.html">About Android</a> <a href="<?cs var:toroot ?>auto/index.html">Auto</a> @@ -553,7 +551,7 @@ def:custom_footerlinks() ?> <?cs /def ?> -<?cs # appears on the right side of the blue bar at the bottom off every page ?><?cs +<?cs # appears on the right side of the blue bar at the bottom off every page ?><?cs def:custom_buildinfo() ?><?cs if:!google && !reference.gcm && !reference.gms ?> Android <?cs var:sdk.version ?> r<?cs var:sdk.rel.id ?> — <?cs diff --git a/tools/droiddoc/templates-sdk/docpage.cs b/tools/droiddoc/templates-sdk/docpage.cs index fe8836b..c0b0174 100644 --- a/tools/droiddoc/templates-sdk/docpage.cs +++ b/tools/droiddoc/templates-sdk/docpage.cs @@ -4,22 +4,25 @@ <?cs include:"head_tag.cs" ?> <body class="gc-documentation +<?cs # add document classes for navigation header selection (and other stuff) ?> <?cs -if:(google || reference.gms || reference.gcm) ?>google<?cs /if ?><?cs - if:(guide||develop||training||reference||tools||google||sdk||samples) ?>develop<?cs - if:guide ?> guide<?cs /if ?><?cs - if:samples ?> samples<?cs /if ?><?cs - elif:(distribute||googleplay||essentials||users||engage||monetize||disttools||stories) - ?>distribute<?cs - if:googleplay ?> googleplay<?cs /if ?><?cs - if:essentials ?> essentials<?cs /if ?><?cs - if:users ?> users<?cs /if ?><?cs - if:engage ?> engage<?cs /if ?><?cs - if:monetize ?> monetize<?cs /if ?><?cs - if:disttools ?> disttools<?cs /if ?><?cs - if:stories ?> stories<?cs /if ?><?cs - elif:(about||wear||tv||auto) ?>about<?cs - elif:design ?>design<?cs +if:(google || reference.gms || reference.gcm) ?>google<?cs +/if ?><?cs +if:(guide||develop||training||reference||tools||sdk||google||samples||preview) ?>develop<?cs + if:guide ?> guide<?cs /if ?><?cs + if:samples ?> samples<?cs /if ?><?cs + if:preview ?> preview<?cs /if ?><?cs +elif:(distribute||googleplay||essentials||users||engage||monetize||disttools||stories) + ?>distribute<?cs + if:googleplay ?> googleplay<?cs /if ?><?cs + if:essentials ?> essentials<?cs /if ?><?cs + if:users ?> users<?cs /if ?><?cs + if:engage ?> engage<?cs /if ?><?cs + if:monetize ?> monetize<?cs /if ?><?cs + if:disttools ?> disttools<?cs /if ?><?cs + if:stories ?> stories<?cs /if ?><?cs +elif:(about||wear||tv||auto) ?>about<?cs +elif:design ?>design<?cs /if ?><?cs if:page.trainingcourse ?> trainingcourse<?cs /if ?>" itemscope itemtype="http://schema.org/Article"><?cs @@ -193,6 +196,3 @@ include:"header.cs" ?> </body> </html> - - - |