Commit deec92a8 authored by catch's avatar catch
Browse files

Issue #736604 by mortendk, mgifford, tjhellmann, jyve, svendecabooter,...

Issue #736604 by mortendk, mgifford, tjhellmann, jyve, svendecabooter, droplet: Book module now without clearfix & better markup + accessibility love.
parent af12c395
<?php
/**
* @file
* Default theme implementation to navigate books. Presented under nodes that
......@@ -30,22 +29,27 @@
*/
?>
<?php if ($tree || $has_links): ?>
<div id="book-navigation-<?php print $book_id; ?>" class="book-navigation">
<nav id="book-navigation-<?php print $book_id; ?>" class="book-navigation">
<?php print $tree; ?>
<?php if ($has_links): ?>
<div class="page-links clearfix">
<h2 class="element-invisible"><?php print t('Book Navigation'); ?></h2>
<ul class="book-pager">
<?php if ($prev_url): ?>
<a href="<?php print $prev_url; ?>" class="page-previous" title="<?php print t('Go to previous page'); ?>"><?php print t('‹ ') . $prev_title; ?></a>
<li class="previous">
<a href="<?php print $prev_url; ?>" rel="prev" title="<?php print t('Go to previous page'); ?>"><b><?php print t('‹'); ?></b> <?php print $prev_title; ?></a>
</li>
<?php endif; ?>
<?php if ($parent_url): ?>
<a href="<?php print $parent_url; ?>" class="page-up" title="<?php print t('Go to parent page'); ?>"><?php print t('up'); ?></a>
<li class="up">
<a href="<?php print $parent_url; ?>" title="<?php print t('Go to parent page'); ?>"><?php print t('up'); ?></a>
</li>
<?php endif; ?>
<?php if ($next_url): ?>
<a href="<?php print $next_url; ?>" class="page-next" title="<?php print t('Go to next page'); ?>"><?php print $next_title . t(' ›'); ?></a>
<li class="next">
<a href="<?php print $next_url; ?>" rel="next" title="<?php print t('Go to next page'); ?>"><?php print $next_title;?> <b><?php print t('›'); ?></b></a>
</li>
<?php endif; ?>
</div>
</ul>
<?php endif; ?>
</div>
</nav>
<?php endif; ?>
.book-navigation .menu {
padding: 1em 3em 0 0;
}
.book-navigation .page-previous {
float: right;
}
.book-navigation .page-up {
float: right;
}
/**
* @file
* Admin styles for book module.
*/
/**
* Book outline on book edit form.
*/
.js #edit-book-pick-book {
display: none;
}
.book-navigation .menu {
border-top: 1px solid #888;
padding: 1em 0 0 3em; /* LTR */
}
.book-navigation .page-links {
border-top: 1px solid #888;
border-bottom: 1px solid #888;
text-align: center;
padding: 0.5em;
}
.book-navigation .page-previous {
text-align: left;
width: 42%;
display: block;
float: left; /* LTR */
}
.book-navigation .page-up {
margin: 0 5%;
width: 4%;
display: block;
float: left; /* LTR */
}
.book-navigation .page-next {
text-align: right;
width: 42%;
display: block;
float: right;
}
.book-outline-form .form-item {
margin-top: 0;
margin-bottom: 0;
}
html.js #edit-book-pick-book {
display: none;
}
.form-item-book-bid .description {
clear: both;
}
#book-admin-edit select {
margin-right: 24px;
}
#book-admin-edit select.progress-disabled {
margin-right: 0;
}
#book-admin-edit tr.ajax-new-content {
background-color: #ffd;
}
#book-admin-edit .form-item {
float: left;
}
......@@ -5,4 +5,4 @@ version = VERSION
core = 8.x
files[] = book.test
configure = admin/content/book/settings
stylesheets[all][] = book.css
stylesheets[all][] = book.theme.css
......@@ -401,13 +401,16 @@ function book_form_node_form_alter(&$form, &$form_state, $form_id) {
if ($access) {
_book_add_form_elements($form, $form_state, $node);
// Since the "Book" dropdown can't trigger a form submission when
// JavaScript is disabled, add a submit button to do that. book.css hides
// JavaScript is disabled, add a submit button to do that. book.admin.css hides
// this button when JavaScript is enabled.
$form['book']['pick-book'] = array(
'#type' => 'submit',
'#value' => t('Change book (update list of parents)'),
'#submit' => array('book_pick_book_nojs_submit'),
'#weight' => 20,
'#attached' => array(
'css' => array(drupal_get_path('module', 'book') . '/book.admin.css'),
),
);
}
}
......
......@@ -137,15 +137,15 @@ class BookTestCase extends DrupalWebTestCase {
// Check previous, up, and next links.
if ($previous) {
$this->assertRaw(l(' ' . $previous->title, 'node/' . $previous->nid, array('attributes' => array('class' => array('page-previous'), 'title' => t('Go to previous page')))), t('Previous page link found.'));
$this->assertRaw(l('<b>‹</b> ' . $previous->title, 'node/' . $previous->nid, array('html'=> TRUE, 'attributes' => array('rel' => array('prev'), 'title' => t('Go to previous page')))), t('Previous page link found.'));
}
if ($up) {
$this->assertRaw(l('up', 'node/' . $up->nid, array('attributes' => array('class' => array('page-up'), 'title' => t('Go to parent page')))), t('Up page link found.'));
$this->assertRaw(l('up', 'node/' . $up->nid, array('html'=> TRUE,'attributes' => array('title' => t('Go to parent page')))), t('Up page link found.'));
}
if ($next) {
$this->assertRaw(l($next->title . ' ', 'node/' . $next->nid, array('attributes' => array('class' => array('page-next'), 'title' => t('Go to next page')))), t('Next page link found.'));
$this->assertRaw(l($next->title . ' <b>›</b>', 'node/' . $next->nid, array('html'=> TRUE, 'attributes' => array('rel' => array('next'), 'title' => t('Go to next page')))), t('Next page link found.'));
}
// Compute the expected breadcrumb.
......@@ -184,7 +184,7 @@ class BookTestCase extends DrupalWebTestCase {
$outline .= '(node\/' . $node->nid . ')(.*?)(' . $node->title . ')(.*?)';
}
return '/<div id="book-navigation-' . $this->book->nid . '"(.*?)<ul(.*?)' . $outline . '<\/ul>/s';
return '/<nav id="book-navigation-' . $this->book->nid . '"(.*?)<ul(.*?)' . $outline . '<\/ul>/s';
}
/**
......
/**
* @file
* RTL styling for the book module.
*/
/**
* Book navigation.
*/
.book-pager .previous {
float: right;
text-align: right;
}
.book-pager .up {
*float: right;
}
.book-pager .next {
float: left;
text-align: left;
}
/**
* @file
* Styling for the book module.
*/
/**
* Book navigation.
*/
.book-navigation .menu {
padding-bottom: 0;
padding-top: 1em;
}
.book-navigation .book-pager {
margin: 0;
overflow: auto;
padding: 0.5em 0;
}
.book-pager li {
display: inline-block;
*display: inline;
/* Prevents a line break caused by the float in .page-next in IE7. */
*float: left; /* LTR */
list-style-type: none;
vertical-align: top;
zoom: 1;
}
.book-pager .previous {
text-align: left; /* LTR */
width: 45%;
}
.book-pager .up {
text-align: center;
width: 8%;
}
.book-pager .next {
float: right; /* LTR */
text-align: right; /* LTR */
width: 45%;
}
......@@ -1648,3 +1648,13 @@ div.admin-panel .description {
#footer-wrapper .poll .bar .foreground {
background-color: #ddd;
}
/* ---------- book ----------- */
.book-navigation .menu {
border-top: 1px solid #D6D6D6;
}
.book-navigation .book-pager {
border-bottom: 1px solid #D6D6D6;
border-top: 1px solid #D6D6D6;
margin: 0;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment