code: rudimentary implementation of detail and create

This commit is contained in:
2024-01-27 17:42:20 +01:00
parent d1c98516a8
commit c439220409
11 changed files with 236 additions and 68 deletions

View File

@@ -0,0 +1,17 @@
{% extends "admin/base.jinja" %}
{% macro input(name, value="", type="text") -%}
<input type="{{ type }}" name="{{ name }}" value="{{ value }}">
{%- endmacro %}
{% block content %}
Create {{item_model.name}} in {{item_info.name}}
<form>
{% set fields = item_info.display_list %}
{% for field in fields %}
<p><label>{{field}}</label>{{ input(field) }}</p>
{% endfor %}
<input type="submit" name="submit" value="Create">
</form>
{% endblock content %}

View File

@@ -1 +1,11 @@
Item Detail.
{% extends "admin/base.jinja" %}
{% block content %}
{% if item %}
{{item.fields}}
{% else %}
No Item found.
{% endif %}
{% endblock content %}

View File

@@ -16,7 +16,7 @@
{% set primary_key = item_info.lookup_key %}
{% endif %}
<div class="ui short scrolling container">
<div class="ui basic container">
<table class="ui very compact celled table head stuck unstackable">
<caption>{{ item_info.name|none(content) }}</caption>
<thead>
@@ -39,12 +39,11 @@
<tr>
{% for key in item_keys %}
{% if key==primary_key %}
<td class="selectable warning">
<a href="#">{{ item[key] }}</a>
</td>
<td class="selectable warning">{% if item.detail_url %}<a href="{{item.detail_url}}">{{
item.fields[key] }}</a>{%
else %}{{item.fields[key] }}{% endif %}</td>
{% else %}
<td>{{ item[key] }}</td>
{% endif %}
<td>{{ item.fields[key] }}</td>{% endif %}
{% endfor %}
</tr>
{% endfor %}