Improvements

This commit is contained in:
Edward Betts 2023-09-21 04:59:17 +01:00
parent 77f2baea38
commit 9f3a7995a1
9 changed files with 532 additions and 110 deletions

View file

@ -1,5 +1,28 @@
{% extends "base.html" %}
{% block style %}
<style>
.image-container {
width: 200px; /* Adjust this to your desired square size */
height: 240px; /* Same as width for a square */
display: inline-flex; /* Use inline-flex to display containers horizontally */
margin-right: 10px; /* Add some spacing between images (adjust as needed) */
justify-content: center; /* Horizontally center the content */
align-items: center; /* Vertically center the content */
overflow: hidden; /* Hide overflowing image parts */
}
.image-container img {
max-width: 100%;
max-height: 100%;
object-fit: cover; /* Crop and scale the image to fit the container */
object-position: center; /* Center the cropping horizontally */
}
</style>
{% endblock %}
{% set show_images = True %}
{% block title %}{{ item.title }}{% endblock %}
{% block content %}
@ -8,36 +31,84 @@
<h1>{{ item.title }}</h1>
<p><a href="{{ url_for("index") }}">home</a></p>
<ul>
<li>start: {{ item.start }}</li>
<li>end: {{ item.end }}</li>
<div>
<div>series: {{ item.series.name }}
{% if item.series.wikidata_qid %}
<a href="https://www.wikidata.org/wiki/{{ item.series.wikidata_qid }}">Wikidata</a>
{% endif %}
</div>
<div>start: {{ item.start }}</div>
<div>end: {{ item.end }}</div>
{% if days %}
<li>days: {{ item.days }}</li>
<div>days: {{ item.days }}</div>
{% endif %}
<li>short name: {{ item.short_name }}</li>
<li>country: {{ item.country or "n/a" }}</li>
</ul>
{# <div>short name: {{ item.short_name }}</div> #}
{% if item.venue %}
{% set country = item.venue.city.country %}
<div>
venue: {{ item.venue.name }}
{% if item.venue.wikidata_qid %}
<a href="https://www.wikidata.org/wiki/{{ item.venue.wikidata_qid }}">Wikidata</a>
{% endif %}
</div>
<div>
city: {{ item.venue.city.name }}
{% if item.venue.city.wikidata_qid %}
<a href="https://www.wikidata.org/wiki/{{ item.venue.city.wikidata_qid }}">Wikidata</a>
{% endif %}
</div>
<div>country: {{ country.name }} {{ country.flag }}</div>
{% endif %}
{% if item.wikidata_qid %}
<div>wikidata: <a href="https://www.wikidata.org/wiki/{{ item.wikidata_qid }}">{{ item.wikidata_qid }}</a></div>
{% endif %}
</div>
{% if show_images %}
<div>
{% for person in item.people %}
{% if person.wikidata_photo %}
<span class="image-container">
<a href="{{ url_for("person", person_id=person.id) }}">
<img src="{{ url_for("static", filename=person_image_filename(person.id)) }}" alt="{{ person.name}}" title="{{ person.name}}">
</a>
</span>
{% endif %}
{% endfor %}
</div>
{% endif %}
<h3>Talks</h3>
<p>{{ item.events.count() }} talks</p>
{% for event in item.events %}
<div class="card my-2">
<div class="card-body">
<h5 class="card-title">
<a href="{{ url_for("event_page", event_id=event.id) }}">{{ event.title }}</a>
</h5>
<h6 class="card-subtitle mb-2 text-body-secondary">
<div>
<div>
<p>
🎤
<a href="{{ url_for("event_page", event_id=event.id) }}">{{ event.title }}</a><br>
Speakers:
{% for p in event.people %}
👤
<a href="{{ url_for("person", person_id=p.id) }}">{{ p.name }}</a>
{% endfor %}<br>
{% if event.event_date %}
{{ event.event_date.strftime("%d %b %Y at %H:%M") }}
📅 {{ event.event_date.strftime("%a, %d %b %Y at %H:%M") }}
{% else %}
event date missing
{% endif %}
</h6>
<p class="card-text">
<a class="event-detail-toggle" href="#">show details</a><br>
</p>
<div class="event-detail" id="event_{{event.id }}" style="display:none">
{% if event.url %}
<a href="{{ event.url }}">talk on conference website</a>
<p><a href="{{ event.url }}">talk on conference website</a></p>
{% endif %}
{% if event.abstract %}
@ -60,12 +131,7 @@
</p>
{% endif %}
<p class="card-text">
Speakers:
{% for p in event.people %}
<a href="{{ url_for("person", person_id=p.id) }}">{{ p.name }}</a>
{% endfor %}
</p>
</div>
</div>
</div>
@ -74,3 +140,32 @@
</div>
</div>
{% endblock %}
{% block script %}
<script>
// Get all elements with the class "event-detail-toggle"
var toggleLinks = document.querySelectorAll(".event-detail-toggle");
// Loop through each toggle link and attach a click event handler
toggleLinks.forEach(function(link) {
link.addEventListener("click", function(e) {
e.preventDefault(); // Prevent the default link behavior
// Find the parent div of the clicked link
var parentDiv = this.closest("div");
// Find the element with class "event-detail" inside the parent div
var detailElement = parentDiv.querySelector(".event-detail");
// Toggle the display of the detail element
if (detailElement.style.display === "none" || detailElement.style.display === "") {
detailElement.style.display = "block";
this.textContent = "hide detail"; // Change the link text
} else {
detailElement.style.display = "none";
this.textContent = "show detail"; // Change the link text
}
});
});
</script>
{% endblock %}

View file

@ -33,13 +33,15 @@
{% endif %}
{% if item.description %}
<p class="card-text">
{% if "<" in item.description %}
{% if "<" in item.description %}
{{ item.description | safe }}
{% else %}
{{ item.description }}
{% endif %}
</p>
{% endif %}
<p class="card-text">
Speakers:
{% for p in item.people %}

View file

@ -15,27 +15,49 @@
<button type="submit" class="btn btn-primary">Search</button>
</form>
<div style="margin-bottom:1rem">
👥
{{ "{:,d}".format(count.conference) }} conferences<br/>
🌍
{{ "{:,d}".format(count.country) }} countries<br/>
📍
{{ "{:,d}".format(count.venue) }} venues<br/>
🎤
{{ "{:,d}".format(count.event) }} talks -
<a href="{{ url_for("events_page") }}">most common titles</a><br/>
👤
{{ "{:,d}".format(count.person) }} speakers
<a href="{{ url_for("top_speakers_page") }}">top speakers</a><br/>
</div>
<h2>Conferences</h2>
{% for item in items %}
{% if loop.first or item.start.year != loop.previtem.start.year %}
<h3>{{ item.start.year }}</h3>
{% endif %}
<div style="margin-bottom:1.5rem">
👥
<a href="{{ url_for("conference_page", short_name=item.short_name) }}">{{ item.title }}</a>
📅
{{ item.start.strftime("%d %b %Y") }}
<br/>
{% if item.venue %}
📍
{{ item.venue.name }}
&ndash;
{{ item.venue.city.name }},
{{ item.venue.city.country.name }}
{{ item.venue.city.country.flag }}
<br/>
{% endif %}
{#
{% if item.series %}
📃 Series: {{ item.series.name }}
<br/>
{% endif %}
#}
{{ (item.end - item.start).days + 1 }} days,
{{ item.events.count() }} talks,

View file

@ -25,7 +25,6 @@
<div class="form-check">
<input class="form-check-input" type="checkbox" name="person_id" value="{{ item.id }}" id="person{{ item.id }}">
<label class="form-check-label" for="person{{ item.id }}">
{{ item.id }}
<a href="{{ url_for("person", person_id=item.id) }}">{{ item.name }}</a>
{% if item.wikidata_qid %}
@ -33,6 +32,10 @@
<a href="https://www.wikidata.org/wiki/{{ item.wikidata_qid }}">{{ item.wikidata_qid }} on Wikidata</a>
{% endif %}
</label>
<input class="form-check-input" type="radio" name="name" value="{{ item.id }}" id="name{{ item.id }}">
<label class="form-check-label" for="name{{ item.id }}">use this name</label><br>
{% for conf in item.conferences %} 👥{{ conf.title }}{% endfor %}
</div>
{% endfor %}

View file

@ -6,25 +6,24 @@
<div class="container">
<div class="row">
<h1>{{ item.name }}</h1>
<p><a href="{{ url_for("index") }}">home</a></p>
<p>
👥 {{ plural(item.conference_count, "conference") }}<br/>
🎤 {{ plural(item.event_count, "talk") }}<br/>
{% set start, end = item.active_years() %}
📅 Years active: {{ start.year }} to {{end.year }}
{% if item.wikidata_qid %}
<br/>
📊 Wikidata: <a href="https://www.wikidata.org/wiki/{{ item.wikidata_qid }}">{{ item.wikidata_qid }}</a>
{% endif %}
</p>
<h3>Conferences</h3>
{% for apperance in item.conferences_association %}
{% set conf = apperance.conference %}
{% if item.wikidata_photo %}
<img src="{{ url_for("static", filename="wikidata_photo/thumb/" + item.wikidata_photo.0) }}">
{% endif %}
<div class="card my-2">
<div class="card-body">
<h5 class="card-title">{{ conf.id }}: {{ conf.title }}</h5>
<p class="card-text">
{% if apperance.bio %}{{ apperance.bio | safe }}{% else %}No speaker biography.{% endif %}
</p>
</div>
</div>
{% endfor %}
{% set search_for = '"' + item.name + '" ' + " haswbstatement:P31=Q5" %}
{% set search_for = item.name + ' ' + " haswbstatement:P31=Q5" %}
<p><a href="https://www.wikidata.org/w/index.php?search={{ search_for | urlencode }}&title=Special%3ASearch&ns0=1&ns120=1">Search for {{ item.name }} on Wikidata</a></p>
<form method="POST">
@ -39,60 +38,111 @@
<button type="submit" class="btn btn-primary">Submit</button>
</form>
<h3>Talks</h3>
<p>Has {{ item.events_association.count() }} events</p>
{% for event in item.events_by_time() %}
<div class="card my-2">
<div class="card-body">
<h5 class="card-title">
<a href="{{ url_for("event_page", event_id=event.id) }}">{{ event.title }}</a>
</h5>
<h6 class="card-subtitle mb-2 text-body-secondary">
{{ event.conference.title }}
&mdash;
{% if event.event_date %}
{{ event.event_date.strftime("%d %b %Y") }}
{% else %}
event date missing
{% endif %}
<form method="POST" action="{{ url_for("delete_person", person_id=item.id) }}">
<button type="submit" class="btn btn-primary">delete</button>
</form>
</h6>
<p class="card-text">
{% if event.url %}
<a href="{{ event.url }}">{{ event.title }} on conference website</a>
{% endif %}
{% if event.abstract %}
<p class="card-text">
{% if "<" in event.abstract %}
{{ event.abstract | safe }}
{% else %}
{{ event.abstract }}
{% endif %}
</p>
{% endif %}
{% if event.description %}
<p class="card-text">
{% if "<" in event.description %}
{{ event.description | safe }}
{% else %}
{{ event.description }}
{% endif %}
</p>
{% endif %}
<p class="card-text">
{% for p in event.people %}
{% if p.id != item.id %}
<a href="{{ url_for(request.endpoint, person_id=p.id) }}">{{ p.name }}</a>
{% for apperance in item.conference_by_time() %}
{% set conf = apperance.conference %}
<div>
<h3>👥 {{ conf.title }}
<small>📅 {{ conf.start.strftime("%d %b %Y") }}</small>
</h3>
{% if apperance.bio %}<p>Biography: {{ apperance.bio | safe }}</p>{% endif %}
</div>
{% for event in apperance.events %}
<div>
<h4>
🎤
<a href="{{ url_for("event_page", event_id=event.id) }}">{{ event.title }}</a>
<small>
{% if event.event_date %}
{{ event.event_date.strftime("%d %b %Y") }}
{% else %}
event date missing
{% endif %}
{% endfor %}
</p>
</div>
</div>
<a class="event-detail-toggle" href="#">show details</a>
</small>
</h4>
<div class="event-detail" id="event_{{event.id }}" style="display:none">
<p>
{% if event.url %}
<a href="{{ event.url }}">talk on conference website</a>
{% endif %}
<p>
{% if event.abstract %}
<div>
{% if "<" in event.abstract %}
{{ event.abstract | safe }}
{% else %}
{{ event.abstract }}
{% endif %}
</div>
{% endif %}
{% if event.description %}
<div>
{% if "<" in event.description %}
{{ event.description | safe }}
{% else %}
{{ event.description }}
{% endif %}
</div>
{% endif %}
<div>
{% for p in event.people %}
{% if p.id != item.id %}
<a href="{{ url_for(request.endpoint, person_id=p.id) }}">{{ p.name }}</a>
{% endif %}
{% endfor %}
</div>
</div>
</div>
{% endfor %}
{% endfor %}
</div>
</div>
{% endblock %}
{% block script %}
<script>
// Get all elements with the class "event-detail-toggle"
var toggleLinks = document.querySelectorAll(".event-detail-toggle");
// Loop through each toggle link and attach a click event handler
toggleLinks.forEach(function(link) {
link.addEventListener("click", function(e) {
e.preventDefault(); // Prevent the default link behavior
// Find the parent div of the clicked link
var parentDiv = this.closest("div");
// Find the element with class "event-detail" inside the parent div
var detailElement = parentDiv.querySelector(".event-detail");
// Toggle the display of the detail element
if (detailElement.style.display === "none" || detailElement.style.display === "") {
detailElement.style.display = "block";
this.textContent = "hide detail"; // Change the link text
} else {
detailElement.style.display = "none";
this.textContent = "show detail"; // Change the link text
}
});
});
</script>
{% endblock %}

View file

@ -0,0 +1,97 @@
{% extends "base.html" %}
{% block title %}Conference archive{% endblock %}
{% block content %}
<div class="container">
<div class="row">
<h1>Conference archive</h1>
<p><a href="{{ url_for("index") }}">home</a></p>
<form action="{{ url_for("search_everything") }}">
<div class="mb-3">
<input type="text" class="form-control" name="q" id="q" value="{{ search_for }}">
</div>
<button type="submit" class="btn btn-primary">Search</button>
</form>
{% if search_for %}
<h3>Talks</h3>
<p>Found {{ events.count() }} events matching '{{ search_for }}'</p>
{% for event in events %}
<div>
<p>
🎤
<a href="{{ url_for("event_page", event_id=event.id) }}">{{ event.title }}</a><br>
Speakers:
{% for p in event.people %}
👤
<a href="{{ url_for("person", person_id=p.id) }}">{{ p.name }}</a>
{% endfor %}<br>
👥 <a href="{{ url_for("conference_page", short_name=event.conference.short_name) }}">{{ event.conference.title }}</a><br>
{% if event.event_date %}
📅 {{ event.event_date.strftime("%a, %d %b %Y at %H:%M") }}
{% else %}
event date missing
{% endif %}
</p>
{% if event.abstract %}
<p class="card-text">
{% if "<" in event.abstract %}
{{ event.abstract | safe }}
{% else %}
{% for line in event.abstract.splitlines() %}
{{ line }}<br>
{% endfor %}
{% endif %}
</p>
{% endif %}
{% if event.description and event.description != event.abstract %}
<p class="card-text">
{% if "<" in event.description %}
{{ event.description | safe }}
{% else %}
{% for line in event.description.splitlines() %}
{{ line }}<br>
{% endfor %}
{% endif %}
</p>
{% endif %}
</div>
{% endfor %}
<h3>People</h3>
<p>
Found {{ people.count() }} people matching '{{ search_for }}'
</p>
<ul>
{% for item in people %}
<li>
<a href="{{ url_for("person", person_id=item.id) }}">{{ item.name }}</a>
{% if item.wikidata_qid %}
&mdash;
<a href="https://www.wikidata.org/wiki/{{ item.wikidata_qid }}">{{ item.wikidata_qid }} on Wikidata</a>
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
</div>
</div>
{% endblock %}

View file

@ -3,8 +3,6 @@
{% block title %}Conference archive{% endblock %}
{% block content %}
<div class="container">
<div class="row">
<h1>Conference archive</h1>
<form action="{{ url_for("search_people") }}">
@ -15,23 +13,31 @@
<button type="submit" class="btn btn-primary">Search</button>
</form>
<h3>Speaker/conference frequency distribution</h3>
<p>Distribution of speakers by conference count.</p>
{% for conf_count, speaker_count in speaker_counts %}
<div>
{{ plural(conf_count, "conference") }}:
{{ plural(speaker_count, "speaker") }}
</div>
{% endfor %}
<h3>Top speakers</h3>
<ul>
{% for person, count in top_speakers %}
<li>
<div>
👤
<a href="{{ url_for("person", person_id=person.id) }}">{{ person.name }}</a>
({{ count }})
({{ count }} conferences, {{ person.event_count }} talks)
{% if person.wikidata_photo %}📷{% endif %}
{% if person.wikidata_qid %}
&mdash;
<a href="https://www.wikidata.org/wiki/{{ person.wikidata_qid }}">{{ person.wikidata_qid }} on Wikidata</a>
<a href="https://www.wikidata.org/wiki/{{ person.wikidata_qid }}">Wikidata</a>
{% endif %}
</li>
</div>
{% endfor %}
</ul>
</div>
</div>
{% endblock %}