new forms

This commit is contained in:
2021-03-02 00:15:39 +01:00
parent 4a51f7d3c2
commit ee24917bee
37 changed files with 744 additions and 10964 deletions
+4 -9
View File
@@ -6,26 +6,21 @@
<script src="../static/bundle.js"></script>
<link rel="stylesheet" href="../static/style.css">
</head>
<body class="container grid-lg">
<body>
<header class="navbar">
<header class="navbar mb-2 mt-2">
<section class="navbar-section">
<a href="/" class="navbar-brand text-bold mr-2">
Yopa
</a>
<a href="/" class="btn btn-link">
<i class="icon icon-home"></i>
Home
</a>
<a href="/" class="btn btn-link"><i class="icon icon-home"></i>Home</a>
</section>
<section class="navbar-section">
YOPA is the best
</section>
</header>
<div class="content">
<div id="edit-object-form"></div>
</div>
<div id="edit-object-form"></div>
<script>
onLoad(() => {
@@ -0,0 +1,51 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Edit object model &bull; YOPA</title>
<script src="../static/bundle.js"></script>
<link rel="stylesheet" href="../static/style.css">
</head>
<body>
<header class="navbar mb-2 mt-2">
<section class="navbar-section">
<a href="/" class="navbar-brand text-bold mr-2">
Yopa
</a><a href="/" class="btn btn-link"><i class="icon icon-home"></i>Home</a></section>
<section class="navbar-section">
YOPA is the best
</section>
</header>
<div class="content"><h1>Edit object model Animal</h1>
<form action="/model/object/update/0" method="POST">
<table>
<tr>
<th><label for="name">Name:</label></th>
<td><input type="text" id="name" name="name" value="Animal" autocomplete="off">
</td>
</tr>
<tr>
<th><label for="name_property">Name property:</label></th>
<td>
<select name="name_property" id="name_property" autocomplete="off">
<option value=""></option>
<option value="11" >carnivore</option>
<option value="2" >Name</option>
<option value="12" >weight</option>
<option value="5" selected>czech name</option>
</select>
</td>
</tr>
</table>
<input type="submit" value="Save">
</form></div>
</body>
</html>
@@ -0,0 +1,83 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Edit property &bull; YOPA</title>
<script src="../static/bundle.js"></script>
<link rel="stylesheet" href="../static/style.css">
</head>
<body>
<header class="navbar mb-2 mt-2">
<section class="navbar-section">
<a href="/" class="navbar-brand text-bold mr-2">
Yopa
</a><a href="/" class="btn btn-link"><i class="icon icon-home"></i>Home</a></section>
<section class="navbar-section">
YOPA is the best
</section>
</header>
<div class="content"><h1>Edit property Name</h1>
<form action="/model/property/update/2" method="POST">
<table>
<tr>
<th><label for="name">Name:</label></th>
<td><input type="text" id="name" name="name" value="Name" autocomplete="off"></td>
</tr>
<tr>
<th><label for="unique">Unique:</label></th>
<td>
<input type="checkbox" name="unique" id="unique" value="true" checked autocomplete="off">
</td>
</tr>
<tr>
<th><label for="optional">Optional:</label></th>
<td>
<input type="checkbox" name="optional" id="optional" value="true" autocomplete="off">
</td>
</tr>
<tr>
<th><label for="multiple">Multiple:</label></th>
<td>
<input type="checkbox" name="multiple" id="multiple" value="true" 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>String</option>
<option value="Integer" >Integer</option>
<option value="Decimal" >Decimal</option>
<option value="Boolean" >Boolean</option>
</select>
</td>
</tr>
<tr>
<th><label for="default">Default:</label></th>
<td>
<input type="text" id="default" name="default" value="" 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></div>
</body>
</html>
@@ -0,0 +1,52 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Edit relation &bull; YOPA</title>
<script src="../static/bundle.js"></script>
<link rel="stylesheet" href="../static/style.css">
</head>
<body>
<header class="navbar mb-2 mt-2">
<section class="navbar-section">
<a href="/" class="navbar-brand text-bold mr-2">
Yopa
</a><a href="/" class="btn btn-link"><i class="icon icon-home"></i>Home</a></section>
<section class="navbar-section">
YOPA is the best
</section>
</header>
<div class="content"><h1>Edit relation model "eats"</h1>
<form action="/model/relation/update/15" method="POST">
<table>
<tr>
<th><label for="name">Name:</label></th>
<td><input type="text" id="name" name="name" value="eats" autocomplete="off">
</td>
</tr>
<tr>
<th><label for="reciprocal_name">Reciprocal name:</label></th>
<td><input type="text" id="reciprocal_name" name="reciprocal_name" value="eaten by" autocomplete="off">
</td>
</tr>
<tr>
<th><label for="optional">Optional:</label>
</th>
<td><input type="checkbox" name="optional" id="optional" value="true" checked autocomplete="off">
</td>
</tr>
<tr>
<th><label for="multiple">Multiple:</label></th>
<td><input type="checkbox" name="multiple" id="multiple" value="true" autocomplete="off">
</td>
</tr>
</table>
<p>The related object cannot be changed. Create a new relation if needed.</p>
<input type="submit" value="Save">
</form></div>
</body>
</html>
+66
View File
@@ -0,0 +1,66 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Index &bull; YOPA</title>
<script src="../static/bundle.js"></script>
<link rel="stylesheet" href="../static/style.css">
</head>
<body>
<header class="navbar mb-2 mt-2">
<section class="navbar-section">
<a href="/" class="navbar-brand text-bold mr-2">
Yopa
</a><a href="/" class="btn btn-link"><i class="icon icon-home"></i>Home</a></section>
<section class="navbar-section">
YOPA is the best
</section>
</header>
<div class="content"><h1>Models</h1>
<a href="/model/object/create">New model</a>
<h2>Defined models:</h2>
<ul>
<li>
<b title="0">Animal</b><br>
<a href="/model/object/delete/0" onclick="return confirm('Delete model?')">Delete model</a> &middot;
<a href="/model/object/update/0">Edit model</a> &middot;
<a href="/model/relation/create/0">New relation</a> &middot;
<a href="/model/property/create/0">New property</a>
<br>
Properties:
<ul>
<li>
Name, String, default: ""
<a href="/model/property/update/2">Edit property</a> &middot;
<a href="/model/property/delete/2" onclick="return confirm('Delete property?')">Delete property</a>
</li>
<li>
carnivore, Boolean, default: "false"
<a href="/model/property/update/11">Edit property</a> &middot;
<a href="/model/property/delete/11" onclick="return confirm('Delete property?')">Delete property</a>
</li>
<li>
czech name, String, default: "", OPTIONAL
<a href="/model/property/update/5">Edit property</a> &middot;
<a href="/model/property/delete/5" onclick="return confirm('Delete property?')">Delete property</a>
</li>
<li>
weight, Decimal, default: "0"
<a href="/model/property/update/12">Edit property</a> &middot;
<a href="/model/property/delete/12" onclick="return confirm('Delete property?')">Delete property</a>
</li>
</ul>
</li>
<li>
<b title="1">Food</b><br>
<a href="/model/object/delete/1" onclick="return confirm('Delete model?')">Delete model</a> &middot;
<a href="/model/object/update/1">Edit model</a> &middot;
<a href="/model/relation/create/1">New relation</a> &middot;
<a href="/model/property/create/1">New property</a>
<br>
</li>
</ul>
</div>
</body>
</html>
+29
View File
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Create Animal &bull; YOPA</title>
<script src="../static/bundle.js"></script>
<link rel="stylesheet" href="../static/style.css">
</head>
<body>
<header class="navbar mb-2 mt-2">
<section class="navbar-section">
<a href="/" class="navbar-brand text-bold mr-2">
Yopa
</a><a href="/" class="btn btn-link">
<i class="icon icon-home"></i>Home</a></section>
<section class="navbar-section">
YOPA is the best
</section>
</header>
<div id="new-object-form"></div>
<script>
onLoad(() => {
window.app = Yopa.newObjectForm({"model_id":0,"objects":[],"schema":{"obj_models":[{"id":0,"name":"Animal","name_property":5},{"id":1,"name":"Food","name_property":null}],"prop_models":[{"data_type":"Boolean","default":{"Boolean":false},"id":11,"multiple":false,"name":"carnivore","object":0,"optional":false,"unique":false},{"data_type":"String","default":{"String":""},"id":2,"multiple":false,"name":"Name","object":0,"optional":false,"unique":true},{"data_type":"Decimal","default":{"Decimal":0.0},"id":12,"multiple":false,"name":"weight","object":0,"optional":false,"unique":false},{"data_type":"String","default":{"String":""},"id":5,"multiple":false,"name":"czech name","object":0,"optional":true,"unique":false}],"rel_models":[{"id":15,"multiple":false,"name":"eats","object":0,"optional":true,"reciprocal_name":"eaten by","related":1}]}})
});
</script>
</body>
</html>
@@ -0,0 +1,74 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Define relation &bull; YOPA</title>
<script src="../static/bundle.js"></script>
<link rel="stylesheet" href="../static/style.css">
</head>
<body>
<header class="navbar mb-2 mt-2">
<section class="navbar-section">
<a href="/" class="navbar-brand text-bold mr-2">
Yopa
</a><a href="/" class="btn btn-link"><i class="icon icon-home"></i>Home</a></section>
<section class="navbar-section">
YOPA is the best
</section>
</header>
<div class="content">
<form action="/model/relation/create" method="POST">
<input type="hidden" name="object" value="0">
<div class="container">
<div class="cols">
<div class="col col-9">
<h1>Define new relation from "Animal"</h1>
</div>
<div class="col col-3 text-right">
<button type="submit" class="btn btn-primary">
<i class="icon icon-check"></i>Save
</button>
</div>
</div>
</div>
<div class="form-horizontal container">
<div class="form-group cols">
<div class="col-3 pl-2">
<label class="form-label" for="name">Name</label>
</div>
<div class="col-9 pr-2">
<input type="text" class="form-input input-inline" id="name" name="name" value="" autocomplete="off">
</div>
</div>
<div class="form-group cols">
<div class="col-3 pl-2">
<label class="form-label" for="optional">Optional</label>
</div>
<div class="col-9 pr-2">
<label class="form-switch input-inline">
<input type="checkbox" id="optional" value="true">
<i class="form-icon"></i>
</label>
</div>
</div>
<div class="form-group cols">
<div class="col-3 pl-2">
<label class="form-label" for="related">dsfsdf</label>
</div>
<div class="col-9 pr-2">
<select name="related" class="form-select input-inline" id="related" autocomplete="off">
<option value="0" selected>Animal</option>
<option value="1" >Food</option>
</select>
</div>
</div>
</div>
</form></div>
</body>
</html>
@@ -0,0 +1,73 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>kočka &bull; YOPA</title>
<script src="../static/bundle.js"></script>
<link rel="stylesheet" href="..//static/style.css">
</head>
<body>
<header class="navbar mb-2 mt-2">
<section class="navbar-section">
<a href="/" class="navbar-brand text-bold mr-2">
Yopa
</a><a href="/" class="btn btn-link">
<i class="icon icon-home"></i>Home</a>
<a href="/object/update/7" class="btn btn-link">
<i class="icon icon-edit"></i>Edit</a>
<a href="/object/delete/7" class="btn btn-link" onclick="return confirm('Delete object?')">
<i class="icon icon-delete"></i>Delete</a></section>
<section class="navbar-section">
YOPA is the best
</section>
</header>
<div class="content"><h1>Animal "kočka"</h1>
<table class="table table-striped object-display">
<tbody>
<tr>
<th rowspan="1">
Name
</th>
<td title="9">
cat
</td>
</tr>
<tr>
<th rowspan="1">
carnivore
</th>
<td title="13">
true
</td>
</tr>
<tr>
<th rowspan="1">
czech name
</th>
<td title="8">
kočka
</td>
</tr>
<tr>
<th rowspan="1">
weight
</th>
<td title="14">
15.5
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>