-
Notifications
You must be signed in to change notification settings - Fork 0
/
row-cosmotalks-talks.html
85 lines (71 loc) · 3.11 KB
/
row-cosmotalks-talks.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
{% extends "base.html" %}
{# comment:
For use as a row template for the cosmotalks database.
This is a customized version of the default row.html, which displays the row not in a line but each column
in a vertical format. This is done to better dispaly long data, like notes.
#}
{% block title %}{{ database }}: {{ table }}{% endblock %}
{% block extra_head %}
{{ super() }}
<style>
@media only screen and (max-width: 576px) {
{% for column in columns %}
.rows-and-columns td:nth-of-type({{ loop.index }}):before { content: "{{ column|escape_css_string }}"; }
{% endfor %}
}
</style>
{% endblock %}
{% block body_class %}row db-{{ database|to_css_class }} table-{{ table|to_css_class }}{% endblock %}
{% block nav %}
<p class="crumbs">
<a href="{{ urls.instance() }}">home</a> /
<a href="{{ urls.database(database) }}">{{ database }}</a> /
<a href="{{ urls.table(database, table) }}">{{ table }}</a>
</p>
{{ super() }}
{% endblock %}
{% block content %}
<h1 style="padding-left: 10px; border-left: 10px solid #{{ database_color(database) }}">{{ table }}: {{ ', '.join(primary_key_values) }}</h1>
{% block description_source_license %}{% include "_description_source_license.html" %}{% endblock %}
<p>This data as {% for name, url in renderers.items() %}<a href="{{ url }}">{{ name }}</a>{{ ", " if not loop.last }}{% endfor %}</p>
{# note: commented-out
-----------------------
This next command would output the data in a single row format, but the intent here
is to display each column on a separate line (allowing for a nicer view for long data fields)
{% include custom_table_templates %}
-----------------------
#}
{# custom addition #}
{% for row in display_rows %}
<div>
<p><strong>{{ render_markdown(row["talk"]|e) }}</strong></p>
<p>Series id: {{ row.series }} |
{% set sname = sql("select series from \"series\" where id = ?", [row.series]) %}
<strong>Series name: {{ sname[0].series }} |
<a href="/{{ database }}/{{ table }}?series={{ row.series }}">All Talks in Series</a></p>
<p>Talk Date: {{ row["talkdate"] }}</strong></p>
<p><strong>Related Info: {{ render_markdown(row["related_info"]|e) }}</strong></p>
{% set ytexists = sql("select name from sqlite_master where type='table' and name='ytids'") %}
{% if ytexists %}
{# {% set yid = sql("select ytid from ytids where rowid = ?", [row.rowid]) %} #}
{% set yid = sql("select ytid from ytids where rowid = ?", [row.rowid]) %}
{% if yid %}
<img src="https://img.youtube.com/vi/{{ yid[0].ytid }}/hqdefault.jpg">
{% endif %}
{% endif %}
</div>
{% endfor %}
{# End of custom addition #}
{% if foreign_key_tables %}
<h2>Links from other tables</h2>
<ul>
{% for other in foreign_key_tables %}
<li>
<a href="{{ urls.table(database, other.other_table) }}?{{ other.other_column }}={{ ', '.join(primary_key_values) }}">
{{ "{:,}".format(other.count) }} row{% if other.count == 1 %}{% else %}s{% endif %}</a>
from {{ other.other_column }} in {{ other.other_table }}
</li>
{% endfor %}
</ul>
{% endif %}
{% endblock %}