fix 'next' links to disable them when at the end of a list.
Also remove the "next class" link at the end of training. Change-Id: I1d81919a0498d57b451741a7a0c12f011921f2cb
This commit is contained in:
@@ -241,7 +241,7 @@ false; // navigate across topic boundaries only in design docs
|
|||||||
var training = $(".next-class-link").length; // decides whether to provide "next class" link
|
var training = $(".next-class-link").length; // decides whether to provide "next class" link
|
||||||
var isCrossingBoundary = false;
|
var isCrossingBoundary = false;
|
||||||
|
|
||||||
if ($selListItem.hasClass('nav-section')) {
|
if ($selListItem.hasClass('nav-section') && $selListItem.children('div.empty').length == 0) {
|
||||||
// we're on an index page, jump to the first topic
|
// we're on an index page, jump to the first topic
|
||||||
$nextLink = $selListItem.find('ul:eq(0)').find('a:eq(0)');
|
$nextLink = $selListItem.find('ul:eq(0)').find('a:eq(0)');
|
||||||
|
|
||||||
@@ -262,12 +262,17 @@ false; // navigate across topic boundaries only in design docs
|
|||||||
} else {
|
} else {
|
||||||
// jump to the next topic in this section (if it exists)
|
// jump to the next topic in this section (if it exists)
|
||||||
$nextLink = $selListItem.next('li').find('a:eq(0)');
|
$nextLink = $selListItem.next('li').find('a:eq(0)');
|
||||||
if (!$nextLink.length) {
|
if ($nextLink.length == 0) {
|
||||||
isCrossingBoundary = true;
|
isCrossingBoundary = true;
|
||||||
// no more topics in this section, jump to the first topic in the next section
|
// 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)');
|
$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)
|
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)');
|
$nextLink = $selListItem.parents('li:eq(1)').next('li.nav-section').find('a:eq(0)');
|
||||||
|
if ($nextLink.length == 0) {
|
||||||
|
// if that doesn't work, we're at the end of the list, so disable NEXT link
|
||||||
|
$('.next-page-link').attr('href','').addClass("disabled")
|
||||||
|
.click(function() { return false; });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -285,10 +290,11 @@ false; // navigate across topic boundaries only in design docs
|
|||||||
$('.next-page-link').attr('href','')
|
$('.next-page-link').attr('href','')
|
||||||
.removeClass("hide").addClass("disabled")
|
.removeClass("hide").addClass("disabled")
|
||||||
.click(function() { return false; });
|
.click(function() { return false; });
|
||||||
|
if ($nextLink.length) {
|
||||||
$('.next-class-link').attr('href',$nextLink.attr('href'))
|
$('.next-class-link').attr('href',$nextLink.attr('href'))
|
||||||
.removeClass("hide").append($nextLink.html());
|
.removeClass("hide").append($nextLink.html());
|
||||||
$('.next-class-link').find('.new').empty();
|
$('.next-class-link').find('.new').empty();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$('.next-page-link').attr('href', $nextLink.attr('href')).removeClass("hide");
|
$('.next-page-link').attr('href', $nextLink.attr('href')).removeClass("hide");
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user