Commit cbcbec67 authored by ancoats's avatar ancoats
Browse files

Add by group (user) filtering to Events

parent 3204042c
fieldLayouts:
fd7fb4ad-ea08-45f6-b0a6-4c0b495927d3:
tabs:
-
elements:
-
autocapitalize: true
autocomplete: false
autocorrect: true
class: null
disabled: false
id: null
instructions: null
label: null
max: null
min: null
name: null
orientation: null
placeholder: null
readonly: false
requirable: false
size: null
step: null
tip: null
title: null
type: craft\fieldlayoutelements\TitleField
warning: null
width: 100
name: Content
sortOrder: 1
handle: categoriesWorkingGroups
name: 'Working groups'
siteSettings:
0211ae0a-98a7-4b79-96d0-334ecd7a80d6:
hasUrls: false
template: null
uriFormat: null
039dabba-4285-4138-804a-730a8eb3718a:
hasUrls: false
template: null
uriFormat: null
784e880e-a333-4497-a19a-e2b53a38ef45:
hasUrls: false
template: null
uriFormat: null
840e993f-174d-4c91-a9f9-d4d5dd903848:
hasUrls: false
template: null
uriFormat: null
structure:
maxLevels: 1
uid: 8da69437-a29c-46b2-8319-f6edf8243f2a
......@@ -109,7 +109,7 @@ fieldLayouts:
warning: null
width: 100
-
fieldUid: b55bf695-8fe1-4354-8a43-b6179b8f039d
fieldUid: 344b779e-5b71-4cf1-9e6e-c78401390d6b
instructions: ''
label: ''
required: '1'
......
contentColumnType: string
fieldGroup: 1096ed9e-467c-4123-8f70-ff839cca7909
handle: categoryWorkingGroup
instructions: ''
name: 'Working group'
searchable: false
settings:
allowLimit: false
allowMultipleSources: false
allowSelfRelations: false
branchLimit: '1'
limit: null
localizeRelations: false
selectionLabel: ''
showSiteMenu: true
source: 'group:41e53dbf-7a4c-4579-8064-5ada25223533'
sources: '*'
targetSiteId: null
validateRelatedElements: false
viewMode: null
translationKeyFormat: null
translationMethod: site
type: craft\fields\Categories
dateModified: 1611941399
dateModified: 1611948705
email:
fromEmail: it@extinctionrebellion.be
fromName: 'Extinction Rebellion Belgium'
......
siteUid: 0211ae0a-98a7-4b79-96d0-334ecd7a80d6
sortOrder: 6
template: _page-templates/template-user-events
uriParts:
- evenements/u/
-
- '*'
- '[^\/]+'
uriPattern: 'evenements/u/<any:[^\/]+>'
siteUid: 039dabba-4285-4138-804a-730a8eb3718a
sortOrder: 8
template: _page-templates/template-user-events
uriParts:
- veranstaltungen/u/
-
- '*'
- '[^\/]+'
uriPattern: 'veranstaltungen/u/<any:[^\/]+>'
siteUid: 784e880e-a333-4497-a19a-e2b53a38ef45
sortOrder: 5
template: _page-templates/template-user-events
uriParts:
- events/u/
-
- '*'
- '[^\/]+'
uriPattern: 'events/u/<any:[^\/]+>'
siteUid: 840e993f-174d-4c91-a9f9-d4d5dd903848
sortOrder: 7
template: _page-templates/template-user-events
uriParts:
- evenementen/u/
-
- '*'
- '[^\/]+'
uriPattern: 'evenementen/u/<any:[^\/]+>'
......@@ -21,11 +21,20 @@
{% endfor %}
{% endblock %}
{% endembed %}
{% include '_partials/components/template-archive/section-categories.twig' with {
{% include '_partials/components/template-archive/filter-categories.twig' with {
heading: 'Filter events by category'|t,
categories: craft.categories()
.group('categoriesEvents')
.relatedTo(queryEntries)
.orderBy('title asc')
.all()
} %}
{% include '_partials/components/template-archive-events/filter-users.twig' with {
heading: 'Filter events by group'|t,
users: craft.users()
.group(['pseudonyms', 'collectives', 'localGroups'])
.relatedTo(queryEntries)
.orderBy('userNamePublic asc')
.all()
} %}
{% embed '_partials/components/default/entries-list.twig' with {
......
......@@ -14,7 +14,7 @@
displayMode: 'grid',
entries: queryEntries.limit(entriesPerPage).all()
} %}
{% include '_partials/components/template-archive/section-categories.twig' with {
{% include '_partials/components/template-archive/filter-categories.twig' with {
heading: 'Filter news by category'|t,
categories: craft.categories()
.group('categoriesNews')
......
......@@ -28,7 +28,7 @@
{% endfor %}
{% endblock %}
{% endembed %}
{% include '_partials/components/template-archive/section-categories.twig' with {
{% include '_partials/components/template-archive/filter-categories.twig' with {
heading: 'Filter posts by category'|t,
categories: craft.categories()
.group('categoriesPosts')
......
{% extends '_page-templates/template-category.twig' %}
{% set templateClass = 'template-category template-category-events' %}
{% set username = craft.app.request.getSegment(3) %}
{% set user = craft.users()
.group(['pseudonyms', 'collectives', 'localGroups'])
.username(username)
.first() %}
{% set queryEntries = craft.entries()
.section('events')
.relatedTo(user)
.datetimeStart('> ' ~ now | date('c'))
.orderBy('datetimeStart asc') %}
{% set entriesPerPage = 6 %}
{% set limitedEntries = clone(queryEntries).offset(entriesPerPage).limit(entriesPerPage) %}
{% paginate limitedEntries as pageData, pageEntries %}
{% set breadcrumb = craft.entries()
.section('archiveEvents')
.all() %}
{% block content %}
{% include '_partials/components/default/page-header.twig' %}
{% if isPageFirst %}
{% embed '_partials/components/default/entries-grid.twig' with {
entries: queryEntries.limit(entriesPerPage).all()
} %}
{% block loop %}
{% for entry in entries %}
{% include '_partials/components/template-entry-event/entry-card.twig' %}
{% endfor %}
{% endblock %}
{% endembed %}
{% endif %}
{% embed '_partials/components/default/entries-list.twig' with {
class: (isPageFirst ? 'u-background-color-blue-lazuli u-color-white'),
heading: (isPageFirst ? 'More upcoming events'|t),
entries: pageEntries
} %}
{% block loop %}
{% for entry in entries %}
{% include '_partials/components/template-archive-events/entry-list-item.twig' %}
{% endfor %}
{% endblock %}
{% block pagination %}
{% include '_partials/components/shared/pagination.twig' with {
data: pageData
} %}
{% endblock %}
{% endembed %}
{% endblock %}
{% block prefooter %}
{% block a %}
{{ parent() }}
{% endblock %}
{% block b %}
{{ parent() }}
{% endblock %}
{% block c %}
{% set page = craft.entries.section('archiveEvents').one() %}
{% include '_partials/components/shared/tile.twig' with {
tileButtonURL: page.url,
tileButtonLabel: 'Events calendar'|t,
tileTheme: 'orchid'
} %}
{% endblock %}
{% endblock %}
......@@ -12,15 +12,13 @@
{% endif %}
<li class="c-breadcrumb__item is-current">
{% if entry is defined %}
<a href="{{ entry.url }}" aria-current="page">{{ entry.title }}</a>
<a href="{{ craft.app.request.absoluteUrl }}" aria-current="page">{{ entry.title }}</a>
{% elseif category is defined %}
<a href="{{ category.url }}" aria-current="page">{{ 'Category'|t }}&#58;&nbsp;{{ category.title }}</a>
<a href="{{ craft.app.request.absoluteUrl }}" aria-current="page">{{ 'Category'|t }}&#58;&nbsp;{{ category.title }}</a>
{% elseif user is defined %}
{% set ancestor = breadcrumb | last %}
{% set user = user | merge({ url: ancestor.url ~ '/' ~ user.username }) %}
<a href="{{ ancestor.url ~ '/' ~ user.username }}" aria-current="page">{{ user.name }}</a>
<a href="{{ craft.app.request.absoluteUrl }}" aria-current="page">{{ user.userNamePublic | default(user.name) }}</a>
{% endif %}
</li>
......
......@@ -2,11 +2,11 @@
{% if (heading is defined and heading) %}<h2 class="c-heading">{{ heading }}</h2>{% endif %}
<ol class="c-list c-list--cluster">
{% for user in users %}
{% set userURLProfile = 'local-groups/{slug}'|t({
{% set url = 'local-groups/{slug}'|t({
slug: user.username
}, 'routes') %}
<li class="c-list__item">
<a class="c-list__item__label" href="{{ userURLProfile }}">{{ user.userNamePublic | default(user.name) }}</a>
<a class="c-list__item__label" href="{{ url(url) }}">{{ user.userNamePublic | default(user.name) }}</a>
{% include '_partials/components/shared/icon-group.twig' with {
icons: {
'website': user.userURL,
......
......@@ -8,8 +8,8 @@
<nav class="c-modal__nav c-nav" aria-label="navigation">
<ul class="c-nav__list">
{% for item in navigation.navigationMain.all() %}
<li class="c-nav__item{% if craft.app.request.absoluteurl == item.url %} is-current{% endif %}">
<a href="{{ item.url }}">{{ item.title }}</a>
<li class="c-nav__item">
<a href="{{ item.url }}"{% if craft.app.request.absoluteUrl == item.url %} aria-current="page"{% endif %}>{{ item.title }}</a>
</li>
{% endfor %}
</ul>
......
......@@ -4,6 +4,6 @@
{%- elseif category is defined -%}
{{ category.title }}
{%- elseif user is defined -%}
{{ user.name }}
{{ user.userNamePublic | default(user.name) }}
{%- endif -%}
</h1>
......@@ -2,8 +2,8 @@
<nav class="c-nav">
<ul class="c-nav__list">
{% for item in navigation.navigationSecondary.all() %}
<li class="c-nav__item{% if craft.app.request.absoluteurl == item.url %} is-current{% endif %}">
<a href="{{ item.url }}">{{ item.title }}</a>
<li class="c-nav__item">
<a href="{{ item.url }}"{% if craft.app.request.absoluteUrl == item.url %} aria-current="page"{% endif %}>{{ item.title }}</a>
</li>
{% endfor %}
</ul>
......
{% if users|length %}
<section class="c-panel u-padding-top-0" id="filter-group">
<div class="container">
<div class="c-meta-item">
{% if (heading is defined and heading) %}
<span class="c-meta-item__heading">{{ heading }}</span>
{% endif %}
{% include '_partials/components/template-archive-events/list-users.twig' with {
users: users
} %}
</div>
</div>
</section>
{% endif %}
{% if users|length %}
<ul class="c-list c-list--terms">
{% for user in users %}
<li class="c-list__item">
{% set url = 'events/u/{slug}'|t({
slug: user.username
}, 'routes') %}
<a class="c-label" href="{{ url(url) }}">{{ user.userNamePublic | default(user.name) }}</a>
</li>
{% endfor %}
</ul>
{% endif %}
{% if categories|length %}
<section class="c-panel u-padding-top-0" id="section-categories">
<section class="c-panel u-padding-top-0" id="filter-categories">
<div class="container">
<div class="c-meta-item">
{% if (heading is defined and heading) %}
<span class="c-meta-item__heading">{{ heading }}</span>
{% endif %}
{% include '_partials/components/shared/list-categories' with {
{% include '_partials/components/shared/list-categories.twig' with {
categories: categories
} %}
</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