Skip to content

Commit

Permalink
Use the article tag to mark an album item
Browse files Browse the repository at this point in the history
  • Loading branch information
markocupic committed Dec 12, 2023
1 parent 72254d5 commit 844f303
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
26 changes: 13 additions & 13 deletions contao/templates/_new/component/_album.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
%}
{% endif %}

<div{{ attrs(album_inner_attributes|default).addClass('gc-album-list-inner') }}>
<article{{ attrs(album_inner_attributes|default).addClass('gc-album-list-inner') }}>
{% block album_figure %}
<div{{ attrs(album_figure_attributes|default).addClass('gc-album-list-figure') }}>
{% if album_href_attributes|default %}
{% if album_href_attributes|default %}
<a{{ album_href_attributes }}>
{% endif %}
{% endif %}
{% if album.figure.build|default %}{% with {figure: album.figure.build} %}{{ block('figure_component') }}{% endwith %}{% endif %}
{% if album_href_attributes|default %}
{% if album_href_attributes|default %}
</a>
{% endif %}
{% endif %}
</div>
{% endblock %}

Expand All @@ -39,46 +39,46 @@
{% endblock %}

{% block album_date %}
<p{{ attrs(album_date_attributes|default).addClass('gc-album-list-date') }}>{{ album.date|date('Y-m-d') }}</p>
<div{{ attrs(album_date_attributes|default).addClass('gc-album-list-date') }}><time datetime="{{ album.datimFormatted }}">{{ album.dateFormatted }}</time></div>
{% endblock %}

{% if album.location|default %}
{% block album_location %}
<p{{ attrs(album_location_attributes|default).addClass('gc-album-list-location') }}>{{ 'GALLERY_CREATOR.location'|trans }}: {{ album.location }}</p>
<div{{ attrs(album_location_attributes|default).addClass('gc-album-list-location') }}>{{ 'GALLERY_CREATOR.location'|trans }}: {{ album.location }}</div>
{% endblock %}
{% endif %}

{% if album.photographer|default %}
{% block album_photographer %}
<p{{ attrs(album_photographer_attributes|default).addClass('gc-album-list-photographer') }}>{{ 'GALLERY_CREATOR.photographerName'|trans }}: {{ album.photographer }}</p>
<div{{ attrs(album_photographer_attributes|default).addClass('gc-album-list-photographer') }}>{{ 'GALLERY_CREATOR.photographerName'|trans }}: {{ album.photographer }}</div>
{% endblock %}
{% endif %}

{% if album.teaser|default %}
{% block album_teaser %}
<p{{ attrs(album_teaser_attributes|default).addClass('gc-album-list-teaser') }}>{{ album.teaser|raw|nl2br }}</p>
<div{{ attrs(album_teaser_attributes|default).addClass('gc-album-list-teaser') }}>{{ album.teaser|raw|nl2br }}</div>
{% endblock %}
{% endif %}

{% if album.pictureCount|default(0) %}
{% block album_picture_count %}
<p{{ attrs(album_picture_count_attributes|default).addClass('gc-album-list-picture-count') }}>{{ album.pictureCount }} {{ 'GALLERY_CREATOR.pictures'|trans }}</p>
<div{{ attrs(album_picture_count_attributes|default).addClass('gc-album-list-picture-count') }}>{{ album.pictureCount }} {{ 'GALLERY_CREATOR.pictures'|trans }}</div>
{% endblock %}
{% endif %}

{% if album.visitors|default(0) %}
{% block album_visitors %}
<p{{ attrs(album_visitors_attributes|default).addClass('gc-album-list-visitors') }}>{{ album.visitors }} {{ 'GALLERY_CREATOR.visitors'|trans }}</p>
<div{{ attrs(album_visitors_attributes|default).addClass('gc-album-list-visitors') }}>{{ album.visitors }} {{ 'GALLERY_CREATOR.visitors'|trans }}</div>
{% endblock %}
{% endif %}

{% if album.hasChildAlbums|default %}
{% block album_child_album_count %}
<p{{ attrs(album_child_album_attributes|default).addClass('gc-album-list-child-album-count') }}>{{ album.childAlbumCount }} {{ 'GALLERY_CREATOR.childAlbums'|trans }}</p>
<div{{ attrs(album_child_album_attributes|default).addClass('gc-album-list-child-album-count') }}>{{ album.childAlbumCount }} {{ 'GALLERY_CREATOR.childAlbums'|trans }}</div>
{% endblock %}
{% endif %}

</div>
</div>
</article>

{% endblock %}
6 changes: 3 additions & 3 deletions contao/templates/_new/component/_album_detail_view.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

{% block album_detail_view %}
{% set album_detail_view_attributes = attrs(album_detail_view_attributes|default).addClass('gc-album-detail-view').set('data-album-level', level) %}
<div{{ album_detail_view_attributes }}>
<article{{ album_detail_view_attributes }}>
<div{{ attrs(album_detail_inner_attributes|default).addClass('gc-album-detail-inner') }}>

{% block album_detail_article_pre %}
Expand Down Expand Up @@ -33,7 +33,7 @@

{% block album_detail_date %}
{% if album.dateFormatted|default %}
<div{{ attrs(album_detail_date_attributes|default).addClass('gc-album-detail-date') }}>{{ album.dateFormatted }}</div>
<div{{ attrs(album_detail_date_attributes|default).addClass('gc-album-detail-date') }}><time datetime="{{ album.datimFormatted }}"></time>{{ album.dateFormatted }}</div>
{% endif %}
{% endblock %}

Expand Down Expand Up @@ -76,7 +76,7 @@
{% endif %}
{% endblock %}
</div>
</div>
</article>

{% block album_detail_script %}
{# Add your javascript here. #}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ public function getAlbumData(GalleryCreatorAlbumsModel $album, ContentModel $con
$arrAlbum['caption'] = $strCaption;
$arrAlbum['markdownCaption'] = $strMarkdown ?: false;
$arrAlbum['dateFormatted'] = Date::parse(Config::get('dateFormat'), $album->date);
$arrAlbum['datimFormatted'] = Date::parse(Config::get('datimFormat'), $album->date);
$arrAlbum['meta'] = new Metadata($arrMeta);
$arrAlbum['href'] = $href;
$arrAlbum['pictureCount'] = $pictureCount;
Expand Down

0 comments on commit 844f303

Please sign in to comment.