am 83cd28b3
: am 9efb6b09
: am be264b6d
: am 5a1123ef
: add script to generate list of classes for each training course landing page
* commit '83cd28b354e222e5ca78b17229fa456e40d8c900': add script to generate list of classes for each training course landing page
This commit is contained in:
commit
2dc85a0fe0
3 changed files with 170 additions and 64 deletions
|
@ -448,21 +448,23 @@ video.with-shadow {
|
|||
border:1px solid #DADADA;
|
||||
border-bottom:0;
|
||||
}
|
||||
|
||||
|
||||
.training-nav-top a.next-page-link {
|
||||
border-left:0;
|
||||
width:123px;
|
||||
}
|
||||
|
||||
.paging-links a.disabled,
|
||||
.training-nav-top a.disabled,
|
||||
.content-footer a.disabled {
|
||||
color:#999;
|
||||
color:#bbb;
|
||||
}
|
||||
|
||||
.paging-links a.disabled:hover,
|
||||
.training-nav-top a.disabled:hover,
|
||||
.content-footer a.disabled:hover {
|
||||
cursor:default;
|
||||
color:#999 !important;
|
||||
color:#bbb !important;
|
||||
}
|
||||
|
||||
.training-nav-top a.start-class-link,
|
||||
|
@ -470,6 +472,78 @@ video.with-shadow {
|
|||
width:262px;
|
||||
}
|
||||
|
||||
/* list of classes on course landing page */
|
||||
ol.class-list {
|
||||
list-style:none;
|
||||
margin-left:0;
|
||||
}
|
||||
ol.class-list>li {
|
||||
margin:0 0 15px;
|
||||
padding:5px 0 0;
|
||||
overflow:hidden;
|
||||
border-top:1px solid #ccc;
|
||||
}
|
||||
ol.class-list li a.title {
|
||||
font-size:16px;
|
||||
margin:0;
|
||||
clear:left;
|
||||
display:block;
|
||||
height:32px;
|
||||
padding:0 4px;
|
||||
}
|
||||
ol.class-list li a.title h2 {
|
||||
color:inherit;
|
||||
margin:0 0 10px;
|
||||
display:block;
|
||||
float:left;
|
||||
width:675px;
|
||||
}
|
||||
ol.class-list li a.title span {
|
||||
display:none;
|
||||
float:left;
|
||||
font-size:18px;
|
||||
font-weight:bold;
|
||||
background: transparent url(../images/styles/disclosure_right.png) no-repeat scroll 50% 50%;
|
||||
width: 10px;
|
||||
height: 32px;
|
||||
}
|
||||
ol.class-list li a.title:hover {
|
||||
background:#ddd;
|
||||
color:#258AAF !important;
|
||||
}
|
||||
ol.class-list li a.title:hover span {
|
||||
display:block;
|
||||
}
|
||||
|
||||
#jd-content
|
||||
ol.class-list li img {
|
||||
float:left;
|
||||
clear:left;
|
||||
width:64px;
|
||||
margin:0 20px 0 0;
|
||||
}
|
||||
ol.class-list li p.description {
|
||||
float:left;
|
||||
display:block;
|
||||
width:250px;
|
||||
margin:0;
|
||||
}
|
||||
ol.class-list li p.description.article {
|
||||
width: 550px;
|
||||
}
|
||||
ol.class-list ol {
|
||||
float:left;
|
||||
width:320px;
|
||||
margin:0 0 0 30px;
|
||||
list-style:none;
|
||||
margin:0 0 0 20px;
|
||||
}
|
||||
ol.class-list div.lessons li {
|
||||
margin:0 0 6px;
|
||||
line-height:16px;
|
||||
}
|
||||
|
||||
|
||||
.hide {
|
||||
display:none !important;
|
||||
}
|
||||
|
|
|
@ -135,6 +135,7 @@ $(document).ready(function() {
|
|||
|
||||
// select current page in sidenav and set up prev/next links if they exist
|
||||
var $selNavLink = $('#nav').find('a[href="' + pagePath + '"]');
|
||||
var $selListItem;
|
||||
if ($selNavLink.length) {
|
||||
$selListItem = $selNavLink.closest('li');
|
||||
|
||||
|
@ -156,11 +157,9 @@ $(document).ready(function() {
|
|||
false; // navigate across topic boundaries only in design docs
|
||||
if ($prevListItem.length) {
|
||||
if ($prevListItem.hasClass('nav-section')) {
|
||||
if (crossBoundaries) {
|
||||
// jump to last topic of previous section
|
||||
$prevLink = $prevListItem.find('a:last');
|
||||
}
|
||||
} else {
|
||||
// jump to last topic of previous section
|
||||
$prevLink = $prevListItem.find('a:last');
|
||||
} else if (!$selListItem.hasClass('nav-section')) {
|
||||
// jump to previous topic in this section
|
||||
$prevLink = $prevListItem.find('a:eq(0)');
|
||||
}
|
||||
|
@ -177,18 +176,8 @@ false; // navigate across topic boundaries only in design docs
|
|||
}
|
||||
}
|
||||
|
||||
if ($prevLink.length) {
|
||||
var prevHref = $prevLink.attr('href');
|
||||
if (prevHref == SITE_ROOT + 'index.html') {
|
||||
// Don't show Previous when it leads to the homepage
|
||||
} else {
|
||||
$('.prev-page-link').attr('href', $prevLink.attr('href')).removeClass("hide");
|
||||
}
|
||||
}
|
||||
|
||||
// set up next links
|
||||
var $nextLink = [];
|
||||
var startCourse = false;
|
||||
var startClass = false;
|
||||
var training = $(".next-class-link").length; // decides whether to provide "next class" link
|
||||
var isCrossingBoundary = false;
|
||||
|
@ -206,53 +195,103 @@ false; // navigate across topic boundaries only in design docs
|
|||
$('.topic-start-link').text($nextLink.text().toUpperCase());
|
||||
}
|
||||
|
||||
// Handle some Training specialties
|
||||
if ($selListItem.parent().is("#nav") && $(".start-course-link").length) {
|
||||
// this means we're at the very top of the TOC hierarchy
|
||||
startCourse = true;
|
||||
} else if ($(".start-class-link").length) {
|
||||
// this means this page has children but is not at the top (it's a class, not a course)
|
||||
// If the selected page has a description, then it's a class or article homepage
|
||||
if ($selListItem.find('a[description]').length) {
|
||||
// this means we're on a class landing page
|
||||
startClass = true;
|
||||
}
|
||||
} else {
|
||||
// jump to the next topic in this section (if it exists)
|
||||
$nextLink = $selListItem.next('li').find('a:eq(0)');
|
||||
if (!$nextLink.length) {
|
||||
if (crossBoundaries || training) {
|
||||
// no more topics in this section, jump to the first topic in the next section
|
||||
$nextLink = $selListItem.parents('li:eq(0)').next('li.nav-section').find('a:eq(0)');
|
||||
isCrossingBoundary = true;
|
||||
isCrossingBoundary = true;
|
||||
// no more topics in this section, jump to the first topic in the next section
|
||||
$nextLink = $selListItem.parents('li:eq(0)').next('li.nav-section').find('a:eq(0)');
|
||||
if (!$nextLink.length) { // Go up another layer to look for next page (lesson > class > course)
|
||||
$nextLink = $selListItem.parents('li:eq(1)').next('li.nav-section').find('a:eq(0)');
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($nextLink.length) {
|
||||
if (startCourse || startClass) {
|
||||
if (startCourse) {
|
||||
$('.start-course-link').attr('href', $nextLink.attr('href')).removeClass("hide");
|
||||
} else {
|
||||
$('.start-class-link').attr('href', $nextLink.attr('href')).removeClass("hide");
|
||||
}
|
||||
// if there's no training bar (below the start button),
|
||||
// then we need to add a bottom border to button
|
||||
if (!$("#tb").length) {
|
||||
$('.start-course-link').css({'border-bottom':'1px solid #DADADA'});
|
||||
$('.start-class-link').css({'border-bottom':'1px solid #DADADA'});
|
||||
}
|
||||
} else if (training && isCrossingBoundary) {
|
||||
$('.content-footer.next-class').show();
|
||||
$('.next-page-link').attr('href','')
|
||||
.removeClass("hide").addClass("disabled")
|
||||
.click(function() { return false; });
|
||||
|
||||
$('.next-class-link').attr('href',$nextLink.attr('href'))
|
||||
.removeClass("hide").append($nextLink.html());
|
||||
$('.next-class-link').find('.new').empty();
|
||||
} else {
|
||||
$('.next-page-link').attr('href', $nextLink.attr('href')).removeClass("hide");
|
||||
|
||||
if (startClass) {
|
||||
$('.start-class-link').attr('href', $nextLink.attr('href')).removeClass("hide");
|
||||
|
||||
// if there's no training bar (below the start button),
|
||||
// then we need to add a bottom border to button
|
||||
if (!$("#tb").length) {
|
||||
$('.start-class-link').css({'border-bottom':'1px solid #DADADA'});
|
||||
}
|
||||
} else if (isCrossingBoundary && !$('body.design').length) { // Design always crosses boundaries
|
||||
$('.content-footer.next-class').show();
|
||||
$('.next-page-link').attr('href','')
|
||||
.removeClass("hide").addClass("disabled")
|
||||
.click(function() { return false; });
|
||||
|
||||
$('.next-class-link').attr('href',$nextLink.attr('href'))
|
||||
.removeClass("hide").append($nextLink.html());
|
||||
$('.next-class-link').find('.new').empty();
|
||||
} else {
|
||||
$('.next-page-link').attr('href', $nextLink.attr('href')).removeClass("hide");
|
||||
}
|
||||
|
||||
if (!startClass && $prevLink.length) {
|
||||
var prevHref = $prevLink.attr('href');
|
||||
if (prevHref == SITE_ROOT + 'index.html') {
|
||||
// Don't show Previous when it leads to the homepage
|
||||
} else {
|
||||
$('.prev-page-link').attr('href', $prevLink.attr('href')).removeClass("hide");
|
||||
}
|
||||
}
|
||||
|
||||
// If this is a training 'article', there should be no prev/next nav
|
||||
// ... if the grandparent is the "nav" ... and it has no child list items...
|
||||
if (training && $selListItem.parents('ul').eq(1).is('[id="nav"]') &&
|
||||
!$selListItem.find('li').length) {
|
||||
$('.next-page-link,.prev-page-link').attr('href','').addClass("disabled")
|
||||
.click(function() { return false; });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Set up the course landing pages for Training with class names and descriptions
|
||||
if ($('body.trainingcourse').length) {
|
||||
var $classLinks = $selListItem.find('ul li a').not('#nav .nav-section .nav-section ul a');
|
||||
var $classDescriptions = $classLinks.attr('description');
|
||||
|
||||
var $olClasses = $('<ol class="class-list"></ol>');
|
||||
var $liClass;
|
||||
var $imgIcon;
|
||||
var $h2Title;
|
||||
var $pSummary;
|
||||
var $olLessons;
|
||||
var $liLesson;
|
||||
$classLinks.each(function(index) {
|
||||
$liClass = $('<li></li>');
|
||||
$h2Title = $('<a class="title" href="'+$(this).attr('href')+'"><h2>' + $(this).html()+'</h2><span></span></a>');
|
||||
$pSummary = $('<p class="description">' + $(this).attr('description') + '</p>');
|
||||
|
||||
$olLessons = $('<ol class="lesson-list"></ol>');
|
||||
|
||||
$lessons = $(this).closest('li').find('ul li a');
|
||||
|
||||
if ($lessons.length) {
|
||||
$imgIcon = $('<img src="'+toRoot+'assets/images/resource-tutorial.png" alt=""/>');
|
||||
$lessons.each(function(index) {
|
||||
$olLessons.append('<li><a href="'+$(this).attr('href')+'">' + $(this).html()+'</a></li>');
|
||||
});
|
||||
} else {
|
||||
$imgIcon = $('<img src="'+toRoot+'assets/images/resource-article.png" alt=""/>');
|
||||
$pSummary.addClass('article');
|
||||
}
|
||||
|
||||
$liClass.append($h2Title).append($imgIcon).append($pSummary).append($olLessons);
|
||||
$olClasses.append($liClass);
|
||||
});
|
||||
$('.jd-descr').append($olClasses);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
elif:about ?>about<?cs
|
||||
elif:design ?>design<?cs
|
||||
elif:distribute ?>distribute<?cs
|
||||
/if ?>" itemscope itemtype="http://schema.org/Article">
|
||||
/if ?><?cs
|
||||
if:page.trainingcourse ?> trainingcourse<?cs /if ?>" itemscope itemtype="http://schema.org/Article">
|
||||
<a name="top"></a>
|
||||
<?cs include:"header.cs" ?>
|
||||
|
||||
|
@ -16,7 +17,7 @@
|
|||
?>class="col-13" id="doc-col"<?cs else
|
||||
?>class="col-12" id="doc-col"<?cs /if ?> >
|
||||
|
||||
<?cs if:(design||training||walkthru) ?><?cs # header logic for docs that provide previous/next buttons ?>
|
||||
<?cs if:(design||training||walkthru) && !page.trainingcourse ?><?cs # header logic for docs that provide previous/next buttons ?>
|
||||
<?cs if:header.hide ?>
|
||||
<?cs else ?>
|
||||
<div class="layout-content-row content-header <?cs if:header.justLinks ?>just-links<?cs /if ?>">
|
||||
|
@ -51,16 +52,8 @@
|
|||
ja-lang="開始する"
|
||||
es-lang="Empezar"
|
||||
>Get started</a>
|
||||
<a href="#" class="start-course-link hide"
|
||||
zh-TW-lang="第一堂課"
|
||||
zh-CN-lang="第一课"
|
||||
ru-lang="Первый урок"
|
||||
ko-lang="첫 번째 강의"
|
||||
ja-lang="最初のクラス"
|
||||
es-lang="Primera clase"
|
||||
>First class</a>
|
||||
</div>
|
||||
<?cs else ?>
|
||||
<?cs elif:!page.trainingcourse ?>
|
||||
<div class="paging-links layout-content-col span-4" itemscope itemtype="http://schema.org/SiteNavigationElement">
|
||||
<a href="#" class="prev-page-link hide"
|
||||
zh-TW-lang="上一堂課"
|
||||
|
@ -138,7 +131,7 @@
|
|||
</div>
|
||||
<?cs if:!fullscreen ?>
|
||||
<div class="paging-links layout-content-col col-4">
|
||||
<?cs if:(design||training||guide||walkthru) && !page.landing && !footer.hide ?>
|
||||
<?cs if:(design||training||guide||walkthru) && !page.landing && !page.trainingcourse && !footer.hide ?>
|
||||
<a href="#" class="prev-page-link hide"
|
||||
zh-TW-lang="上一堂課"
|
||||
zh-CN-lang="上一课"
|
||||
|
|
Loading…
Reference in a new issue