Improvements

This commit is contained in:
Edward Betts 2023-09-15 23:34:41 +05:30
parent 4e5ee195dd
commit a0df624f16
14 changed files with 1021 additions and 59 deletions

25
templates/base.html Normal file
View file

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block title %}Xanadu{% endblock %}</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-4bw+/aepP/YC94hEpVNVgiZdgIC5+VKNBQNGCHeKRQN+PtmoHDEXuppvnDJzQIu9" crossorigin="anonymous">
{% block style %}
{% endblock %}
</head>
<body>
{% block content %}
{% endblock %}
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-HwwvtgBNo3bZJJLYd8oVXjrBZt8cqVSpeBNS5n7C8IVInixGAoxmnlMuBnhbgrkm" crossorigin="anonymous"></script>
{% block scripts %}
{% endblock %}
</body>
</html>

76
templates/conference.html Normal file
View file

@ -0,0 +1,76 @@
{% extends "base.html" %}
{% block title %}{{ item.title }}{% endblock %}
{% block content %}
<div class="container">
<div class="row">
<h1>{{ item.title }}</h1>
<p><a href="{{ url_for("index") }}">home</a></p>
<ul>
<li>start: {{ item.start }}</li>
<li>end: {{ item.end }}</li>
{% if days %}
<li>days: {{ item.days }}</li>
{% endif %}
<li>short name: {{ item.short_name }}</li>
<li>country: {{ item.country or "n/a" }}</li>
</ul>
<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">
{% if event.event_date %}
{{ event.event_date.strftime("%d %b %Y at %H:%M") }}
{% else %}
event date missing
{% endif %}
</h6>
<p class="card-text">
{% if event.url %}
<a href="{{ event.url }}">talk 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">
Speakers:
{% for p in event.people %}
<a href="{{ url_for("person", person_id=p.id) }}">{{ p.name }}</a>
{% endfor %}
</p>
</div>
</div>
{% endfor %}
</div>
</div>
{% endblock %}

55
templates/event.html Normal file
View file

@ -0,0 +1,55 @@
{% extends "base.html" %}
{% block title %}{{ item.name }}{% endblock %}
{% block content %}
<div class="container">
<div class="row">
<h1>{{ item.title }}</h1>
<p><a href="{{ url_for("index") }}">home</a></p>
<div class="card my-2">
<div class="card-body">
<h5 class="card-title">
{% if item.url %}
<a href="{{ item.url }}">{{ item.title }}</a>
{% else %}
{{ item.title }}
{% endif %}
</h5>
<h6 class="card-subtitle mb-2 text-body-secondary">
<a href="{{ url_for("conference_page", short_name=item.conference.short_name) }}">{{ item.conference.title }}</a>
</h6>
{% if item.abstract %}
<p class="card-text">
{% if "<" in item.abstract %}
{{ item.abstract | safe }}
{% else %}
{{ item.abstract }}
{% endif %}
</p>
{% endif %}
<p class="card-text">
{% if "<" in item.description %}
{{ item.description | safe }}
{% else %}
{{ item.description }}
{% endif %}
</p>
<p class="card-text">
Speakers:
{% for p in item.people %}
<a href="{{ url_for("person", person_id=p.id) }}">{{ p.name }}</a>
{% endfor %}
</p>
</div>
</div>
</div>
</div>
{% endblock %}

View file

@ -1,10 +1,50 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title></title>
</head>
{% extends "base.html" %}
{% block title %}Conference archive{% endblock %}
{% block content %}
<div class="container">
<div class="row">
<h1>Conference archive</h1>
<form action="{{ url_for("search_people") }}">
<div class="mb-3">
<label for="q" class="form-label">speaker name</label>
<input type="text" class="form-control" name="q" id="q">
</div>
<button type="submit" class="btn btn-primary">Search</button>
</form>
<ul>
<li>{{ "{:,d}".format(count.conference) }} conferences</li>
<li>{{ "{:,d}".format(count.event) }} talks -
<a href="{{ url_for("events_page") }}">most common titles</a>
</li>
<li>
{{ "{:,d}".format(count.person) }} speakers
<a href="{{ url_for("top_speakers_page") }}">top speakers</a>
</li>
</ul>
<table class="table w-auto">
<tbody>
{% for item in items %}
<tr>
<td>
<a href="{{ url_for("conference_page", short_name=item.short_name) }}">{{ item.title }}</a>
</td>
<td class="text-end">{{ item.start.strftime("%d %b %Y") }}</td>
<td class="text-end">{{ (item.end - item.start).days + 1 }} days</td>
<td class="text-end">{{ item.events.count() }} talks</td>
<td class="text-end">{{ item.people_detail.count() }} speakers</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endblock %}
<body>
</body>
</html>

View file

@ -0,0 +1,46 @@
{% extends "base.html" %}
{% block title %}Conference archive{% endblock %}
{% block content %}
<div class="container">
<div class="row">
<h1>Conference archive</h1>
<form action="{{ url_for("merge") }}">
<div class="mb-3">
<label for="q" class="form-label">speaker name</label>
<input type="text" class="form-control" name="q" id="q" value="{{ search_for }}">
</div>
<button type="submit" class="btn btn-primary">Search</button>
</form>
<p>Found {{ q.count() }} people matching '{{ search_for }}'</p>
<form method="POST">
<input type="hidden" name="q" value="{{search_for }}"/>
{% for item in q %}
<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 %}
&mdash;
<a href="https://www.wikidata.org/wiki/{{ item.wikidata_qid }}">{{ item.wikidata_qid }} on Wikidata</a>
{% endif %}
</label>
</div>
{% endfor %}
<button type="submit" class="btn btn-primary">Merge</button>
</form>
</div>
</div>
{% endblock %}

