Skip to content

Commit

Permalink
Add missing templates
Browse files Browse the repository at this point in the history
  • Loading branch information
occupant committed Mar 1, 2023
1 parent d94fc51 commit 96e5ecf
Show file tree
Hide file tree
Showing 30 changed files with 925 additions and 4 deletions.
31 changes: 31 additions & 0 deletions templates/content/aggregator-item.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{#
/**
* @file
* Theme override to present a feed item in an aggregator page.
*
* Available variables:
* - url: URL to the originating feed item.
* - title: (optional) Title of the feed item.
* - content: All field items. Use {{ content }} to print them all,
* or print a subset such as {{ content.field_example }}. Use
* {{ content|without('field_example') }} to temporarily suppress the printing
* of a given element.
* - attributes: HTML attributes for the wrapper.
* - title_prefix: Additional output populated by modules, intended to be
* displayed in front of the main title tag that appears in the template.
* - title_suffix: Additional output populated by modules, intended to be
* displayed after the main title tag that appears in the template.
*
* @see template_preprocess_aggregator_item()
*/
#}
<article{{ attributes.addClass('aggregator-item') }}>
{{ title_prefix }}
{% if title %}
<h3 class="feed-item-title">
<a href="{{ url }}">{{ title }}</a>
</h3>
{% endif %}
{{ title_suffix }}
{{ content }}
</article>
20 changes: 20 additions & 0 deletions templates/content/book-node-export-html.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{#
/**
* @file
* Theme override 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()
*/
#}
<article id="node-{{ node.id }}" class="section-{{ depth }}">
<h1 class="book-heading">{{ title }}</h1>
{{ content }}
{{ children }}
</article>
21 changes: 21 additions & 0 deletions templates/content/media-embed-error.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{#
/**
* @file
* Theme override for a missing media error.
*
* Available variables
* - message: The message text.
* - attributes: HTML attributes for the containing element.
*
* When a response from the back end can't be returned, a related error message
* is displayed from JavaScript.
*
* @see Drupal.theme.mediaEmbedPreviewError
*
* @ingroup themeable
*/
#}
{{ attach_library('kraken/media_embed_error') }}
<div{{ attributes.addClass('media-embed-error', 'media-embed-error--missing-source') }}>
{{ message }}
</div>
2 changes: 1 addition & 1 deletion templates/content/search-result.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
'text-sm',
]
%}

{{ attach_library('kraken/search-results') }}
{{ title_prefix }}
<h3{{ title_attributes.addClass(title_classes) }}>
<a href="{{ url }}">{{ title }}</a>
Expand Down
36 changes: 36 additions & 0 deletions templates/dataset/aggregator-feed.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{#
/**
* @file
* Theme override to present an aggregator feed.
*
* The contents are rendered above feed listings when browsing source feeds.
* For example, "example.com/aggregator/sources/1".
*
* Available variables:
* - title: (optional) Title of the feed item.
* - content: All field items. Use {{ content }} to print them all,
* or print a subset such as {{ content.field_example }}. Use
* {{ content|without('field_example') }} to temporarily suppress the printing
* of a given element.
* - attributes: HTML attributes for the wrapper.
* - title_attributes: Same as attributes, except applied to the main title
* tag that appears in the template.
* - title_prefix: Additional output populated by modules, intended to be
* displayed in front of the main title tag that appears in the template.
* - title_suffix: Additional output populated by modules, intended to be
* displayed after the main title tag that appears in the template.
*
* @see template_preprocess_aggregator_feed()
*/
#}
<div{{ attributes.addClass('aggregator-feed') }}>

{{ title_prefix }}
{% if title and not full %}
<h2{{ title_attributes }}>{{ title }}</h2>
{% endif %}
{{ title_suffix }}

{{ content }}

</div>
30 changes: 30 additions & 0 deletions templates/dataset/forum-icon.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{#
/**
* @file
* Theme override to display a status icon for a forum post.
*
* Available variables:
* - attributes: HTML attributes to be applied to the wrapper element.
* - class: HTML classes that determine which icon to display. May be one of
* 'hot', 'hot-new', 'new', 'default', 'closed', or 'sticky'.
* - title: Text alternative for the forum icon.
* - icon_title: Text alternative for the forum icon, same as above.
* - new_posts: '1' when this topic contains new posts, otherwise '0'.
* - first_new: '1' when this is the first topic with new posts, otherwise '0'.
* - icon_status: Indicates which status icon should be used.
*
* @see template_preprocess_forum_icon()
*/
#}
{%
set classes = [
'forum__icon',
'forum__topic-status--' ~ icon_status,
]
%}
<div{{ attributes.addClass(classes) }}>
{% if first_new -%}
<a id="new"></a>
{%- endif %}
<span class="visually-hidden">{{ icon_title }}</span>
</div>
79 changes: 79 additions & 0 deletions templates/dataset/forum-list.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{#
/**
* @file
* Theme override to display a list of forums and containers.
*
* Available variables:
* - forums: A collection of forums and containers to display. It is keyed to
* the numeric IDs of all child forums and containers. Each forum in forums
* contains:
* - is_container: A flag indicating if the forum can contain other
* forums. Otherwise, the forum can only contain topics.
* - depth: How deep the forum is in the current hierarchy.
* - zebra: 'even' or 'odd', used for row class.
* - icon_class: 'default' or 'new', used for forum icon class.
* - icon_title: Text alternative for the forum icon.
* - name: The name of the forum.
* - link: The URL to link to this forum.
* - description: The description field for the forum, containing:
* - value: The descriptive text for the forum.
* - new_topics: A flag indicating if the forum contains unread posts.
* - new_url: A URL to the forum's unread posts.
* - new_text: Text for the above URL, which tells how many new posts.
* - old_topics: A count of posts that have already been read.
* - num_posts: The total number of posts in the forum.
* - last_reply: Text representing the last time a forum was posted or
* commented in.
* - forum_id: Forum ID for the current forum. Parent to all items within the
* forums array.
*
* @see template_preprocess_forum_list()
*/
#}
<table id="forum-{{ forum_id }}">
<thead>
<tr>
<th>{{ 'Forum'|t }}</th>
<th>{{ 'Topics'|t }}</th>
<th>{{ 'Posts'|t }}</th>
<th>{{ 'Last post'|t }}</th>
</tr>
</thead>
<tbody>
{% for child_id, forum in forums %}
<tr id="forum-list-{{ child_id }}" class="{{ forum.zebra }}">
<td {% if forum.is_container == true -%}
colspan="4" class="container"
{%- else -%}
class="forum-list__forum"
{%- endif -%}>
{#
Enclose the contents of this cell with X divs, where X is the
depth this forum resides at. This will allow us to use CSS
left-margin for indenting.
#}
{% if forum.depth > 0 %}{% for i in 1..forum.depth %}<div class="indented">{% endfor %}{% endif %}
<div class="forum__icon forum-status-{{ forum.icon_class }}" title="{{ forum.icon_title }}">
<span class="visually-hidden">{{ forum.icon_title }}</span>
</div>
<div class="forum__name"><a href="{{ forum.link }}">{{ forum.label }}</a></div>
{% if forum.description.value %}
<div class="forum__description">{{ forum.description.value }}</div>
{% endif %}
{% if forum.depth > 0 %}{% for i in 1..forum.depth %}</div>{% endfor %}{% endif %}
</td>
{% if forum.is_container == false %}
<td class="forum__topics">
{{ forum.num_topics }}
{% if forum.new_topics == true %}
<br />
<a href="{{ forum.new_url }}">{{ forum.new_text }}</a>
{% endif %}
</td>
<td class="forum__posts">{{ forum.num_posts }}</td>
<td class="forum__last-reply">{{ forum.last_reply }}</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
24 changes: 24 additions & 0 deletions templates/dataset/forums.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{#
/**
* @file
* Theme override to display a forum.
*
* May contain forum containers as well as forum topics.
*
* Available variables:
* - forums: The forums to display (as processed by forum-list.html.twig).
* - topics: The topics to display.
* - topics_pager: The topics pager.
* - forums_defined: A flag to indicate that the forums are configured.
*
* @see template_preprocess_forums()
*/
#}
{{ attach_library('kraken/forum') }}
{% if forums_defined %}
<div class="forum">
{{ forums }}
{{ topics }}
{{ topics_pager }}
</div>
{% endif %}
45 changes: 45 additions & 0 deletions templates/layout/book-export-html.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{#
/**
* @file
* Theme override 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()
*/
#}
<!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.
#}

{% if depth > 1 %}{% for i in 1..depth-1 %}
<div class="section-{{ i }}">
{% endfor %}{% endif %}
{{ contents }}
{% if depth > 1 %}{% for i in 1..depth-1 %}
</div>
{% endfor %}{% endif %}
</body>
</html>
28 changes: 28 additions & 0 deletions templates/media-library/container--media-library-content.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{#
/**
* @file
* Theme implementation the content area of the modal media library dialog.
*
* The content area is everything that is not the menu of available media
* types. This includes the form to add new media items, if available, and
* the view of available media to select.
*
* Available variables:
* - attributes: HTML attributes for the containing element.
* - children: The rendered child elements of the container.
* - has_parent: A flag to indicate that the container has one or more parent
containers.
*
* @see template_preprocess_container()
*
* @ingroup themeable
*/
#}
{%
set classes = [
has_parent ? 'js-form-wrapper',
has_parent ? 'form-wrapper',
'media-library-content',
]
%}
<div{{ attributes.addClass(classes) }}>{{ children }}</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{#
/**
* @file
* Theme implementation of a wrapper for selected media items.
*
* This is used to wrap around the set of media items that are currently
* selected in the media library widget (not the modal dialog), which may
* be used for entity reference fields that target media.
*
* Available variables:
* - attributes: HTML attributes for the containing element.
* - children: The rendered child elements of the container.
* - has_parent: A flag to indicate that the container has one or more parent
containers.
*
* @see template_preprocess_container()
*
* @ingroup themeable
*/
#}
{%
set classes = [
has_parent ? 'js-form-wrapper',
has_parent ? 'form-wrapper',
'media-library-selection',
]
%}
<div{{ attributes.addClass(classes) }}>{{ children }}</div>
36 changes: 36 additions & 0 deletions templates/media-library/links--media-library-menu.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{% extends "links.html.twig" %}
{#
/**
* @file
* Theme implementation of the media type menu in the media library dialog.
*
* Available variables:
* - attributes: Attributes for the UL containing the list of links.
* - links: Links to be output.
* Each link will have the following elements:
* - link: (optional) A render array that returns a link. See
* template_preprocess_links() for details how it is generated.
* - text: The link text.
* - attributes: HTML attributes for the list item element.
* - text_attributes: (optional) HTML attributes for the span element if no
* 'url' was supplied.
* - heading: (optional) A heading to precede the links.
* - text: The heading text.
* - level: The heading level (e.g. 'h2', 'h3').
* - attributes: (optional) A keyed list of attributes for the heading.
* If the heading is a string, it will be used as the text of the heading and
* the level will default to 'h2'.
*
* Headings should be used on navigation menus and any list of links that
* consistently appears on multiple pages. To make the heading invisible use
* the 'visually-hidden' CSS class. Do not use 'display:none', which
* removes it from screen readers and assistive technology. Headings allow
* screen reader and keyboard only users to navigate to or skip the links.
* See http://juicystudio.com/article/screen-readers-display-none.php and
* http://www.w3.org/TR/WCAG-TECHS/H42.html for more information.
*
* @see classy_preprocess_links__media_library_menu()
* @see template_preprocess_links()
*/
#}
{% set attributes = attributes.addClass('media-library-menu') %}
Loading

0 comments on commit 96e5ecf

Please sign in to comment.