/
channels.html
74 lines (70 loc) · 2.59 KB
/
channels.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
{% extends "_base.html" %}
{% block title %}
Channels
{% endblock %}
{% block control %}
{% if act_user is none %}
<div>
<button id="addName" class="btn btn-lg btn-primary" data-toggle="modal" data-target="#inputName">
Enter your display name
</button>
</div>
{% else %}
<form class="form-inline" action="{{ url_for('set_channels') }}" method="post">
<div class="form-group">
<label for="new_channel" class="sr-only">Add a channel</label>
<input type="text" name="new_channel" class="form-control" placeholder="Create a new channel">
<label for="add_channel" class="sr-only">Submit</label>
<button id="add_channel" class="btn btn-md btn-primary">Submit</button>
</div>
</form>
{% endif %}
{% endblock %}
{% block disp %}
{% if act_user is none %}
<div id="inputName" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<form action="{{ url_for('login') }}" method="post">
<div class="modal-header"><label for="displayName">Your display name</label></div>
<div class="modal-body">
<input type="text" id="displayName" name="displayName" class="form-control validate" placeholder="Your display name">
</div>
<div class="modal-footer"><button type="submit" class="btn btn-lg btn-primary">Submit</button></div>
</form>
</div>
</div>
</div>
{% else %}
<table id="tbl_channels" class="table table-striped table-hover table-responsive" cellspacing="0" width="80%">
<thead>
<tr><th class="th-sm">The latest channel you accessed</th></tr>
</thead>
<tbody>
{% if last_visit is not none %}
<tr><td><a href="channel/{{ last_visit }}">{{ last_visit }}</a></td></tr>
{% endif %}
</tbody>
</table>
<table id="tbl_channels" class="table table-striped table-hover table-responsive" cellspacing="0" width="80%">
<thead>
<tr>
<th class="th-sm">Channel</th>
<th class="th-sm">Created at</th>
</tr>
</thead>
<tbody>
{% if channels|length > 0 %}
{% for channel in channels %}
<tr>
<td><a href="{{ url_for('get_channel', channel=channel['name']) }}">
{{ channel['name'] }}</a></td>
<td>{{ channel['created'].strftime('%Y-%m-%d %H:%M:%S') }}</td>
</tr>
{% endfor %}
{% endif %}
</tbody>
</table>
{% endif %}
{% endblock %}