add cloning logic

This commit is contained in:
HRG @ SCExC 2024-06-04 03:01:19 -04:00
parent 365b297397
commit 835c5fdd66
8 changed files with 367 additions and 49 deletions

View file

@ -0,0 +1,24 @@
<div class="fixed inset-0 flex items-center justify-center z-10 " _="on closeModal remove me">
<div class="bg-white rounded-md border border-black p-2">
<div class="text-lg">Clone Structure</div>
<form hx-post="/workshop/<%= it.structure.id %>/clone" hx-target="#response" class="flex flex-col gap-2">
<div class="flex flex-col">
<label class="text-xs">Name</label>
<input name="name" id="name" type="text" value="<%= it.structure.name %> clone" />
</div>
<div class="flex flex-col">
<label class="text-xs">Route Prefix</label>
<input name="route_prefix" id="route_prefix" type="text" value="<%= it.defaultRoutePrefix %>" />
</div>
<div class="flex gap-2">
<input id="default-checkbox" type="checkbox" name="cloneDBs" value="true">
<label class="text-xs">Clone DBs</label>
</div>
<section class="flex flex-end gap-2" style="justify-content: flex-end">
<button class="bg-green-500 rounded p-2 hover:bg-green-700 text-white" type="submit">Clone</button>
<button class="bg-gray-400 rounded p-2 hover:bg-gray-700 text-white" type="button" _="on click trigger closeModal">Cancel</button>
</section>
</form>
<div id="response"></div>
</div>
</div>

View file

@ -38,4 +38,5 @@
</form>
<div id="response"></div>
</div>
</div>
</div>
</div>

View file

@ -19,4 +19,5 @@
</form>
<div id="response"></div>
</div>
</div>
</div>
</div>

View file

@ -0,0 +1,34 @@
<html>
<head>
<link rel="stylesheet" href="/css/xp.css">
<script src="/js/ace/ace.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="flex flex-col w-full h-full window">
<div class="title-bar">
<div class="title-bar-text">Workshop - <%~ include('/workshop/structure_name', {structure: it.structure}) %>
</div>
</div>
<div class="flex flex-row flex-grow window-body">
<div class="w-1/5 h-full">
<%~ include('/workshop/sidebar', it) %>
</div>
<div id="main-editor" class="flex flex-grow">
<div id="left-pane" class="flex-grow h-full ">
<form hx-put="/workshop/<%= it.structure.id %>/settings" hx-target="#result" class="p-2 flex flex-col gap-2 max-w-48">
<div class="field-row-stacked">
<label for="name">Route Prefix</label>
<input name="route_prefix" value="<%= it.structure.route_prefix %>">
</div>
<button id="save-btn" type="submit">Save</button>
<div id="result"></div>
</form>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -6,7 +6,8 @@
<% it.routes.map(route => { %>
<li>
<a href="/workshop/<%= it.structure.id %>/route/<%= route.id %>">
<%= route.verb %> - <%= route.path %>
<%= route.verb %> -
<%= it.structure.route_prefix %><%= route.path %>
</a>
</li>
<% }) %>
@ -59,5 +60,8 @@
<li>
<a href="/workshop/<%= it.structure.id %>/files">Files</a>
</li>
<li>
<a href="/workshop/<%= it.structure.id %>/settings">Settings</a>
</li>
</ul>
<div id="modal-zone" style="z-index: 1000000;"></div>