Add Preview to templates-sdk develop nav and global nav in templates-sdk-dev. Remove dependence on -includePreview.

Change-Id: I1456c3c94522f58c7d1c899ff96dd95cdc6ada7c
This commit is contained in:
Dirk Dougherty 2016-02-09 18:00:05 -08:00
parent f534e7bffa
commit 8612002d89
8 changed files with 65 additions and 2 deletions

View file

@ -4447,6 +4447,8 @@ $.fn.scrollIntoView = function(target) {
} else {
selected = parentNavEl.removeClass('has-subnav').addClass('selected');
}
} else if (body.hasClass('preview')) {
selected = navEl.find('> li.preview > a').addClass('selected');
}
return $(selected);
};

View file

@ -261,6 +261,9 @@
</li>
</ul>
</li>
<li class="dac-nav-item preview">
<a class="dac-nav-link" href="<?cs var:toroot ?>preview/index.html">Preview</a>
</li>
</ul>
</div>
</div>

View file

@ -196,6 +196,8 @@ elif:samples ?><?cs include:"../../../../frameworks/base/docs/html/ndk/samples/s
<?cs include:"../../../../frameworks/base/docs/html/google/google_toc.cs" ?>
<?cs elif:samples ?>
<?cs include:"../../../../frameworks/base/docs/html/samples/samples_toc.cs" ?>
<?cs elif:preview ?>
<?cs include:"../../../../frameworks/base/docs/html/preview/preview_toc.cs" ?>
<?cs elif:distribute ?>
<?cs if:googleplay ?>
<?cs include:"../../../../frameworks/base/docs/html/distribute/googleplay/googleplay_toc.cs" ?>

View file

@ -36,6 +36,7 @@
if:wear ?> wear<?cs /if ?><?cs
if:tv ?> tv<?cs /if ?><?cs
if:auto ?> auto<?cs /if ?><?cs
elif:(preview) ?> preview<?cs
/if ?><?cs
if:page.trainingcourse ?> trainingcourse<?cs /if ?><?cs
/if ?>" itemscope itemtype="http://schema.org/Article"><?cs

View file

@ -202,6 +202,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");
}
@ -2359,6 +2361,37 @@ function search_changed(e, kd, toroot)
}
}
// Search for Preview Guides
for (var i=0; i<_RESOURCES.length; i++) {
// current search comparison, with counters for tag and title,
// used later to improve ranking
var s = _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().indexOf(queryStr) == 0) {
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().indexOf(queryStr) == 0) {
matched = true;
s.matched_title = 1;
}
}
if (matched) {
gDocsMatches[matchedCountDocs] = s;
matchedCountDocs++;
}
}
// Rank/sort all the matched pages
rank_autocomplete_doc_results(text, gDocsMatches);
}

View file

@ -228,8 +228,10 @@
<?cs if:android.hasSamples ?>
<li class="dac-nav-item samples">
<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">Preview</a>
</li>
<?cs /if ?>
</ul>
</li>
<li class="dac-nav-item distribute">

View file

@ -79,6 +79,23 @@ def:googleplay_nav() ?>
</script>
<?cs /def ?><?cs
def:preview_nav() ?>
<div class="wrap clearfix" id="body-content"><div class="cols">
<div class="col-4 dac-toggle dac-mobile" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
<?cs call:mobile_nav_toggle() ?>
<div class="dac-toggle-content" id="devdoc-nav">
<div class="scroll-pane">
<?cs include:"../../../../frameworks/base/docs/html/preview/preview_toc.cs" ?>
</div>
</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 dac-toggle dac-mobile" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
@ -533,6 +550,8 @@ def:custom_left_nav() ?><?cs
call:google_nav() ?><?cs
elif:samples ?><?cs
call:samples_nav() ?><?cs
elif:preview ?><?cs
call:preview_nav() ?><?cs
elif:distribute ?><?cs
if:googleplay ?><?cs
call:googleplay_nav() ?><?cs

View file

@ -13,9 +13,10 @@
if:reference ?> reference<?cs /if ?><?cs
if:downloads ?> downloads<?cs /if ?><?cs
else ?><?cs
if:(guide||develop||training||reference||tools||sdk||google||samples) ?>develop<?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||analyze) ?>distribute<?cs
if:googleplay ?> googleplay<?cs /if ?><?cs
if:essentials ?> essentials<?cs /if ?><?cs