code: functioning example for repository registry; using tokio::sync::Mutex for read/write lock; prototype create

This commit is contained in:
2024-01-28 18:11:02 +01:00
parent 9feb2f4ae7
commit 0e6649de1b
6 changed files with 126 additions and 32 deletions

View File

@@ -1,17 +1,28 @@
{% extends base|none("admin/base.jinja") %}
{% macro input(name, value="", type="text") -%}
<input type="{{ type }}" name="{{ name }}" value="{{ value }}">
<input type="{{ type }}" name="{{ name }}" value="{{ value }}" placeholder="">
{%- endmacro %}
{% block content %}
Create {{item_model.name}} in {{item_info.name}}
<div class="ui container">
<h1>Create {{item_model.name}} in {{item_info.name}}</h1>
<form action="{{item_model.add_url}}" method="POST">
{% 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>
<form action="{{item_model.add_url}}" method="POST" class="ui form">
{% set fields = item_info.fields %}
{% for field in fields %}
{% if item %}
{% set field_value = item.fields[field]|none("") %}
{% else %}
{% set field_value = "" %}
{% endif %}
<div class="inline field">
<label>{{field|capitalize}}</label>
{{ input(field, field_value) }}
</div>
{% endfor %}
<button class="ui button" type="submit">Create</button>
</form>
</div>
{% endblock content %}