forked from newtheatre/website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ticket.html
92 lines (87 loc) · 3.26 KB
/
ticket.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
85
86
87
88
89
90
91
92
---
title: ticket
permalink: /ticket
shows_url: /api/shows/
---
<!DOCTYPE html>
<html>
{% include head.html %}
<body>
<div class="container-fluid">
<div class="row">
<div class="col-5">
<img class="img-fluid vh-100" alt="Show poster" id="show_poster" src="{{ site.ticket_baseurl }}/static/images/no_image.png" />
</div>
<div class="col text-center align-center">
<img src="{{ site.baseurl }}/static/images/logos/nt_logo-web.png" class="img-fluid my-4" alt="New Theatre Logo" />
<div id="whats-on"></div>
</div>
</div>
</div>
<script>
$( document ).ready(function() {
$.getJSON("{{ site.ticket_baseurl }}{{ page.shows_url }}").done(function(data){
var the_show = data.results[0];
var show_html = '';
show_html = show_html + '<h1 class="display-2 mb-4">' + the_show.name + '</h1>';
if (the_show.runtime){
show_html += '<h2 class="display-4 my-4"><em>' + the_show.runtime + ' minutes, with'
if (the_show.interval_number > 0){
show_html += ' ' + the_show.interval_number
if (the_show.interval_number > 1){ show_html += ' intervals' }
if (the_show.interval_number == 1){ show_html += ' interval' }
}
else {
show_html += 'out interval'
}
show_html += '</em></h2>';
}
// Todo: Sort warnings alphabetically?
if (the_show.warnings_technical[0] || the_show.warnings_action[0] || the_show.warnings_dialogue[0]) {
show_html += '<h1 class="my-4">Please note, this show contains ';
for (var i = 0; i < the_show.warnings_technical.length; i++) {
show_html += the_show.warnings_technical[i].title.toLowerCase()
if (i < the_show.warnings_technical.length - 1) {
show_html += ', '
}
else if (i == the_show.warnings_technical.length - 1 && the_show.warnings_action[0] || the_show.warnings_dialogue[0]) {
show_html += '; '
}
}
if (the_show.warnings_action[0]) {
show_html += 'scenes featuring '
for (var i = 0; i < the_show.warnings_action.length; i++) {
show_html += the_show.warnings_action[i].title.toLowerCase()
if (i < the_show.warnings_action.length - 1) {
show_html += ', '
}
else if (i == the_show.warnings_action.length - 1 && the_show.warnings_dialogue[0]) {
show_html += '; '
}
}
}
if (the_show.warnings_dialogue[0]) {
show_html += 'discussions/themes of '
for (var i = 0; i < the_show.warnings_dialogue.length; i++) {
show_html += the_show.warnings_dialogue[i].title.toLowerCase()
if (i < the_show.warnings_dialogue.length - 1) {
show_html += ', '
}
}
}
}
else {
show_html += 'There are no warnings for this show'
}
show_html += '.</h1>';
document.getElementById('whats-on').innerHTML = show_html;
if (the_show.small_poster != null){
document.getElementById('show_poster').src = the_show.small_poster;
}
}).fail(function(){
document.getElementById('whats-on').innerHTML = "Unable to load shows";
});
});
</script>
</body>
</html>