From 30d59fd52ce5d8274480ba9fdeb08bef2cfbcc1b Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Fri, 27 Jan 2006 18:57:13 +0000 Subject: - Patch #46400 by m3avrck: clean up book navigation markup + UI improvements. (Hint: the forum module has previous and next links too.) --- misc/drupal.css | 45 ++++++++++----------------------------------- modules/book.module | 35 ++++++++++------------------------- modules/book/book.module | 35 ++++++++++------------------------- 3 files changed, 30 insertions(+), 85 deletions(-) diff --git a/misc/drupal.css b/misc/drupal.css index d235803e3..c76dce948 100644 --- a/misc/drupal.css +++ b/misc/drupal.css @@ -228,49 +228,24 @@ tr.odd .form-item, tr.even .form-item { margin-bottom: 1em; margin-top: 0; } -.book { - margin: 1em 0 1em 0; -} -.book .title { - font-weight: bold; - font-size: 1.3em; - margin-bottom: 1em; -} -.book .tree { - padding-top: 1em; +.book-navigation .menu { border-top: 1px solid #888; - padding-bottom: 1em; -} -.book .name { - padding-top: 1em; - font-weight: bold; - font-size: 1em; + padding: 1em 0 0 3em; } -.book .nav { +.book-navigation .page-links { border-top: 1px solid #888; border-bottom: 1px solid #888; - padding-bottom: 3em; - padding-top: 1em; - clear: both; + text-align: center; + padding: 0.5em; } -.book .nav .links { - clear: both; +.book-navigation .page-previous { + text-align: right; } -.book .nav .titles { - clear: both; +.book-navigation .page-up { + margin: 0 4em; } -.book .nav .prev { - float: left; +.book-navigation .page-next { text-align: left; - width: 45%; -} -.book .nav .next { - float: right; - text-align: right; - width: 45%; -} -.book .nav .up { - text-align: center; } .calendar .row-week td a { display: block; diff --git a/modules/book.module b/modules/book.module index 2ed3f5c9e..f29156225 100644 --- a/modules/book.module +++ b/modules/book.module @@ -481,44 +481,29 @@ function book_nodeapi(&$node, $op, $teaser, $page) { * @ingroup themeable */ function theme_book_navigation($node) { + $output = ''; + if ($node->nid) { - $output .= '
'; + $output .= '
'; if ($tree = book_tree($node->nid)) { - $output .= '
'. $tree .'
'; + $output .= $tree; } if ($prev = book_prev($node)) { drupal_add_link(array('rel' => 'prev', 'href' => url('node/'. $prev->nid))); - $links .= ''; - $titles .= ''; + $links .= l(t('‹ ') . check_plain($prev->title), 'node/'. $prev->nid, array('class' => 'page-previous', 'title' => t('Go to previous page'))); } - else { - $links .= ''; // Make an empty div to fill the space. + if ($node->parent) { + drupal_add_link(array('rel' => 'index', 'href' => url('node/'. $node->parent))); + $links .= l(t('up'), 'node/'. $node->parent, array('class' => 'page-up', 'title' => t('Go to parent page'))); } if ($next = book_next($node)) { drupal_add_link(array('rel' => 'next', 'href' => url('node/'. $next->nid))); - $links .= ''; - $titles .= ''; - } - else { - $links .= ''; // Make an empty div to fill the space. - } - if ($node->parent) { - drupal_add_link(array('rel' => 'index', 'href' => url('node/'. $node->parent))); - $links .= '
'; - $links .= l(t('up'), 'node/'. $node->parent, array('title' => t('View this page\'s parent section.'))); - $links .= '
'; + $links .= l(check_plain($next->title) . t(' ›'), 'node/'. $next->nid, array('class' => 'page-next', 'title' => t('Go to next page'))); } - $output .= ''; + $output .= ''; $output .= '
'; } diff --git a/modules/book/book.module b/modules/book/book.module index 2ed3f5c9e..f29156225 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -481,44 +481,29 @@ function book_nodeapi(&$node, $op, $teaser, $page) { * @ingroup themeable */ function theme_book_navigation($node) { + $output = ''; + if ($node->nid) { - $output .= '
'; + $output .= '
'; if ($tree = book_tree($node->nid)) { - $output .= '
'. $tree .'
'; + $output .= $tree; } if ($prev = book_prev($node)) { drupal_add_link(array('rel' => 'prev', 'href' => url('node/'. $prev->nid))); - $links .= ''; - $titles .= ''; + $links .= l(t('‹ ') . check_plain($prev->title), 'node/'. $prev->nid, array('class' => 'page-previous', 'title' => t('Go to previous page'))); } - else { - $links .= ''; // Make an empty div to fill the space. + if ($node->parent) { + drupal_add_link(array('rel' => 'index', 'href' => url('node/'. $node->parent))); + $links .= l(t('up'), 'node/'. $node->parent, array('class' => 'page-up', 'title' => t('Go to parent page'))); } if ($next = book_next($node)) { drupal_add_link(array('rel' => 'next', 'href' => url('node/'. $next->nid))); - $links .= ''; - $titles .= ''; - } - else { - $links .= ''; // Make an empty div to fill the space. - } - if ($node->parent) { - drupal_add_link(array('rel' => 'index', 'href' => url('node/'. $node->parent))); - $links .= '
'; - $links .= l(t('up'), 'node/'. $node->parent, array('title' => t('View this page\'s parent section.'))); - $links .= '
'; + $links .= l(check_plain($next->title) . t(' ›'), 'node/'. $next->nid, array('class' => 'page-next', 'title' => t('Go to next page'))); } - $output .= ''; + $output .= ''; $output .= '
'; } -- cgit v1.2.3