Migrate Get Location/Weather + required-field validation out of the template's inline scripts into the bundle: generalize the field lookup so weather_desc (now a <select>) is found, gate Get Weather until coords exist, and add idle/loading/success/error states. Build the 'More options' <details> (native, KTD5) around the advanced trio, auto-open when any has a value. Add Field Notes CSS: select/number styling, EasyMDE dark theme, disclosure, button spinner, and server form-message states. Refs R5, R11, R12, R18, R19, AE3, KTD5.
23 lines
900 B
Twig
23 lines
900 B
Twig
{% extends 'default.html.twig' %}
|
|
|
|
{% block head_assets %}
|
|
{% do assets.addCss('theme://css-compiled/post-form.css') %}
|
|
<script type="module" src="{{ url('theme://js/post/post-form.js') }}"></script>
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="post-form-wrap">
|
|
<h1>New Entry</h1>
|
|
{% include 'forms/form.html.twig' ignore missing %}
|
|
|
|
<div class="form-action-row">
|
|
<button type="button" id="get-location" class="btn-action">📍 Get Location</button>
|
|
<button type="button" id="get-weather" class="btn-action" disabled>🌤 Get Weather</button>
|
|
</div>
|
|
<p id="location-status" class="form-status" role="status"></p>
|
|
<p id="weather-status" class="form-status" role="status"></p>
|
|
</div>
|
|
{# Get Location / Get Weather, disclosure, and validation all live in the
|
|
page-scoped bundle (js/src/post-form.js), loaded via head_assets above. #}
|
|
{% endblock %}
|