For endpoints page, remove faulty logic that attempted to persisted column view preferences and move Method column to 2nd pos

This commit is contained in:
Peter Stockings
2024-11-10 18:31:44 +11:00
parent 8b248bad17
commit 5bdb586a2c

View File

@@ -1,81 +1,59 @@
<div class="overflow-x-auto"> <div class="overflow-x-auto">
<!-- Column Toggle Checkboxes --> <!-- Column Toggle Checkboxes -->
<div class="mb-4 flex flex-col sm:flex-row flex-wrap items-start sm:items-center space-y-2 sm:space-y-0 sm:space-x-6" <div
_=" class="mb-4 flex flex-col sm:flex-row flex-wrap items-start sm:items-center space-y-2 sm:space-y-0 sm:space-x-6">
on load
let cols = [
{ class: 'col-endpoint', checkbox: 'toggle-endpoint' },
{ class: 'col-url', checkbox: 'toggle-url' },
{ class: 'col-methods', checkbox: 'toggle-methods' },
{ class: 'col-view_func', checkbox: 'toggle-view_func' },
{ class: 'col-description', checkbox: 'toggle-description' }
]
for each col in cols
let state = localStorage[col.class]
if state is 'hidden'
add .hidden to .{col.class}
set checkbox {col.checkbox} to false
else
remove .hidden from .{col.class}
set checkbox {col.checkbox} to true
">
<label class="inline-flex items-center space-x-2" for="toggle-endpoint"> <label class="inline-flex items-center space-x-2" for="toggle-endpoint">
<input id="toggle-endpoint" type="checkbox" checked class="form-checkbox h-6 w-6 text-blue-600" _=" <input id="toggle-endpoint" type="checkbox" checked class="form-checkbox h-6 w-6 text-blue-600"
data-column="col-endpoint" _="
on change on change
if me.checked then if me.checked then
remove .hidden from .col-endpoint remove .hidden from .col-endpoint
set localStorage['col-endpoint'] to 'visible'
else else
add .hidden to .col-endpoint add .hidden to .col-endpoint
set localStorage['col-endpoint'] to 'hidden'
"> ">
<span class="text-gray-700">Endpoint</span> <span class="text-gray-700">Endpoint</span>
</label> </label>
<label class="inline-flex items-center space-x-2" for="toggle-url">
<input id="toggle-url" type="checkbox" checked class="form-checkbox h-6 w-6 text-blue-600" _="
on change
if me.checked then
remove .hidden from .col-url
set localStorage['col-url'] to 'visible'
else
add .hidden to .col-url
set localStorage['col-url'] to 'hidden'
">
<span class="text-gray-700">URL</span>
</label>
<label class="inline-flex items-center space-x-2" for="toggle-methods"> <label class="inline-flex items-center space-x-2" for="toggle-methods">
<input id="toggle-methods" type="checkbox" checked class="form-checkbox h-6 w-6 text-blue-600" _=" <input id="toggle-methods" type="checkbox" checked class="form-checkbox h-6 w-6 text-blue-600"
data-column="col-methods" _="
on change on change
if me.checked then if me.checked then
remove .hidden from .col-methods remove .hidden from .col-methods
set localStorage['col-methods'] to 'visible'
else else
add .hidden to .col-methods add .hidden to .col-methods
set localStorage['col-methods'] to 'hidden'
"> ">
<span class="text-gray-700">Methods</span> <span class="text-gray-700">Methods</span>
</label> </label>
<label class="inline-flex items-center space-x-2" for="toggle-url">
<input id="toggle-url" type="checkbox" checked class="form-checkbox h-6 w-6 text-blue-600"
data-column="col-url" _="
on change
if me.checked then
remove .hidden from .col-url
else
add .hidden to .col-url
">
<span class="text-gray-700">URL</span>
</label>
<label class="inline-flex items-center space-x-2" for="toggle-view_func"> <label class="inline-flex items-center space-x-2" for="toggle-view_func">
<input id="toggle-view_func" type="checkbox" checked class="form-checkbox h-6 w-6 text-blue-600" _=" <input id="toggle-view_func" type="checkbox" checked class="form-checkbox h-6 w-6 text-blue-600"
data-column="col-view_func" _="
on change on change
if me.checked then if me.checked then
remove .hidden from .col-view_func remove .hidden from .col-view_func
set localStorage['col-view_func'] to 'visible'
else else
add .hidden to .col-view_func add .hidden to .col-view_func
set localStorage['col-view_func'] to 'hidden'
"> ">
<span class="text-gray-700">View Function</span> <span class="text-gray-700">View Function</span>
</label> </label>
<label class="inline-flex items-center space-x-2" for="toggle-description"> <label class="inline-flex items-center space-x-2" for="toggle-description">
<input id="toggle-description" type="checkbox" checked class="form-checkbox h-6 w-6 text-blue-600" _=" <input id="toggle-description" type="checkbox" checked class="form-checkbox h-6 w-6 text-blue-600"
data-column="col-description" _="
on change on change
if me.checked then if me.checked then
remove .hidden from .col-description remove .hidden from .col-description
set localStorage['col-description'] to 'visible'
else else
add .hidden to .col-description add .hidden to .col-description
set localStorage['col-description'] to 'hidden'
"> ">
<span class="text-gray-700">Description</span> <span class="text-gray-700">Description</span>
</label> </label>
@@ -99,8 +77,8 @@
{% for route in routes %} {% for route in routes %}
<tr class="hover:bg-gray-100 even:bg-gray-50"> <tr class="hover:bg-gray-100 even:bg-gray-50">
<td class="py-2 px-4 border-b text-sm text-gray-800 col-endpoint">{{ route.endpoint }}</td> <td class="py-2 px-4 border-b text-sm text-gray-800 col-endpoint">{{ route.endpoint }}</td>
<td class="py-2 px-4 border-b text-sm text-gray-800 col-url">{{ route.url }}</td>
<td class="py-2 px-4 border-b text-sm text-gray-800 col-methods">{{ route.methods }}</td> <td class="py-2 px-4 border-b text-sm text-gray-800 col-methods">{{ route.methods }}</td>
<td class="py-2 px-4 border-b text-sm text-gray-800 col-url">{{ route.url }}</td>
<td class="py-2 px-4 border-b text-sm text-gray-800 col-view_func">{{ route.view_func }}</td> <td class="py-2 px-4 border-b text-sm text-gray-800 col-view_func">{{ route.view_func }}</td>
<td class="py-2 px-4 border-b text-sm text-gray-800 col-description"> <td class="py-2 px-4 border-b text-sm text-gray-800 col-description">
{% if route.doc %} {% if route.doc %}