You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
2.2 KiB
70 lines
2.2 KiB
{% 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}}">
|
|
|
|
<table>
|
|
<tr>
|
|
<th><label for="name">Name:</label></th>
|
|
<td><input type="text" id="name" name="name" value="{{old.name}}" autocomplete="off"></td>
|
|
</tr>
|
|
<tr>
|
|
<th><label for="unique">Unique:</label></th>
|
|
<td><input type="checkbox" name="unique" id="unique" value="true" {{opt(checked=old.unique)}} autocomplete="off"></td>
|
|
</tr>
|
|
<tr>
|
|
<th><label for="optional">Optional:</label></th>
|
|
<td><input type="checkbox" name="optional" id="optional" value="true" {{opt(checked=old.optional)}} autocomplete="off"></td>
|
|
</tr>
|
|
<tr>
|
|
<th><label for="multiple">Multiple:</label></th>
|
|
<td><input type="checkbox" name="multiple" id="multiple" value="true" {{opt(checked=old.multiple)}} autocomplete="off"></td>
|
|
</tr>
|
|
<tr>
|
|
<th><label for="data_type">Type:</label></th>
|
|
<td>
|
|
<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>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th><label for="default">Default:</label></th>
|
|
<td><input type="text" id="default" name="default" value="{{old.default}}" autocomplete="off"></td>
|
|
</tr>
|
|
</table>
|
|
|
|
<input type="submit" value="Save">
|
|
</form>
|
|
|
|
<script>
|
|
(function () {
|
|
// multiple and unique are XORed. This is also enforced server-side
|
|
let multiple = document.getElementById('multiple');
|
|
let unique = document.getElementById('unique');
|
|
unique.addEventListener('input', function () {
|
|
multiple.checked &= !unique.checked;
|
|
})
|
|
multiple.addEventListener('input', function () {
|
|
unique.checked &= !multiple.checked;
|
|
})
|
|
})();
|
|
</script>
|
|
|
|
{%- endblock %}
|
|
|