/
macros.html
75 lines (66 loc) · 2.38 KB
/
macros.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
{#================ List ================#}
{% macro show_error_list(error) %}
{%- if error -%}
<div class="alert alert-error">
<ul class="errorlist">
{% for err in error %}
<li>{{ err }}</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% endmacro %}
{% macro show_problem_list(problem_list) %}
<table class="table table-striped table-bordered">
<thead>
<tr>
<th style="width:20px; text-align:center; ">#</th>
<th>Title</th>
<th style="width:100px">Short Name</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">1</td>
<td><a href="/problem/1">Hello World</a></td>
<td>helloworld</td>
</tr>
</tbody>
</table>
{% endmacro %}
{% macro show_topic_list(topic_list) %}
{% endmacro %}
{% macro show_contest_list(contest_list) %}
{% endmacro %}
{#================ Form ================#}
{% macro input(name, label, value = '', type = 'TEXT', class = 'input-xlarge', default = '', addon = '') %}
<div class="control-group">
<label class="control-label" for="{{ name }}">{{ label }}</label>
<div class="controls">
{% if addon %}<div class="input-append">{% endif %}
<input name="{{ name }}" class="{{ class }}" type="{{ type }}" {% if value %}value="{{ value }}"{% elif default %}value="{{ default }}"{% endif %}/>
{% if addon %}<span class="add-on">{{ addon }}</span></div>{% endif %}
</div>
</div>
{% endmacro %}
{% macro checkbox(name, label, checked = 0) %}
<div class="control-group">
<label class="control-label" for="{{ name }}"></label>
<div class="controls">
<label class="checkbox"><input type="checkbox" name="{{ name }}" value="1" {% if checked %}checked{% endif %}>{{ label }}</label>
</div>
</div>
{% endmacro %}
{% macro textarea(name, label, value = '', class = 'input-xlarge', style = '') %}
<div class="control-group">
<label class="control-label" for="{{ name }}">{{ label }}</label>
<div class="controls">
<textarea name="{{ name }}" class="{{ class }}" style="{{ style }}">{% if value %}{{ value }}{% endif %}</textarea>
</div>
</div>
{% endmacro %}
{% macro form_actions(submit, class="btn-primary") %}
<div class="form-actions">
<button type="submit" class="btn {{ class }}">{{ submit }}</button>
</div>
{% endmacro %}