98
templates/person.html Normal file
View file

@ -0,0 +1,98 @@
{% extends "base.html" %}
{% block title %}{{ item.name }}{% endblock %}
{% block content %}
<div class="container">
<div class="row">
<h1>{{ item.name }}</h1>
<p><a href="{{ url_for("index") }}">home</a></p>
<h3>Conferences</h3>
{% for apperance in item.conferences_association %}
{% set conf = apperance.conference %}
<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" %}
<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">
<div class="mb-3">
<label for="name" class="form-label">Name</label>
<input type="text" class="form-control" name="name" id="name" value="{{ item.name }}">
</div>
<div class="mb-3">
<label for="wikidata_qid" class="form-label">Wikidata QID</label>
<input type="text" class="form-control" name="wikidata_qid" id="wikidata_qid" value="{{ item.wikidata_qid or "" }}">
</div>
<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 %}
</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>
{% endif %}
{% endfor %}
</p>
</div>
</div>
{% endfor %}
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,37 @@
{% extends "base.html" %}
{% block title %}Conference archive{% endblock %}
{% block content %}
<div class="container">
<div class="row">
<h1>Conference archive</h1>
<form action="{{ url_for("events_page") }}">
<div class="mb-3">
<label for="q" class="form-label">event</label>
<input type="text" class="form-control" name="q" id="q" value="{{ search_for }}">
</div>
<button type="submit" class="btn btn-primary">Search</button>
</form>
<p>Found {{ q.count() }} events matching '{{ search_for }}'</p>
<ul>
{% for item in q %}
<li>
<a href="{{ url_for("event_page", event_id=item.id) }}">{{ item.title }}</a>
&mdash;
{{ item.conference.title }}
&mdash;
{% for p in item.people %}
<a href="{{ url_for("person", person_id=p.id) }}">{{ p.name }}</a>
{% endfor %}
</li>
{% endfor %}
</ul>
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,41 @@
{% 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_people") }}">
<div class="mb-3">
<label for="q" class="form-label">speaker name</label>
<input type="text" class="form-control" name="q" id="q" value="{{ search_for }}">
</div>
<button type="submit" class="btn btn-primary">Search</button>
</form>
<p>
Found {{ q.count() }} people matching '{{ search_for }}'
<a href="{{ url_for("merge", q=search_for) }}">merge</a>
</p>
<ul>
{% for item in q %}
<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>
</div>
</div>
{% endblock %}

36
templates/top_events.html Normal file
View file

@ -0,0 +1,36 @@
{% 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>
<h3>Top events</h3>
<form action="{{ url_for("events_page") }}">
<div class="mb-3">
<label for="q" class="form-label">event</label>
<input type="text" class="form-control" name="q" id="q">
</div>
<button type="submit" class="btn btn-primary">Search</button>
</form>
<ul>
{% for event_title, count in top_events %}
<li>
<a href="{{ url_for("events_page", q=event_title) }}">{{ event_title }}</a>
({{ count }})
</li>
{% endfor %}
</ul>
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,37 @@
{% extends "base.html" %}
{% block title %}Conference archive{% endblock %}
{% block content %}
<div class="container">
<div class="row">
<h1>Conference archive</h1>
<form action="{{ url_for("search_people") }}">
<div class="mb-3">
<label for="q" class="form-label">speaker name</label>
<input type="text" class="form-control" name="q" id="q">
</div>
<button type="submit" class="btn btn-primary">Search</button>
</form>
<h3>Top speakers</h3>
<ul>
{% for person, count in top_speakers %}
<li>
<a href="{{ url_for("person", person_id=person.id) }}">{{ person.name }}</a>
({{ count }})
{% if person.wikidata_qid %}
&mdash;
<a href="https://www.wikidata.org/wiki/{{ person.wikidata_qid }}">{{ person.wikidata_qid }} on Wikidata</a>
{% endif %}
</li>
{% endfor %}
</ul>
</div>
</div>
{% endblock %}

33
templates/wikidata.html Normal file
View file

@ -0,0 +1,33 @@
{% extends "base.html" %}
{% block title %}Conference archive{% endblock %}
{% block content %}
<div class="container">
<div class="row">
<h1>Conference archive</h1>
{% for person, count, wikidata_hits in items %}
<div>
<h4><a href="{{ url_for("person", person_id=person.id) }}">{{ person.name }}</a> ({{ count }})</h4>
<ul>
{% for hit in wikidata_hits %}
<li>
<a href="https://www.wikidata.org/wiki/{{ hit.qid }}">{{ hit.qid }}</a>
{{ hit.label }} &mdash; {{ hit.description }}
</li>
{% endfor %}
</ul>
</div>
{% endfor %}
</div>
</div>
{% endblock %}
{% block style %}
<style>
.searchmatch { background: lightgreen }
</style>
{% endblock %}