add rollup/vue for frontend assets, add wip new object form (needs success/error handling)
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
{% 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 %}
|
||||
<a href="/model/property/update/{{prop.id}}">Edit property</a> ·
|
||||
<a href="/model/property/delete/{{prop.id}}" onclick="return confirm('Delete property?')">Delete property</a>
|
||||
{% endmacro input %}
|
||||
@@ -0,0 +1,22 @@
|
||||
{% 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="name">Name:</label>
|
||||
<input type="text" id="name" name="name" value="{{old.name}}" autocomplete="off"><br>
|
||||
|
||||
<input type="submit" value="Save">
|
||||
</form>
|
||||
|
||||
{%- endblock %}
|
||||
@@ -0,0 +1,22 @@
|
||||
{% extends "_layout" %}
|
||||
|
||||
{% block title -%}
|
||||
Edit object model
|
||||
{%- endblock %}
|
||||
|
||||
{% block nav -%}
|
||||
<a href="/">Home</a>
|
||||
{%- endblock %}
|
||||
|
||||
{% block content -%}
|
||||
|
||||
<h1>Edit object model {{ model.name }}</h1>
|
||||
|
||||
<form action="/model/object/update/{{ model.id }}" method="POST">
|
||||
<label for="name">Name:</label>
|
||||
<input type="text" id="name" name="name" value="{{ model.name }}" autocomplete="off"><br>
|
||||
|
||||
<input type="submit" value="Save">
|
||||
</form>
|
||||
|
||||
{%- endblock %}
|
||||
@@ -0,0 +1,43 @@
|
||||
{% extends "_layout" %}
|
||||
|
||||
{% block title -%}
|
||||
Define property
|
||||
{%- endblock %}
|
||||
|
||||
{% block nav -%}
|
||||
<a href="/">Home</a>
|
||||
{%- endblock %}
|
||||
|
||||
{% block content -%}
|
||||
|
||||
{# The parent can be either object or relation model #}
|
||||
<h1>Add new property to {{object.describe}}</h1>
|
||||
|
||||
<form action="/model/property/create" method="POST">
|
||||
<input type="hidden" name="object" value="{{object.id}}">
|
||||
|
||||
<label for="name">Name:</label>
|
||||
<input type="text" id="name" name="name" value="{{old.name}}" autocomplete="off"><br>
|
||||
|
||||
<label for="optional">Optional:</label>
|
||||
<input type="checkbox" name="optional" id="optional" value="true" {{opt(checked=old.optional)}} autocomplete="off">
|
||||
<br>
|
||||
|
||||
<label for="multiple">Multiple:</label>
|
||||
<input type="checkbox" name="multiple" id="multiple" value="true" {{opt(checked=old.multiple)}} autocomplete="off"><br>
|
||||
|
||||
<label for="data_type">Type:</label>
|
||||
<select name="data_type" id="data_type" autocomplete="off">
|
||||
<option value="String" {{selected(opt="String",val=old.data_type)}}>String</option>
|
||||
<option value="Integer" {{selected(opt="Integer",val=old.data_type)}}>Integer</option>
|
||||
<option value="Decimal" {{selected(opt="Decimal",val=old.data_type)}}>Decimal</option>
|
||||
<option value="Boolean" {{selected(opt="Boolean",val=old.data_type)}}>Boolean</option>
|
||||
</select><br>
|
||||
|
||||
<label for="default">Default:</label>
|
||||
<input type="text" id="default" name="default" value="{{old.default}}" autocomplete="off"><br>
|
||||
|
||||
<input type="submit" value="Save">
|
||||
</form>
|
||||
|
||||
{%- endblock %}
|
||||
@@ -0,0 +1,40 @@
|
||||
{% extends "_layout" %}
|
||||
|
||||
{% block title -%}
|
||||
Edit property
|
||||
{%- endblock %}
|
||||
|
||||
{% block nav -%}
|
||||
<a href="/">Home</a>
|
||||
{%- endblock %}
|
||||
|
||||
{% block content -%}
|
||||
|
||||
<h1>Edit property {{model.name}}</h1>
|
||||
|
||||
<form action="/model/property/update/{{model.id}}" method="POST">
|
||||
<label for="name">Name:</label>
|
||||
<input type="text" id="name" name="name" value="{{model.name}}" autocomplete="off"><br>
|
||||
|
||||
<label for="optional">Optional:</label>
|
||||
<input type="checkbox" name="optional" id="optional" value="true" {{opt(checked=model.optional)}} autocomplete="off">
|
||||
<br>
|
||||
|
||||
<label for="multiple">Multiple:</label>
|
||||
<input type="checkbox" name="multiple" id="multiple" value="true" {{opt(checked=model.multiple)}} autocomplete="off"><br>
|
||||
|
||||
<label for="data_type">Type:</label>
|
||||
<select name="data_type" id="data_type" autocomplete="off">
|
||||
<option value="String" {{selected(val=model.data_type, opt="String")}}>String</option>
|
||||
<option value="Integer" {{selected(val=model.data_type, opt="Integer")}}>Integer</option>
|
||||
<option value="Decimal" {{selected(val=model.data_type, opt="Decimal")}}>Decimal</option>
|
||||
<option value="Boolean" {{selected(val=model.data_type, opt="Boolean")}}>Boolean</option>
|
||||
</select><br>
|
||||
|
||||
<label for="default">Default:</label>
|
||||
<input type="text" id="default" name="default" value="{{model.default | print_typed_value}}" autocomplete="off"><br>
|
||||
|
||||
<input type="submit" value="Save">
|
||||
</form>
|
||||
|
||||
{%- endblock %}
|
||||
@@ -0,0 +1,42 @@
|
||||
{% extends "_layout" %}
|
||||
|
||||
{% block title -%}
|
||||
Define relation
|
||||
{%- endblock %}
|
||||
|
||||
{% block nav -%}
|
||||
<a href="/">Home</a>
|
||||
{%- endblock %}
|
||||
|
||||
{% block content -%}
|
||||
|
||||
<h1>Define new relation from "{{object.name}}"</h1>
|
||||
|
||||
<form action="/model/relation/create" method="POST">
|
||||
<input type="hidden" name="object" value="{{object.id}}">
|
||||
|
||||
<label for="name">Name:</label>
|
||||
<input type="text" id="name" name="name" value="{{old.name}}" autocomplete="off"><br>
|
||||
|
||||
<label for="reciprocal_name">Reciprocal name:</label>
|
||||
<input type="text" id="reciprocal_name" name="reciprocal_name" value="{{old.reciprocal_name}}" autocomplete="off"><br>
|
||||
|
||||
<label for="optional">Optional:</label>
|
||||
<input type="checkbox" name="optional" id="optional" value="true" {{opt(checked=old.optional)}} autocomplete="off">
|
||||
<br>
|
||||
|
||||
<label for="multiple">Multiple:</label>
|
||||
<input type="checkbox" name="multiple" id="multiple" value="true" {{opt(checked=old.multiple)}} autocomplete="off"><br>
|
||||
|
||||
<label for="related">Related object:</label>
|
||||
<select name="related" id="related" autocomplete="off">
|
||||
{% for m in models %}
|
||||
<option value="{{ m.id }}" {{selected(val=old.related, opt=m.id)}}>{{ m.name }}</option>
|
||||
{% endfor %}
|
||||
</select><br>
|
||||
|
||||
<input type="submit" value="Save">
|
||||
</form>
|
||||
|
||||
|
||||
{%- endblock %}
|
||||
@@ -0,0 +1,35 @@
|
||||
{% extends "_layout" %}
|
||||
|
||||
{% block title -%}
|
||||
Edit relation
|
||||
{%- endblock %}
|
||||
|
||||
{% block nav -%}
|
||||
<a href="/">Home</a>
|
||||
{%- endblock %}
|
||||
|
||||
{% block content -%}
|
||||
|
||||
<h1>Edit relation model "{{model.name}}"</h1>
|
||||
|
||||
<form action="/model/relation/update/{{model.id}}" method="POST">
|
||||
<label for="name">Name:</label>
|
||||
<input type="text" id="name" name="name" value="{{model.name}}" autocomplete="off"><br>
|
||||
|
||||
<label for="reciprocal_name">Reciprocal name:</label>
|
||||
<input type="text" id="reciprocal_name" name="reciprocal_name" value="{{model.reciprocal_name}}" autocomplete="off"><br>
|
||||
|
||||
<label for="optional">Optional:</label>
|
||||
<input type="checkbox" name="optional" id="optional" value="true" {{opt(checked=model.optional)}} autocomplete="off">
|
||||
<br>
|
||||
|
||||
<label for="multiple">Multiple:</label>
|
||||
<input type="checkbox" name="multiple" id="multiple" value="true" {{opt(checked=model.multiple)}} autocomplete="off"><br>
|
||||
|
||||
<p>The related object cannot be changed. Create a new relation if needed.</p>
|
||||
|
||||
<input type="submit" value="Save">
|
||||
</form>
|
||||
|
||||
|
||||
{%- endblock %}
|
||||
@@ -0,0 +1,96 @@
|
||||
{% extends "_layout" %}
|
||||
{% import "models/_schema_macros" as macros %}
|
||||
|
||||
{% block title -%}
|
||||
Index
|
||||
{%- endblock %}
|
||||
|
||||
{% block nav -%}
|
||||
<a href="/takeout">Takeout</a>
|
||||
{%- endblock %}
|
||||
|
||||
{% block content -%}
|
||||
|
||||
<h1>Welcome to YOPA</h1>
|
||||
|
||||
<a href="/model/object/create">New model</a>
|
||||
|
||||
<h2>Defined models:</h2>
|
||||
|
||||
{% if models %}
|
||||
<ul>
|
||||
{% for model in models %}
|
||||
<li>
|
||||
<b title="{{model.id}}">{{model.name}}</b><br>
|
||||
|
||||
<!--
|
||||
|
||||
{{ model | json_encode(pretty=true) | safe }}
|
||||
|
||||
-->
|
||||
|
||||
<a href="/model/object/delete/{{model.id}}" onclick="return confirm('Delete model?')">Delete model</a> ·
|
||||
<a href="/model/object/update/{{model.id}}">Edit model</a> ·
|
||||
<a href="/model/relation/create/{{model.id}}">New relation</a> ·
|
||||
<a href="/model/property/create/{{model.id}}">New property</a>
|
||||
<br>
|
||||
|
||||
{% if model.properties %}
|
||||
Properties:
|
||||
<ul>
|
||||
{% for prop in model.properties %}
|
||||
<li>
|
||||
{{ macros::describe_property(prop=prop) }}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{% if model.relations %}
|
||||
Relations:
|
||||
<ul>
|
||||
{% for rel in model.relations %}
|
||||
<li>
|
||||
<span title="{{rel.model.id}}">"{{rel.model.name}}" -> <i>{{rel.related_name}} (reciprocally as "{{rel.model.reciprocal_name}}")</i></span>
|
||||
{%- if rel.model.optional %}, OPTIONAL{% endif %}
|
||||
{%- if rel.model.multiple %}, MULTIPLE{% endif %}
|
||||
<br>
|
||||
|
||||
<a href="/model/relation/update/{{rel.model.id}}">Edit relation</a> ·
|
||||
<a href="/model/relation/delete/{{rel.model.id}}" onclick="return confirm('Delete relation?')">Delete relation</a> ·
|
||||
<a href="/model/property/create/{{rel.model.id}}">New property</a>
|
||||
<br>
|
||||
|
||||
{% if rel.properties %}
|
||||
Properties:
|
||||
<ul>
|
||||
{% for prop in rel.properties %}
|
||||
<li title="{{prop.id}}">
|
||||
{{ macros::describe_property(prop=prop) }}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{% if model.reciprocal_relations %}
|
||||
Incoming relations:
|
||||
<ul>
|
||||
{% for rel in model.reciprocal_relations %}
|
||||
<li>
|
||||
<span title="{{rel.model.id}}">"{{rel.model.reciprocal_name}}" <- <i>{{rel.related_name}}</i> (reciprocally as "{{rel.model.name}}")</span>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<p>No models defined.</p>
|
||||
{% endif %}
|
||||
|
||||
{%- endblock %}
|
||||
Reference in New Issue
Block a user