Skip to content

Commit

Permalink
Introduce topiclists
Browse files Browse the repository at this point in the history
Add components to allow lists of distinct sessions/talks.
viewMode for these topiclists is dw:Topiclist
Update layout to select topiclist component if specified in model.
  • Loading branch information
splattater committed Jan 18, 2024
1 parent 1f7ab95 commit d7dd7bc
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 0 deletions.
59 changes: 59 additions & 0 deletions _includes/components/program_topic.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{% include strings.html %}
{%- assign title = include.title -%}
{%- assign view = include.view -%}

{% capture session_query %}
SELECT DISTINCT ?session
WHERE {
{
?session dct:title "{{- title -}}"@en ;
schema:location ?location ;
dct:date ?date ;
FILTER ({{ view.filter }})
}
} ORDER BY ?date ?start ?end ?location
{% endcapture %}

{% capture metainformation_query %}
SELECT DISTINCT ?start ?end ?location
WHERE {
{
?session dct:title "{{- title -}}"@en ;
schema:location ?location ;
dct:date ?date ;
schema:startTime ?start ;
schema:endTime ?end .
FILTER ({{ view.filter }})
}
} ORDER BY ?date ?start ?end ?location
{% endcapture %}

{% assign sessions = view.resource | sparql_query: session_query %}

{%- if sessions.first -%}
{%- assign title = sessions.first.session | rdf_property: "dct:title", site.language -%}
{% assign metainformation = sessions.first.session | sparql_query: metainformation_query %}
{%- assign description = sessions.first.session | rdf_property: "dct:description", site.language -%}
<section class="timetable-unit" id="topic">
<header>
<h3>
{{ metainformation.first.start | date: "%H:%M" }}
</h3>
</header>
<div>
<h4>
{{ title }}
</h4>
{%- for metadata in metainformation -%}
{%- assign location_title = metadata.location | rdf_property: "dct:title", site.language -%}
{%- unless location_title -%}
{%- assign location_title = metadata.location | rdf_property: "dct:title" -%}
{%- endunless -%}
<p class="meta">
<time datetime="{{ metadata.start | date: "%H:%M" }}">{{ metadata.start | date: "%H:%M" }}</time> - <time datetime="{{ metadata.end | date: "%H:%M" }}">{{ metadata.end | date: "%H:%M" }}</time> <span>|</span> {{ location_title }} <span>|</span> {% include components/available_language.html resource=sessions.first.session %}
</p>
{%- endfor -%}
<p>{{- description -}}</p>
</div>
</section>
{%- endif -%}
32 changes: 32 additions & 0 deletions _includes/components/program_view_topiclist.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{% assign view = include.view %}

{% capture sessions_query %}
SELECT DISTINCT ?title # (min(?q_session) as ?session)
WHERE {
{
?resourceUri schema:subEvent ?q_session ;
} union {
?resourceUri schema:subEvent ?subEvent .
?subEvent schema:subEvent ?q_session .
}
?q_session dct:title ?title ;
schema:startTime ?start .
{
?q_session schema:location ?location ;
dct:date ?date .
FILTER NOT EXISTS {?q_session site:track ?pause }
FILTER ({{ view.filter }})
} FILTER(lang(?title) = "en")
} ORDER BY ?start
#} GROUP BY ?title ORDER BY ?start # GROUP BY does not work ruby
{% endcapture %}

{% assign sessions = view.resource | sparql_query: sessions_query %}

{%- if sessions.first -%}
{%- for session_row in sessions -%}
{%- include components/program_topic.html title=session_row.title view=view-%}
{%- endfor -%}
{%- else -%}
{%- assign program_empty = true -%}
{%- endif -%}
3 changes: 3 additions & 0 deletions _layouts/program_view.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
{% assign baseMenuResource = page.rdf | rdf_property: "dw:menuResource" %}
{% assign dwTable = "dw:Table" | rdf_get %}
{% assign dwList = "dw:List" | rdf_get %}
{% assign dwTopiclist = "dw:Topiclist" | rdf_get %}

{% if baseMenuResource %}
{% assign baseEventResource = baseMenuResource %}
Expand Down Expand Up @@ -55,6 +56,8 @@
{%- include components/program_view_list.html view=view -%}
{%- elsif mode == dwTable -%}
{%- include components/program_view_table.html view=view -%}
{%- elsif mode == dwTopiclist -%}
{%- include components/program_view_topiclist.html view=view -%}
{%- endif -%}

{%- if program_empty -%}
Expand Down

0 comments on commit d7dd7bc

Please sign in to comment.