show model overview in index page
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
{% extends "_layout" %}
|
||||
|
||||
{% block title -%}
|
||||
Index
|
||||
{%- endblock %}
|
||||
|
||||
{% block nav -%}
|
||||
<a href="/">Home</a>
|
||||
{%- endblock %}
|
||||
|
||||
{% block content -%}
|
||||
|
||||
<h1>Welcome to tera on actix</h1>
|
||||
|
||||
<a href="/model/object/create">New model</a>
|
||||
|
||||
<h2>Defined models:</h2>
|
||||
|
||||
<ul>
|
||||
{% for model in models %}
|
||||
<li>
|
||||
<b>{{model.name}}</b><br>
|
||||
|
||||
{#
|
||||
|
||||
{% if !model.properties.is_empty() %}
|
||||
Properties:
|
||||
<ul>
|
||||
{% for prop in model.properties %}
|
||||
<li>{{prop.name}}, {{prop.data_type}}, def: {{prop.default}}, opt: {{prop.optional}}, mult: {{prop.multiple}}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
<a href="/model/property/create/{{model.id}}">New property</a>
|
||||
|
||||
{% if !model.relations.is_empty() %}
|
||||
Relations:
|
||||
<ul>
|
||||
{% for rel in model.relations %}
|
||||
<li>
|
||||
{{rel.name}} -> {{rel.related_name}}
|
||||
|
||||
{% if !rel.properties.is_empty() %}
|
||||
Properties:
|
||||
<ul>
|
||||
{% for prop in rel.properties %}
|
||||
<li>{{prop.name}}, {{prop.data_type}}, def: {{prop.default}}, opt: {{prop.optional}}, mult: {{prop.multiple}}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
<a href="/model/relation/create/{{model.id}}">New relation</a>
|
||||
|
||||
#}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
{%- endblock %}
|
||||
@@ -119,6 +119,8 @@ textarea:focus,
|
||||
outline: 0 none !important;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
.cards-table {
|
||||
border-collapse: collapse;
|
||||
margin: 0 auto;
|
||||
@@ -198,3 +200,8 @@ textarea:focus,
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
li {
|
||||
padding-bottom: .5rem;
|
||||
}
|
||||
|
||||
@@ -5,11 +5,72 @@
|
||||
{%- endblock %}
|
||||
|
||||
{% block nav -%}
|
||||
<a href="/">Home</a>
|
||||
<a href="/">Home</a>
|
||||
{%- endblock %}
|
||||
|
||||
{% block content -%}
|
||||
|
||||
<h1>Welcome to tera on actix</h1>
|
||||
<h1>Welcome to YOPA</h1>
|
||||
|
||||
<a href="/model/object/create">New model</a>
|
||||
|
||||
<h2>Defined models:</h2>
|
||||
|
||||
<ul>
|
||||
{% for model in models %}
|
||||
<li>
|
||||
<b title="{{model.id}}">{{model.name}}</b><br>
|
||||
|
||||
{% if model.properties %}
|
||||
Properties:
|
||||
<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 %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
<a href="/model/property/create/{{model.id}}">Add a property</a><br>
|
||||
|
||||
{% if model.relations %}
|
||||
Relations:
|
||||
<ul>
|
||||
{% for rel in model.relations %}
|
||||
<li>
|
||||
<span title="{{rel.model.id}}">"{{rel.model.name}}", pointing to: <i>{{rel.related_name}}</i></span><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 %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
<a href="/model/property/create/{{rel.model.id}}">Add a property</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
<a href="/model/relation/create/{{model.id}}">Add a relation</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
{%- endblock %}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
{% extends "_layout" %}
|
||||
|
||||
{% block title -%}
|
||||
Define object
|
||||
{%- endblock %}
|
||||
|
||||
{% block nav -%}
|
||||
<a href="/">Home</a>
|
||||
{%- endblock %}
|
||||
|
||||
{% block content -%}
|
||||
|
||||
<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>
|
||||
|
||||
<input type="submit" value="Save">
|
||||
</form>
|
||||
|
||||
{%- endblock %}
|
||||
@@ -0,0 +1,42 @@
|
||||
{% extends "_layout" %}
|
||||
|
||||
{% block title -%}
|
||||
Define property
|
||||
{%- endblock %}
|
||||
|
||||
{% block nav -%}
|
||||
<a href="/">Home</a>
|
||||
{%- endblock %}
|
||||
|
||||
{% block content -%}
|
||||
|
||||
<h1>Add new property to model "{{model.name}}"</h1>
|
||||
|
||||
<form action="/model/property/create" method="POST">
|
||||
<input type="hidden" name="object" value="{{object}}">
|
||||
|
||||
<label for="name">Name:</label>
|
||||
<input type="text" id="name" name="name"><br>
|
||||
|
||||
<label for="optional">Optional:</label>
|
||||
<input type="checkbox" name="optional" id="optional">
|
||||
<br>
|
||||
|
||||
<label for="multiple">Multiple:</label>
|
||||
<input type="checkbox" name="multiple" id="multiple"><br>
|
||||
|
||||
<label for="data_type">Type:</label>
|
||||
<select name="data_type" id="data_type">
|
||||
<option value="String" selected>String</option>
|
||||
<option value="Integer">Integer</option>
|
||||
<option value="Decimal">Decimal</option>
|
||||
<option value="Boolean">Boolean</option>
|
||||
</select><br>
|
||||
|
||||
<label for="default">Default:</label>
|
||||
<input type="text" id="default" name="default"><br>
|
||||
|
||||
<input type="submit" value="Save">
|
||||
</form>
|
||||
|
||||
{%- endblock %}
|
||||
Reference in New Issue
Block a user