flash messages etc

This commit is contained in:
2021-02-07 17:52:10 +01:00
parent 8b87fd0079
commit 9706cf0a62
13 changed files with 470 additions and 124 deletions
+16 -3
View File
@@ -2,17 +2,30 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{% block title %}{% endblock title %} &bull; YOPA</title>
<title>{% block title -%}{%- endblock title %} &bull; YOPA</title>
<link rel="stylesheet" href="/static/style.css">
<link rel="stylesheet" href="/static/taggle.css">
<script src="/static/taggle.min.js"></script>
</head>
<body>
<nav class="top-nav">
{% block nav %}{% endblock %}
{%- block nav -%}{%- endblock -%}
</nav>
<div class="content">
{% block content %}{% endblock %}
{%- if flash_error -%}
<div class="toast error">
{{ flash_error }}
</div>
{%- endif -%}
{%- if flash_success -%}
<div class="toast success">
{{ flash_success }}
</div>
{%- endif -%}
{%- block content -%}{%- endblock -%}
</div>
</body>
</html>
@@ -0,0 +1,8 @@
{% macro describe_property(prop) %}
{{prop.name}}, {{prop.data_type}}
{%- if prop.default -%}
, default: "{{prop.default | print_typed_value}}"
{%- endif -%}
{%- if prop.optional %}, OPTIONAL{% endif %}
{%- if prop.multiple %}, MULTIPLE{% endif %}
{% endmacro input %}
+7 -13
View File
@@ -1,4 +1,5 @@
{% extends "_layout" %}
{% import "_macros" as macros %}
{% block title -%}
Index
@@ -26,12 +27,7 @@
<ul>
{% for prop in model.properties %}
<li>
{{prop.name}}, {{prop.data_type}}
{%- if prop.default -%}
, default: "{{prop.default | print_typed_value}}"
{%- endif -%}
{%- if prop.optional %}, OPTIONAL{% endif %}
{%- if prop.multiple %}, MULTIPLE{% endif %}
{{ macros::describe_property(prop=prop) }}
</li>
{% endfor %}
</ul>
@@ -44,19 +40,17 @@
<ul>
{% for rel in model.relations %}
<li>
<span title="{{rel.model.id}}">"{{rel.model.name}}", pointing to: <i>{{rel.related_name}}</i></span><br>
<span title="{{rel.model.id}}">"{{rel.model.name}}", pointing to: <i>{{rel.related_name}}</i></span>
{%- if rel.model.optional %}, OPTIONAL{% endif %}
{%- if rel.model.multiple %}, MULTIPLE{% endif %}
<br>
{% if rel.properties %}
Properties:
<ul>
{% for prop in rel.properties %}
<li title="{{prop.id}}">
{{prop.name}}, {{prop.data_type}}
{%- if prop.default -%}
, default: "{{prop.default | print_typed_value}}"
{%- endif -%}
{%- if prop.optional %}, OPTIONAL{% endif %}
{%- if prop.multiple %}, MULTIPLE{% endif %}
{{ macros::describe_property(prop=prop) }}
</li>
{% endfor %}
</ul>
@@ -13,14 +13,6 @@ Define object
<h1>Define new object model</h1>
<form action="/model/object/create" method="POST">
<label for="parent">Parent:</label>
<select name="parent" id="parent">
<option value="">No parent</option>
{%- for model in all_models %}
<option value="{{model.id}}">{{model.name}}</option>
{%- endfor %}
</select><br>
<label for="name">Name:</label>
<input type="text" id="name" name="name"><br>