Adding some extensions and appearance improvements.
This commit is contained in:
parent
ec720743b3
commit
479d8eecc0
13 changed files with 506 additions and 12 deletions
59
templates/contactnova/list.html
Normal file
59
templates/contactnova/list.html
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}List of contacts – {{ app_name }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<p>Showing: <strong>{{ cat }}</strong> · <a href="/kt/new">New contact</a></p>
|
||||
|
||||
<fieldset>
|
||||
<legend>Show by:</legend>
|
||||
<p><strong>Letter</strong>:
|
||||
{% set typ_list = 'ABCDEFGHIJKLMNOPQRSTUVWYZ' %}
|
||||
{% for t in typ_list %}
|
||||
<a href="/kt/{{ t }}">{{ t }}</a> ·
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>
|
||||
<a href="/kt/">All</a> ·
|
||||
<a href="/kt/expired">Expired</a> ·
|
||||
<a href="/kt/ok">Sane</a>
|
||||
</p>
|
||||
</fieldset>
|
||||
|
||||
{% if count > people.count() %}
|
||||
<p>Showing <strong>{{ people.count() }}</strong> people of <strong>{{ count }}</strong> total.</p>
|
||||
{% if count > pageno * 50 %}
|
||||
<p><a href="?page={{ pageno + 1 }}" rel="nofollow">Next page</a>{% if pageno > 1 %} · <a href="?page={{ pageno - 1 }}" rel="nofollow">Prev page</a>{% endif %}</p>
|
||||
{% elif pageno > 1 %}
|
||||
<a href="?page={{ pageno - 1 }}" rel="nofollow">Prev page</a></p>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<p><strong>{{ count }}</strong> people.</p>
|
||||
{% endif %}
|
||||
|
||||
<table class="contactnova-list">
|
||||
<thead>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for p in people %}
|
||||
<tr class="contactnova-status_{{ p.status }}">
|
||||
<td><span class="material-icons">{{ p.status_str() }}</span></td>
|
||||
<td class="contactnova-col-code"><a href="/kt/{{ p.code }}">{{ p.code }}</a></td>
|
||||
<td>{{ p.display_name }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% if count > people.count() %}
|
||||
<p>Showing <strong>{{ people.count() }}</strong> people of <strong>{{ count }}</strong> total.</p>
|
||||
{% if count > pageno * 50 %}
|
||||
<p><a href="?page={{ pageno + 1 }}" rel="nofollow">Next page</a>{% if pageno > 1 %} · <a href="?page={{ pageno - 1 }}" rel="nofollow">Prev page</a>{% endif %}</p>
|
||||
{% elif pageno > 1 %}
|
||||
<a href="?page={{ pageno - 1 }}" rel="nofollow">Prev page</a></p>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<p><strong>{{ count }}</strong> people.</p>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
72
templates/contactnova/new.html
Normal file
72
templates/contactnova/new.html
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Create new contact – {{ app_name }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<form method="POST" class="circles-add-form">
|
||||
{% if returnto %}<input type="hidden" name="returnto" value="{{ returnto }}">{% endif %}
|
||||
{% if not pl %}
|
||||
<div>
|
||||
<label>Letter</label>
|
||||
<select id="ktCodeLetter" name="letter">
|
||||
<option value="-" disabled="" selected="">(Choose)</option>
|
||||
{% set typ_list = 'ABCDEFGHIJKLMNOPQRSTUVWYZ' %}
|
||||
{% for t in typ_list %}
|
||||
<option value="{{ t }}">{{ t }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div>
|
||||
<label>Code</label>
|
||||
<strong id="ktNewCode">---</strong>
|
||||
</div>
|
||||
<div>
|
||||
<label>Display name</label>
|
||||
<input name="display_name" maxlength="50"{% if pl %} value="{{ pl.display_name }}"{% endif %}>
|
||||
</div>
|
||||
<div>
|
||||
<label>Status</label>
|
||||
<select name="status">
|
||||
{% set statuses = {
|
||||
0: 'Variable',
|
||||
1: 'OK',
|
||||
2: 'Issues',
|
||||
} %}
|
||||
{% for k, v in statuses.items() %}
|
||||
<option value="{{ k }}"{% if pl and pl.status == k %} selected=""{% endif %}>{{ v }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label>Issues</label>
|
||||
<textarea maxlength="500" name="issues">{{ pl and pl.issues }}</textarea>
|
||||
</div>
|
||||
<div>
|
||||
<label>Description</label>
|
||||
<textarea maxlength="5000" name="description">{{ pl and pl.description }}</textarea>
|
||||
</div>
|
||||
<div>
|
||||
<label>Due</label>
|
||||
<input name="due" required="" type="date" value="{{ pl.due if pl else pl_date }}" min="2020-01-01" />
|
||||
</div>
|
||||
<input type="submit" id="ktSubmit" value="Save">
|
||||
</form>
|
||||
|
||||
<script>
|
||||
{% if not pl %}
|
||||
ktSubmit.disabled = true;
|
||||
{% endif %}
|
||||
ktCodeLetter.onchange = function(){
|
||||
let x = new XMLHttpRequest;
|
||||
x.open('GET', '/kt/_newcode/' + ktCodeLetter.value);
|
||||
x.onreadystatechange = () => {
|
||||
if (x.readyState === XMLHttpRequest.DONE && x.status == 200) {
|
||||
ktNewCode.textContent = x.responseText;
|
||||
ktSubmit.disabled = false;
|
||||
}
|
||||
};
|
||||
x.send();
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
24
templates/contactnova/single.html
Normal file
24
templates/contactnova/single.html
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Contact {{ p.code }} – {{ app_name }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>{{ p.code }}</h1>
|
||||
|
||||
<p>aka: <strong>{{ p.display_name }}</strong></p>
|
||||
|
||||
{% if p.issues %}
|
||||
<p class="contactnova-issues">{{ p.issues }}</p>
|
||||
{% endif %}
|
||||
|
||||
<p class="contactnova-description">
|
||||
{{ p.description or "No description available." |linebreaks }}
|
||||
</p>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p>Expires: {{ p.due.strftime('%B %-d, %Y') }}</p>
|
||||
|
||||
<p><a href="/kt/">Back</a> · <a href="/kt/edit/{{ p.code }}?returnto=/kt/{{ p.code }}">Edit contact</a></p>
|
||||
|
||||
{% endblock %}
|
||||
Loading…
Add table
Add a link
Reference in a new issue