Issue #2349683 by davidhernandez, mortendk, Manuel Garcia, emma.maria, DickJohnson: Copy forum templates to Classy

8.0.x
Alex Pott 2015-02-06 13:18:24 +00:00
parent a85e59d47b
commit e6e30345dc
8 changed files with 173 additions and 22 deletions

View File

@ -18,13 +18,7 @@
* @ingroup themeable * @ingroup themeable
*/ */
#} #}
{% <div{{ attributes }}>
set classes = [
'icon',
'topic-status-' ~ icon_status,
]
%}
<div{{ attributes.addClass(classes) }}>
{% if first_new -%} {% if first_new -%}
<a id="new"></a> <a id="new"></a>
{%- endif %} {%- endif %}

View File

@ -32,7 +32,7 @@
* @ingroup themeable * @ingroup themeable
*/ */
#} #}
<table id="forum-{{ forum_id }}"> <table>
<thead> <thead>
<tr> <tr>
<th>{{ 'Forum'|t }}</th> <th>{{ 'Forum'|t }}</th>
@ -43,37 +43,33 @@
</thead> </thead>
<tbody> <tbody>
{% for child_id, forum in forums %} {% for child_id, forum in forums %}
<tr id="forum-list-{{ child_id }}" class="{{ forum.zebra }}"> <tr>
<td {% if forum.is_container == true -%} <td{% if forum.is_container == true %} colspan="4"{% endif %}>
colspan="4" class="container"
{%- else -%}
class="forum"
{%- endif -%}>
{# {#
Enclose the contents of this cell with X divs, where X is the 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 depth this forum resides at. This will allow us to use CSS
left-margin for indenting. left-margin for indenting.
#} #}
{% for i in 1..forum.depth if forum.depth > 0 %}<div class="indent">{% endfor %} {% for i in 1..forum.depth if forum.depth > 0 %}<div class="indent">{% endfor %}
<div class="icon forum-status-{{ forum.icon_class }}" title="{{ forum.icon_title }}"> <div title="{{ forum.icon_title }}">
<span class="visually-hidden">{{ forum.icon_title }}</span> <span class="visually-hidden">{{ forum.icon_title }}</span>
</div> </div>
<div class="name"><a href="{{ forum.link }}">{{ forum.label }}</a></div> <div><a href="{{ forum.link }}">{{ forum.label }}</a></div>
{% if forum.description.value %} {% if forum.description.value %}
<div class="description">{{ forum.description.value }}</div> <div>{{ forum.description.value }}</div>
{% endif %} {% endif %}
{% for i in 1..forum.depth if forum.depth > 0 %}</div>{% endfor %} {% for i in 1..forum.depth if forum.depth > 0 %}</div>{% endfor %}
</td> </td>
{% if forum.is_container == false %} {% if forum.is_container == false %}
<td class="topics"> <td>
{{ forum.num_topics }} {{ forum.num_topics }}
{% if forum.new_topics == true %} {% if forum.new_topics == true %}
<br /> <br />
<a href="{{ forum.new_url }}">{{ forum.new_text }}</a> <a href="{{ forum.new_url }}">{{ forum.new_text }}</a>
{% endif %} {% endif %}
</td> </td>
<td class="posts">{{ forum.num_posts }}</td> <td>{{ forum.num_posts }}</td>
<td class="last-reply">{{ forum.last_reply }}</td> <td>{{ forum.last_reply }}</td>
{% endif %} {% endif %}
</tr> </tr>
{% endfor %} {% endfor %}

View File

@ -17,7 +17,7 @@
*/ */
#} #}
{% if time %} {% if time %}
<span class="submitted">{% trans %}By {{ author|passthrough }} {{ time }} ago{% endtrans %}</span> <span>{% trans %}By {{ author|passthrough }} {{ time }} ago{% endtrans %}</span>
{% else %} {% else %}
{{ 'n/a'|t }} {{ 'n/a'|t }}
{% endif %} {% endif %}

View File

@ -17,7 +17,7 @@
*/ */
#} #}
{% if forums_defined %} {% if forums_defined %}
<div id="forum"> <div>
{{ forums }} {{ forums }}
{{ topics }} {{ topics }}
{{ topics_pager }} {{ topics_pager }}

View File

@ -0,0 +1,32 @@
{#
/**
* @file
* Default theme implementation 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()
*
* @ingroup themeable
*/
#}
{%
set classes = [
'icon',
'topic-status-' ~ icon_status,
]
%}
<div{{ attributes.addClass(classes) }}>
{% if first_new -%}
<a id="new"></a>
{%- endif %}
<span class="visually-hidden">{{ icon_title }}</span>
</div>

View File

@ -0,0 +1,81 @@
{#
/**
* @file
* Default theme implementation 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()
*
* @ingroup themeable
*/
#}
<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"
{%- 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.
#}
{% for i in 1..forum.depth if forum.depth > 0 %}<div class="indent">{% endfor %}
<div class="icon forum-status-{{ forum.icon_class }}" title="{{ forum.icon_title }}">
<span class="visually-hidden">{{ forum.icon_title }}</span>
</div>
<div class="name"><a href="{{ forum.link }}">{{ forum.label }}</a></div>
{% if forum.description.value %}
<div class="description">{{ forum.description.value }}</div>
{% endif %}
{% for i in 1..forum.depth if forum.depth > 0 %}</div>{% endfor %}
</td>
{% if forum.is_container == false %}
<td class="topics">
{{ forum.num_topics }}
{% if forum.new_topics == true %}
<br />
<a href="{{ forum.new_url }}">{{ forum.new_text }}</a>
{% endif %}
</td>
<td class="posts">{{ forum.num_posts }}</td>
<td class="last-reply">{{ forum.last_reply }}</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>

View File

@ -0,0 +1,23 @@
{#
/**
* @file
* Default theme implementation for a forum post submission string.
*
* The submission string indicates when and by whom a topic was submitted.
*
* Available variables:
* - author: The author of the post.
* - time: How long ago the post was created.
* - topic: An object with the raw data of the post. Potentially unsafe. Be
* sure to clean this data before printing.
*
* @see template_preprocess_forum_submitted()
*
* @ingroup themeable
*/
#}
{% if time %}
<span class="submitted">{% trans %}By {{ author|passthrough }} {{ time }} ago{% endtrans %}</span>
{% else %}
{{ 'n/a'|t }}
{% endif %}

View File

@ -0,0 +1,25 @@
{#
/**
* @file
* Default theme implementation 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()
*
* @ingroup themeable
*/
#}
{% if forums_defined %}
<div id="forum">
{{ forums }}
{{ topics }}
{{ topics_pager }}
</div>
{% endif %}