rorschach
This commit is contained in:
@@ -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 }} " class="forum__name--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>
|
||||
@@ -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('rorschach/forum') }}
|
||||
{% if forums_defined %}
|
||||
<div class="forum">
|
||||
{{ forums }}
|
||||
{{ topics }}
|
||||
{{ topics_pager }}
|
||||
</div>
|
||||
{% endif %}
|
||||
@@ -0,0 +1,34 @@
|
||||
{% extends "item-list.html.twig" %}
|
||||
{#
|
||||
/**
|
||||
* @file
|
||||
* Theme override for an item list of search results.
|
||||
*
|
||||
* Available variables:
|
||||
* - items: A list of items. Each item contains:
|
||||
* - attributes: HTML attributes to be applied to each list item.
|
||||
* - value: The content of the list element.
|
||||
* - title: The title of the list.
|
||||
* - list_type: The tag for list element ("ul" or "ol").
|
||||
* - attributes: HTML attributes to be applied to the list.
|
||||
* - empty: A message to display when there are no items. Allowed value is a
|
||||
* string or render array.
|
||||
* - context: An list of contextual data associated with the list. For search
|
||||
* results, the following data is set:
|
||||
* - plugin: The search plugin ID, for example "node_search".
|
||||
*
|
||||
* @see template_preprocess_item_list()
|
||||
*/
|
||||
#}
|
||||
{%
|
||||
set classes = [
|
||||
'search-results',
|
||||
context.plugin ~ '-results',
|
||||
]
|
||||
%}
|
||||
{%
|
||||
set listClasses = [
|
||||
'search-results__item',
|
||||
]
|
||||
%}
|
||||
{% set attributes = attributes.addClass(classes) %}
|
||||
@@ -0,0 +1,38 @@
|
||||
{#
|
||||
/**
|
||||
* @file
|
||||
* Theme override for an item list.
|
||||
*
|
||||
* Available variables:
|
||||
* - items: A list of items. Each item contains:
|
||||
* - attributes: HTML attributes to be applied to each list item.
|
||||
* - value: The content of the list element.
|
||||
* - title: The title of the list.
|
||||
* - list_type: The tag for list element ("ul" or "ol").
|
||||
* - wrapper_attributes: HTML attributes to be applied to the list wrapper.
|
||||
* - attributes: HTML attributes to be applied to the list.
|
||||
* - empty: A message to display when there are no items. Allowed value is a
|
||||
* string or render array.
|
||||
* - context: A list of contextual data associated with the list. May contain:
|
||||
* - list_style: The custom list style.
|
||||
*
|
||||
* @see template_preprocess_item_list()
|
||||
*/
|
||||
#}
|
||||
{% if context.list_style %}
|
||||
{%- set attributes = attributes.addClass('item-list__' ~ context.list_style) %}
|
||||
{% endif %}
|
||||
{% if items or empty %}
|
||||
{%- if title is not empty -%}
|
||||
<h3>{{ title }}</h3>
|
||||
{%- endif -%}
|
||||
{%- if items -%}
|
||||
<{{ list_type }}{{ attributes }}>
|
||||
{%- for item in items -%}
|
||||
<li{{ item.attributes.addClass(listClasses) }}>{{ item.value }}</li>
|
||||
{%- endfor -%}
|
||||
</{{ list_type }}>
|
||||
{%- else -%}
|
||||
{{- empty -}}
|
||||
{%- endif -%}
|
||||
{%- endif %}
|
||||
Reference in New Issue
Block a user