Commit f2ed4ce1 authored by alexpott's avatar alexpott

Issue #2424533 by davidhernandez, mortendk: Copy views templates to Classy

parent 3684dd2d
{#
/**
* @file
* Theme override for a views exposed form.
*
* Available variables:
* - form: A render element representing the form.
*
* @see template_preprocess_views_exposed_form()
*/
#}
{% if q is not empty %}
{#
This ensures that, if clean URLs are off, the 'q' is added first,
as a hidden form element, so that it shows up first in the POST URL.
#}
{{ q }}
{% endif %}
<div class="form--inline clearfix">
{{ form }}
</div>
{#
/**
* @file
* Theme override for a views mini-pager.
*
* Available variables:
* - items: List of pager items.
*
* @see template_preprocess_views_mini_pager()
*/
#}
{% if items.previous or items.next %}
<nav class="pager" role="navigation" aria-labelledby="pagination-heading">
<h4 class="pager__heading visually-hidden">{{ 'Pagination'|t }}</h4>
<ul class="pager__items">
{% if items.previous %}
<li class="pager__item pager__item--previous">
<a href="{{ items.previous.href }}" title="{{ 'Go to previous page'|t }}" rel="prev"{{ items.previous.attributes }}>
<span class="visually-hidden">{{ 'Previous page'|t }}</span>
<span aria-hidden="true">{{ items.previous.text|default('‹‹'|t) }}</span>
</a>
</li>
{% endif %}
{% if items.current %}
<li class="pager__item is-active">
{% trans %}
Page {{ items.current }}
{% endtrans %}
</li>
{% endif %}
{% if items.next %}
<li class="pager__item pager__item--next">
<a href="{{ items.next.href }}" title="{{ 'Go to next page'|t }}" rel="next"{{ items.next.attributes }}>
<span class="visually-hidden">{{ 'Next page'|t }}</span>
<span aria-hidden="true">{{ items.next.text|default('››'|t) }}</span>
</a>
</li>
{% endif %}
</ul>
</nav>
{% endif %}
{#
/**
* @file
* Theme override for views to display rows in a grid.
*
* Available variables:
* - attributes: HTML attributes for the wrapping element.
* - title: The title of this group of rows.
* - view: The view object.
* - rows: The rendered view results.
* - options: The view plugin style options.
* - row_class_default: A flag indicating whether default classes should be
* used on rows.
* - col_class_default: A flag indicating whether default classes should be
* used on columns.
* - items: A list of grid items. Each item contains a list of rows or columns.
* The order in what comes first (row or column) depends on which alignment
* type is chosen (horizontal or vertical).
* - attributes: HTML attributes for each row or column.
* - content: A list of columns or rows. Each row or column contains:
* - attributes: HTML attributes for each row or column.
* - content: The row or column contents.
*
* @see template_preprocess_views_view_grid()
*/
#}
{%
set classes = [
'views-view-grid',
options.alignment,
'cols-' ~ options.columns,
'clearfix',
]
%}
{% if options.row_class_default %}
{%
set row_classes = [
'views-row',
options.alignment == 'horizontal' ? 'clearfix',
]
%}
{% endif %}
{% if options.col_class_default %}
{%
set col_classes = [
'views-col',
options.alignment == 'vertical' ? 'clearfix',
]
%}
{% endif %}
{% if title %}
<h3>{{ title }}</h3>
{% endif %}
<div{{ attributes.addClass(classes) }}>
{% if options.alignment == 'horizontal' %}
{% for row in items %}
<div{{ row.attributes.addClass(row_classes, options.row_class_default ? 'row-' ~ loop.index) }}>
{% for column in row.content %}
<div{{ column.attributes.addClass(col_classes, options.col_class_default ? 'col-' ~ loop.index) }}>
{{ column.content }}
</div>
{% endfor %}
</div>
{% endfor %}
{% else %}
{% for column in items %}
<div{{ column.attributes.addClass(col_classes, options.col_class_default ? 'col-' ~ loop.index) }}>
{% for row in column.content %}
<div{{ row.attributes.addClass(row_classes, options.row_class_default ? 'row-' ~ loop.index) }}>
{{ row.content }}
</div>
{% endfor %}
</div>
{% endfor %}
{% endif %}
</div>
{#
/**
* @file
* Theme override to display a single views grouping.
*
* Available variables:
* - view: The view object.
* - grouping: The grouping instruction.
* - grouping_level: A number indicating the hierarchical level of the grouping.
* - title: The group heading.
* - content: The content to be grouped.
* - rows: The rows returned from the view.
*
* @see template_preprocess_views_view_grouping()
*/
#}
<div class="view-grouping">
<div class="view-grouping-header">{{ title }}</div>
<div class="view-grouping-content">{{ content }}</div>
</div>
{#
/**
* @file
* Theme override for a view template to display a list of rows.
*
* Available variables:
* - attributes: HTML attributes for the container.
* - rows: A list of rows for this list.
* - attributes: The row's HTML attributes.
* - content: The row's contents.
* - title: The title of this group of rows. May be empty.
* - list: @todo.
* - type: Starting tag will be either a ul or ol.
* - attributes: HTML attributes for the list element.
*
* @see template_preprocess_views_view_list()
*/
#}
{% if attributes -%}
<div{{ attributes }}>
{% endif %}
{% if title %}
<h3>{{ title }}</h3>
{% endif %}
<{{ list.type }}{{ list.attributes }}>
{% for row in rows %}
<li{{ row.attributes }}>{{ row.content }}</li>
{% endfor %}
</{{ list.type }}>
{% if attributes -%}
</div>
{% endif %}
{#
/**
* @file
* Theme override for testing the mapping row style.
*
* Available variables:
* - element: The view content.
*
* @see template_preprocess_views_view_mapping_test()
*/
#}
{{ element }}
{#
/**
* @file
* Theme override for feed displays that use the OPML style.
*
* Available variables:
* - title: The title of the feed (as set in the view).
* - updated: The modified date of the feed.
* - items: The feed items themselves.
*
* @see template_preprocess_views_view_opml()
*/
#}
<?xml version="1.0" encoding="utf-8" ?>
<opml version="2.0">
<head>
<title>{{ title }}</title>
<dateModified>{{ updated }}</dateModified>
</head>
<body>
{{ items }}
</body>
</opml>
{#
/**
* @file
* Theme override to display an item in a views OPML feed.
*
* Available variables:
* - attributes: Attributes for outline element.
*
* @see template_preprocess_views_view_row_opml()
*/
#}
<outline{{ attributes }}/>
{#
/**
* @file
* Theme override to display an item in a views RSS feed.
*
* Available variables:
* - title: RSS item title.
* - link: RSS item link.
* - description: RSS body text.
* - item_elements: RSS item elements rendered as XML (pubDate, creator, guid).
*
* @see template_preprocess_views_view_row_rss()
*/
#}
<item>
<title>{{ title }}</title>
<link>{{ link }}</link>
<description>{{ description }}</description>
{{ item_elements }}
</item>
{#
/**
* @file
* Theme override for feed displays that use the RSS style.
*
* Available variables:
* - link: The link to the feed (the view path).
* - namespaces: The XML namespaces (added automatically).
* - title: The title of the feed (as set in the view).
* - description: The feed description (from feed settings).
* - langcode: The language encoding.
* - channel_elements: The formatted channel elements.
* - items: The feed items themselves.
*
* @see template_preprocess_views_view_rss()
*/
#}
<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0" xml:base="{{ link }}"{{ namespaces }}>
<channel>
<title>{{ title }}</title>
<link>{{ link }}</link>
<description>{{ description }}</description>
<language>{{ langcode }}</language>
{{ channel_elements }}
{{ items }}
</channel>
</rss>
{#
/**
* @file
* Theme override for unformatted summary links.
*
* Available variables:
* - rows: The rows contained in this view.
* - url: The URL to this row's content.
* - count: The number of items this summary item represents.
* - separator: A separator between each row.
* - attributes: HTML attributes for a row.
* - active: A flag indicating whether the row is active.
* - options: Flags indicating how each row should be displayed. This contains:
* - count: A flag indicating whether the row's 'count' should be displayed.
* - inline: A flag indicating whether the item should be wrapped in an inline
* or block level HTML element.
*
* @see template_preprocess_views_view_summary_unformatted()
*/
#}
{% for row in rows %}
{{ options.inline ? '<span' : '<div' }} class="views-summary views-summary-unformatted">
{% if row.separator -%}
{{ row.separator }}
{%- endif %}
<a href="{{ row.url }}"{{ row.attributes.addClass(row.active ? 'is-active') }}>{{ row.link }}</a>
{% if options.count %}
({{ row.count }})
{% endif %}
{{ options.inline ? '</span>' : '</div>' }}
{% endfor %}
{#
/**
* @file
* Theme override to display a list of summary lines.
*
* Available variables:
* - rows: The rows contained in this view.
* Each row contains:
* - url: The summary link URL.
* - link: The summary link text.
* - count: The number of items under this grouping.
* - attributes: HTML attributes to apply to each row.
* - active: A flag indicating whtether the row is active.
* - options: Flags indicating how the summary should be displayed.
* This contains:
* - count: A flag indicating whether the count should be displayed.
*
* @see template_preprocess_views_view_summary()
*/
#}
<div class="item-list">
<ul class="views-summary">
{% for row in rows %}
<li><a href="{{ row.url }}"{{ row.attributes.addClass(row.active ? 'is-active') }}>{{ row.link }}</a>
{% if options.count %}
({{ row.count }})
{% endif %}
</li>
{% endfor %}
</ul>
</div>
{#
/**
* @file
* Theme override for displaying a view as a table.
*
* Available variables:
* - attributes: Remaining HTML attributes for the element.
* - class: HTML classes that can be used to style contextually through CSS.
* - title : The title of this group of rows.
* - header: The table header columns.
* - attributes: Remaining HTML attributes for the element.
* - content: HTML classes to apply to each header cell, indexed by
* the header's key.
* - default_classes: A flag indicating whether default classes should be
* used.
* - caption_needed: Is the caption tag needed.
* - caption: The caption for this table.
* - accessibility_description: Extended description for the table details.
* - accessibility_summary: Summary for the table details.
* - rows: Table row items. Rows are keyed by row number.
* - attributes: HTML classes to apply to each row.
* - columns: Row column items. Columns are keyed by column number.
* - attributes: HTML classes to apply to each column.
* - content: The column content.
* - default_classes: A flag indicating whether default classes should be
* used.
* - responsive: A flag indicating whether table is responsive.
* - sticky: A flag indicating whether table header is sticky.
*
* @see template_preprocess_views_view_table()
*/
#}
{%
set classes = [
'views-table',
'views-view-table',
'cols-' ~ header|length,
responsive ? 'responsive-enabled',
sticky ? 'sticky-enabled',
]
%}
<table{{ attributes.addClass(classes) }}>
{% if caption_needed %}
<caption>
{% if caption %}
{{ caption }}
{% else %}
{{ title }}
{% endif %}
{% if (summary is not empty) or (description is not empty) %}
<details>
{% if summary is not empty %}
<summary>{{ summary }}</summary>
{% endif %}
{% if description is not empty %}
{{ description }}
{% endif %}
</details>
{% endif %}
</caption>
{% endif %}
{% if header %}
<thead>
<tr>
{% for key, column in header %}
{% if column.default_classes %}
{%
set column_classes = [
'views-field',
'views-field-' ~ fields[key],
]
%}
{% endif %}
<th{{ column.attributes.addClass(column_classes) }} scope="col">
{{ column.content }}
</th>
{% endfor %}
</tr>
</thead>
{% endif %}
<tbody>
{% for row in rows %}
<tr{{ row.attributes }}>
{% for key, column in row.columns %}
{% if column.default_classes %}
{%
set column_classes = [
'views-field'
]
%}
{% for field in column.fields %}
{% set column_classes = column_classes|merge(['views-field-' ~ field]) %}
{% endfor %}
{% endif %}
<td{{ column.attributes.addClass(column_classes) }}>
{{ column.content }}
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
{#
/**
* @file
* Theme override to display a view of unformatted rows.
*
* Available variables:
* - title: The title of this group of rows. May be empty.
* - rows: A list of the view's row items.
* - attributes: The row's HTML attributes.
* - content: The row's content.
* - view: The view object.
* - default_row_class: A flag indicating whether default classes should be
* used on rows.
*
* @see template_preprocess_views_view_unformatted()
*/
#}
{% if title %}
<h3>{{ title }}</h3>
{% endif %}
{% for row in rows %}
{%
set row_classes = [
default_row_class ? 'views-row',
]
%}
<div{{ row.attributes.addClass(row_classes) }}>
{{ row.content }}
</div>
{% endfor %}
{#
/**
* @file
* Theme override for a main view template.
*
* Available variables:
* - attributes: Remaining HTML attributes for the element.
* - css_name: A css-safe version of the view name.
* - css_class: The user-specified classes names, if any.
* - header: The optional header.
* - footer: The optional footer.
* - rows: The results of the view query, if any.
* - empty: The content to display if there are no rows.
* - pager: The optional pager next/prev links to display.
* - exposed: Exposed widget form/info to display.
* - feed_icons: Optional feed icons to display.
* - more: An optional link to the next page of results.
* - title: Title of the view, only used when displaying in the admin preview.
* - title_prefix: Additional output populated by modules, intended to be
* displayed in front of the view title.
* - title_suffix: Additional output populated by modules, intended to be
* displayed after the view title.
* - attachment_before: An optional attachment view to be displayed before the
* view content.
* - attachment_after: An optional attachment view to be displayed after the
* view content.
* - dom_id: Unique id for every view being printed to give unique class for
* Javascript.
*
* @see template_preprocess_views_view()
*/
#}
{%
set classes = [
'view',
'view-' ~ id|clean_class,
'view-id-' ~ id,
'view-display-id-' ~ display_id,
dom_id ? 'view-dom-id-' ~ dom_id,
]
%}
<div{{ attributes.addClass(classes) }}>
{{ title_prefix }}
{% if title %}
{{ title }}
{% endif %}
{{ title_suffix }}
{% if header %}
<div class="view-header">
{{ header }}
</div>
{% endif %}
{% if exposed %}
<div class="view-filters">
{{ exposed }}
</div>
{% endif %}
{% if attachment_before %}
<div class="attachment attachment-before">
{{ attachment_before }}
</div>
{% endif %}
{% if rows %}
<div class="view-content">
{{ rows }}
</div>
{% elseif empty %}
<div class="view-empty">
{{ empty }}
</div>
{% endif %}
{% if pager %}
{{ pager }}
{% endif %}
{% if attachment_after %}
<div class="attachment attachment-after">
{{ attachment_after }}
</div>
{% endif %}
{% if more %}
{{ more }}
{% endif %}
{% if footer %}
<div class="view-footer">
{{ footer }}
</div>
{% endif %}
{% if feed_icons %}
<div class="feed-icons">
{{ feed_icons }}
</div>
{% endif %}
</div>
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