Rename some templates and convert remaining js to hyperscript

This commit is contained in:
Peter Stockings
2023-10-20 20:04:07 +11:00
parent 996e47d2b4
commit dc13b05420
6 changed files with 17 additions and 23 deletions

View File

@@ -1,8 +1,10 @@
<div class="flex justify-center pt-4 px-4">
<div class="mb-3 w-full md:w-1/3">
<select id="multiSelection-{{ workout.id }}" data-te-select-init name="graph_types" class="mx-auto w-full" multiple
hx-trigger="change" hx-get="{{ url_for('view_workout', user_id=workout.user_id, workout_id=workout.id) }}"
hx-target="#workout_view-{{ workout.id }}">
<select data-te-select-init name="graph_types" class="mx-auto w-full" multiple hx-trigger="change"
hx-get="{{ url_for('view_workout', user_id=workout.user_id, workout_id=workout.id) }}"
hx-target="#workout_view-{{ workout.id }}" _="init js(me)
te.Select.getOrCreateInstance(me).setValue({{ graph_types | safe }})
end">
<option value="cadence" {% if 'cadence' in graph_types %} selected {% endif%}>Cadence</option>
<option value="speed" {% if 'speed' in graph_types %} selected {% endif%}>Speed</option>
<option value="power" {% if 'power' in graph_types %} selected {% endif%}>Power</option>
@@ -12,9 +14,6 @@
</select>
</div>
</div>
<script>
te.Select.getOrCreateInstance(document.querySelector("#multiSelection-{{ workout.id }}")).setValue({{ graph_types| safe }});
</script>
{% for graph_type in graph_types %}
<img src="{{ url_for('workout', user_id=workout.user_id, workout_id=workout.id, graph_type=graph_type) }}"