Skip to content

Commit

Permalink
fixes #356
Browse files Browse the repository at this point in the history
  • Loading branch information
elizoller committed Oct 1, 2021
1 parent bf673e3 commit a8eb25d
Show file tree
Hide file tree
Showing 6 changed files with 181 additions and 3 deletions.
46 changes: 45 additions & 1 deletion web/themes/custom/asulib_barrio/css/style.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion web/themes/custom/asulib_barrio/css/style.min.css

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions web/themes/custom/asulib_barrio/scss/components/node.scss
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,8 @@
}
#interact, #machine {
margin-top: $xs-padding;
}

.node--type-collection .block-asu-complex-title {
margin-left: -15px;
}
2 changes: 1 addition & 1 deletion web/themes/custom/asulib_barrio/scss/components/page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@
article p {
max-width: 75ch;
max-width: 700px;
}
}
34 changes: 34 additions & 0 deletions web/themes/custom/asulib_barrio/scss/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -246,3 +246,37 @@ article ul:not(.field__items):not(.contextual-links):not(.pagination) {
.page-item {
margin: 0 0.25rem;
}

ul.pagination {
padding-top: $small-padding;
}

.pager__item--next .page-link-icon:after {
display: inline-block;
font-size: inherit;
@include bg-arrow-icon('currentColor', right);
transform: rotate(270deg);
float: right;
height: $uds-component-pager-icon-height;
width: $uds-component-pager-icon-width;
margin-left: $uds-component-pager-icon-margin;
}
.page-item:nth-child(2) .page-link-icon:before {
display: inline-block;
font-size: inherit;
@include bg-arrow-icon('currentColor', left);
transform: rotate(90deg);
float: left;
height: $uds-component-pager-icon-height;
width: $uds-component-pager-icon-width;
margin-right: $uds-component-pager-icon-margin;
}

@media (max-width: 768px) {
.page-link-icon {
height: 35px;
}
.page-link span {
display: none;
}
}
96 changes: 96 additions & 0 deletions web/themes/custom/asulib_barrio/templates/pager.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{#
/**
* @file
* Theme override to display a pager.
*
* Available variables:
* - items: List of pager items.
* The list is keyed by the following elements:
* - first: Item for the first page; not present on the first page of results.
* - previous: Item for the previous page; not present on the first page
* of results.
* - next: Item for the next page; not present on the last page of results.
* - last: Item for the last page; not present on the last page of results.
* - pages: List of pages, keyed by page number.
* Sub-sub elements:
* items.first, items.previous, items.next, items.last, and each item inside
* items.pages contain the following elements:
* - href: URL with appropriate query parameters for the item.
* - attributes: A keyed list of HTML attributes for the item.
* - text: The visible text used for the item link, such as "‹ Previous"
* or "Next ›".
* - current: The page number of the current page.
* - ellipses: If there are more pages than the quantity allows, then an
* ellipsis before or after the listed pages may be present.
* - previous: Present if the currently visible list of pages does not start
* at the first page.
* - next: Present if the visible list of pages ends before the last page.
*
* @see template_preprocess_pager()
*/
#}
{% if items %}
<nav aria-label="{{ heading_id }}">
<h4 id="{{ heading_id }}" class="sr-only">{{ 'Pagination'|t }}</h4>
<ul class="pagination js-pager__items">
{# Print first item if we are not on the first page. #}
{% if items.first %}
<li class="page-item">
<a href="{{ items.first.href }}" title="{{ 'Go to first page'|t }}" {{ items.first.attributes|without('href', 'title') }} class="page-link">
<span aria-hidden="true">{{ items.first.text|replace({"«":""}) }}</span>
<span class="sr-only">{{ 'First page'|t }}</span>
</a>
</li>
{% endif %}
{# Print previous item if we are not on the first page. #}
{% if items.previous %}
<li class="page-item">
<a href="{{ items.previous.href }}" title="{{ 'Go to previous page'|t }}" rel="prev" {{ items.previous.attributes|without('href', 'title', 'rel') }} class="page-link page-link-icon">
<span aria-hidden="true">{{ items.previous.text|replace({"":""})|replace({"ious":""})|trim(" ")|capitalize }}</span>
<span class="sr-only">{{ 'Previous page'|t }}</span>
</a>
</li>
{% endif %}
{# Add an ellipsis if there are further previous pages. #}
{% if ellipses.previous %}
<li class="page-item" role="presentation"><span class="page-link">&hellip;</span></li>
{% endif %}
{# Now generate the actual pager piece. #}
{% for key, item in items.pages %}
<li class="page-item {{ current == key ? 'active' : '' }}">
{% if current == key %}
<span class="page-link">
{{- key -}}
</span>
{% else %}
<a href="{{ item.href }}" title="{{ title }}"{{ item.attributes|without('href', 'title') }} class="page-link">
{{- key -}}
</a>
{% endif %}
</li>
{% endfor %}
{# Add an ellipsis if there are further next pages. #}
{% if ellipses.next %}
<li class="page-item" role="presentation"><span class="page-link">&hellip;</span></li>
{% endif %}
{# Print next item if we are not on the last page. #}
{% if items.next %}
<li class="pager__item--next">
<a href="{{ items.next.href }}" title="{{ 'Go to next page'|t }}" rel="next" {{ items.next.attributes|without('href', 'title', 'rel') }} class="page-link page-link-icon">
<span aria-hidden="true">{{ items.next.text|replace({"":""})|capitalize }}</span>
<span class="sr-only">{{ 'Next page'|t }}</span>
</a>
</li>
{% endif %}
{# Print last item if we are not on the last page. #}
{% if items.last %}
<li class="page-item">
<a href="{{ items.last.href }}" title="{{ 'Go to last page'|t }}" {{ items.last.attributes|without('href', 'title') }} class="page-link">
<span aria-hidden="true">{{ items.last.text|replace({"»":""}) }}</span>
<span class="sr-only">{{ 'Last page'|t }}</span>
</a>
</li>
{% endif %}
</ul>
</nav>
{% endif %}

0 comments on commit a8eb25d

Please sign in to comment.