Issue #2349633 by mortendk, runand, bradwade, emma.maria: Copy book templates to Classy

8.0.x
Alex Pott 2014-11-20 09:35:08 +00:00
parent a69bc3eb89
commit 8de9b679a6
10 changed files with 177 additions and 11 deletions

View File

@ -18,7 +18,7 @@
*/
#}
{% for book in book_menus %}
<nav id="book-block-menu-{{ book.id }}" class="book-block-menu" role="navigation" aria-label="{% trans %}Book outline for {{ book.title }}{% endtrans %}">
<nav role="navigation" aria-label="{% trans %}Book outline for {{ book.title }}{% endtrans %}">
{{ book.menu }}
</nav>
{% endfor %}

View File

@ -37,7 +37,7 @@
#}
{% for i in 1..depth-1 if depth > 1 %}
<div class="section-{{ i }}">
<div>
{% endfor %}
{{ contents }}
{% for i in 1..depth-1 if depth > 1 %}

View File

@ -31,23 +31,23 @@
*/
#}
{% if tree or has_links %}
<nav id="book-navigation-{{ book_id }}" class="book-navigation" role="navigation" aria-labelledby="book-label-{{ book_id }}">
<nav id="book-navigation-{{ book_id }}" role="navigation" aria-labelledby="book-label-{{ book_id }}">
{{ tree }}
{% if has_links %}
<h2 class="visually-hidden" id="book-label-{{ book_id }}">{{ 'Book traversal links for'|t }} {{ book_title }}</h2>
<ul class="book-pager">
<h2>{{ 'Book traversal links for'|t }} {{ book_title }}</h2>
<ul>
{% if prev_url %}
<li class="previous">
<li>
<a href="{{ prev_url }}" rel="prev" title="{{ 'Go to previous page'|t }}"><b>{{ ''|t }}</b> {{ prev_title }}</a>
</li>
{% endif %}
{% if parent_url %}
<li class="up">
<li>
<a href="{{ parent_url }}" title="{{ 'Go to parent page'|t }}">{{ 'Up'|t }}</a>
</li>
{% endif %}
{% if next_url %}
<li class="next">
<li>
<a href="{{ next_url }}" rel="next" title="{{ 'Go to next page'|t }}">{{ next_title }} <b>{{ ''|t }}</b></a>
</li>
{% endif %}

View File

@ -15,8 +15,8 @@
* @ingroup themeable
*/
#}
<article id="node-{{ node.id }}" class="section-{{ depth }}">
<h1 class="book-heading">{{ title }}</h1>
<article>
<h1>{{ title }}</h1>
{{ content }}
{{ children }}
</article>

View File

@ -13,4 +13,4 @@
* @ingroup themeable
*/
#}
<ul class="menu">{{ tree }}</ul>
<ul>{{ tree }}</ul>

View File

@ -0,0 +1,24 @@
{#
/**
* @file
* Default theme implementation for rendering book outlines within a block.
*
* This template is used only when the block is configured to "show block on all
* pages", which presents multiple independent books on all pages.
*
* Available variables:
* - book_menus: Book outlines.
* - id: The parent book ID.
* - title: The parent book title.
* - menu: The top-level book links.
*
* @see template_preprocess_book_all_books_block()
*
* @ingroup themeable
*/
#}
{% for book in book_menus %}
<nav id="book-block-menu-{{ book.id }}" class="book-block-menu" role="navigation" aria-label="{% trans %}Book outline for {{ book.title }}{% endtrans %}">
{{ book.menu }}
</nav>
{% endfor %}

View File

@ -0,0 +1,47 @@
{#
/**
* @file
* Default theme implementation for printed version of book outline.
*
* Available variables:
* - title: Top level node title.
* - head: Header tags.
* - language: Language object.
* - language_rtl: A flag indicating whether the current display language is a
* right to left language.
* - base_url: URL to the home page.
* - contents: Nodes within the current outline rendered through
* book-node-export-html.html.twig.
*
* @see template_preprocess_book_export_html()
*
* @ingroup themeable
*/
#}
<!DOCTYPE html>
<html{{ html_attributes }}>
<head>
<title>{{ title }}</title>
{{ page.head }}
<base href="{{ base_url }}" />
<link type="text/css" rel="stylesheet" href="misc/print.css" />
</head>
<body>
{#
The given node is embedded to its absolute depth in a top level section.
For example, a child node with depth 2 in the hierarchy is contained in
(otherwise empty) div elements corresponding to depth 0 and depth 1. This
is intended to support WYSIWYG output - e.g., level 3 sections always look
like level 3 sections, no matter their depth relative to the node selected
to be exported as printer-friendly HTML.
#}
{% for i in 1..depth-1 if depth > 1 %}
<div class="section-{{ i }}">
{% endfor %}
{{ contents }}
{% for i in 1..depth-1 if depth > 1 %}
</div>
{% endfor %}
</body>
</html>

View File

@ -0,0 +1,57 @@
{#
/**
* @file
* Default theme implementation to navigate books.
*
* Presented under nodes that are a part of book outlines.
*
* Available variables:
* - tree: The immediate children of the current node rendered as an unordered
* list.
* - current_depth: Depth of the current node within the book outline. Provided
* for context.
* - prev_url: URL to the previous node.
* - prev_title: Title of the previous node.
* - parent_url: URL to the parent node.
* - parent_title: Title of the parent node. Not printed by default. Provided
* as an option.
* - next_url: URL to the next node.
* - next_title: Title of the next node.
* - has_links: Flags TRUE whenever the previous, parent or next data has a
* value.
* - book_id: The book ID of the current outline being viewed. Same as the node
* ID containing the entire outline. Provided for context.
* - book_url: The book/node URL of the current outline being viewed. Provided
* as an option. Not used by default.
* - book_title: The book/node title of the current outline being viewed.
*
* @see template_preprocess_book_navigation()
*
* @ingroup themeable
*/
#}
{% if tree or has_links %}
<nav id="book-navigation-{{ book_id }}" class="book-navigation" role="navigation" aria-labelledby="book-label-{{ book_id }}">
{{ tree }}
{% if has_links %}
<h2 class="visually-hidden" id="book-label-{{ book_id }}">{{ 'Book traversal links for'|t }} {{ book_title }}</h2>
<ul class="book-pager">
{% if prev_url %}
<li class="previous">
<a href="{{ prev_url }}" rel="prev" title="{{ 'Go to previous page'|t }}"><b>{{ ''|t }}</b> {{ prev_title }}</a>
</li>
{% endif %}
{% if parent_url %}
<li class="up">
<a href="{{ parent_url }}" title="{{ 'Go to parent page'|t }}">{{ 'Up'|t }}</a>
</li>
{% endif %}
{% if next_url %}
<li class="next">
<a href="{{ next_url }}" rel="next" title="{{ 'Go to next page'|t }}">{{ next_title }} <b>{{ ''|t }}</b></a>
</li>
{% endif %}
</ul>
{% endif %}
</nav>
{% endif %}

View File

@ -0,0 +1,22 @@
{#
/**
* @file
* Default theme implementation for a single node in a printer-friendly outline.
*
* Available variables:
* - node: Fully loaded node.
* - depth: Depth of the current node inside the outline.
* - title: Node title.
* - content: Node content.
* - children: All the child nodes recursively rendered through this file.
*
* @see template_preprocess_book_node_export_html()
*
* @ingroup themeable
*/
#}
<article id="node-{{ node.id }}" class="section-{{ depth }}">
<h1 class="book-heading">{{ title }}</h1>
{{ content }}
{{ children }}
</article>

View File

@ -0,0 +1,16 @@
{#
/**
* @file
* Default theme implementation for a book tree.
*
* Returns HTML for a wrapper for a book sub-tree.
*
* Available variables:
* - tree: An HTML string containing the tree's items.
*
* @see template_preprocess_book_tree()
*
* @ingroup themeable
*/
#}
<ul class="menu">{{ tree }}</ul>