Complete and total rework ahead.
This commit is contained in:
parent
559fd56f33
commit
e420110fb3
95 changed files with 394 additions and 6351 deletions
16
crudkit/ui/templates/field.html
Normal file
16
crudkit/ui/templates/field.html
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<label for="{{ field_name }}">{{ field_label }}</label>
|
||||
|
||||
{% if field_type == 'select' %}
|
||||
<select name="{{ field_name }}" {%- if not options %}disabled{% endif %}>
|
||||
{% if options %}
|
||||
<option value="">-- Select --</option>
|
||||
{% for opt in options %}
|
||||
<option value="{{ opt.value }}" {% if opt.value|string == value|string %}selected{% endif %}>{{ opt.label }}</option>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<option value="">-- No selection available --</option>
|
||||
{% endif %}
|
||||
</select>
|
||||
{% else %}
|
||||
<input type="text" name="{{ field_name }}" value="{{ value }}">
|
||||
{% endif %}
|
||||
6
crudkit/ui/templates/form.html
Normal file
6
crudkit/ui/templates/form.html
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<form method="POST">
|
||||
{% for field in fields %}
|
||||
{{ render_field(field, values.get(field.name, '')) }}
|
||||
{% endfor %}
|
||||
<button type="submit">Create</button>
|
||||
</form>
|
||||
12
crudkit/ui/templates/table.html
Normal file
12
crudkit/ui/templates/table.html
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<table>
|
||||
{% if objects %}
|
||||
<tr>
|
||||
{% for field in objects[0].__table__.columns %}<th>{{ field.name }}</th>{% endfor %}
|
||||
</tr>
|
||||
{% for obj in objects %}
|
||||
<tr>{% for field in obj.__table__.columns %}<td>{{ obj[field.name] }}</td>{% endfor %}</tr>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<tr><th>No data.</th></tr>
|
||||
{% endif %}
|
||||
</table>
|
||||
Loading…
Add table
Add a link
Reference in a new issue