Last active
July 12, 2016 09:19
-
-
Save kehh/9eeef6e884f6f17174513ccb2ef203b7 to your computer and use it in GitHub Desktop.
drupal carousel view
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# | |
/** | |
* @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 %} | |
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel"> | |
<ol class="carousel-indicators"> | |
{% for row in rows %} | |
{% if loop.first == 1 %} | |
{% set state = 'active' %} | |
{% else %} | |
{% set state = '' %} | |
{% endif %} | |
{% set row_classes = [ | |
default_row_class ? 'views-row', | |
] %} | |
<li{{ row.attributes.addClass(state) }} data-target="#carousel-example-generic" data-slide-to="{{ loop.index0 }}"></li> | |
{% endfor %} | |
</ol> | |
<div class="carousel-inner" role="listbox"> | |
{% for row in rows %} | |
{% set row_classes = [ | |
default_row_class ? 'views-row', | |
] %} | |
{% if loop.index0 == 0 %} | |
{% set state = 'active' %} | |
{% else %} | |
{% set state = '' %} | |
{% endif %} | |
<div class="item {{ state }} item-{{ loop.index0 }}" > | |
<div{{ row.attributes.addClass(row_classes) }}> | |
{{ row.content }} | |
</div> | |
</div> | |
{% endfor %} | |
</div> | |
<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev"> | |
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> | |
<span class="sr-only">Previous</span> | |
</a> | |
<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next"> | |
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span> | |
<span class="sr-only">Next</span> | |
</a> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment