From 855962369ac584ee41b8aac72a1042c067c084d8 Mon Sep 17 00:00:00 2001 From: philipp Date: Mon, 30 Oct 2023 13:49:49 +0100 Subject: [PATCH] use proper names for new form fields --- templates/includes/forms/log.html.tera | 50 +++++++++++++------------- templates/log.html.tera | 43 +++++++++++----------- 2 files changed, 45 insertions(+), 48 deletions(-) diff --git a/templates/includes/forms/log.html.tera b/templates/includes/forms/log.html.tera index e95a6d0..8c8e8e4 100644 --- a/templates/includes/forms/log.html.tera +++ b/templates/includes/forms/log.html.tera @@ -74,27 +74,27 @@ {% endmacro boat_select %} {% macro rower_select(id, selected, amount_seats='', class='', init='false', cox_on_boat='', steering_person_id='') %} - {% if not amount_seats or amount_seats > 1 %} -
- - + {% for user in users %} + {% set_global sel = false %} + {% for rower in selected %} + {% if rower.id == user.id %} + {% set_global sel = true %} + {% endif %} {% endfor %} - -
- {% endif %} + + {% endfor %} + + + {#{% endif %}#} {% endmacro rower_select %} {% macro show(log, state, allowed_to_close=false, only_ones) %} @@ -213,13 +213,11 @@ {% endmacro show_old %} {% macro home(log, only_ones) %} - {# @MB: Maaaarieeee, please fix col-span-2 craziness #} + {# @MB: Maaaarieeee, please fix col-span-2 madness #}
- {% if not only_ones %} - {{ log::rower_select(id="rowers"~log.id, selected=log.rowers, amount_seats=log.boat.amount_seats, class="col-span-2", steering_person_id=log.steering_user.id, cox_on_boat=log.shipmaster_user.id) }} - {{ macros::select(label="Schiffsführer", data=[], name='shipmaster', id="shipmaster-rowers"~log.id, wrapper_class="col-span-2", class="change-id-js", selected_id=log.shipmaster_user.id, required=true) }} - {{ macros::select(label="Steuerperson", data=[], name='steering_person', id="steering_person-rowers"~log.id, wrapper_class="col-span-2", class="change-id-js", selected_id=log.steering_user.id, required=true) }} - {% endif %} + {{ log::rower_select(id="rowers"~log.id, selected=log.rowers, amount_seats=log.boat.amount_seats, class="col-span-2", steering_person_id=log.steering_user.id, cox_on_boat=log.shipmaster_user.id) }} + {{ macros::select(label="Schiffsführer", data=[], name='shipmaster', id="shipmaster-rowers"~log.id, wrapper_class="col-span-2", class="change-id-js", selected_id=log.shipmaster_user.id, required=true) }} + {{ macros::select(label="Steuerperson", data=[], name='steering_person', id="steering_person-rowers"~log.id, wrapper_class="col-span-2", class="change-id-js", selected_id=log.steering_user.id, required=true) }}
{{ macros::checkbox(label="Handgesteuert", name="shipmaster_only_steering", id="shipmaster_only_steering" ~ log.id , checked=log.shipmaster_only_steering,class="rounded-md change-id-js") }} diff --git a/templates/log.html.tera b/templates/log.html.tera index d762149..6126e50 100644 --- a/templates/log.html.tera +++ b/templates/log.html.tera @@ -4,20 +4,19 @@ {% extends "base" %} {% block content %} -

Logbuch

- - {% if flash %} -
- {{ macros::alert(message=flash.1, type=flash.0, class="sm:col-span-2 lg:col-span-3") }} -
- {% endif %} - + + {% if flash %} +
+ {{ macros::alert(message=flash.1, type=flash.0, class="sm:col-span-2 lg:col-span-3") }} +
+ {% endif %} +

Am Wasser

- - {% if on_water | length > 0 %} - {% for log in on_water %} - {% if log.shipmaster == loggedin_user.id %} - {{ log::show(log=log, state="on_water", allowed_to_close=true, only_ones=loggedin_user.is_cox==false) }} - {% else %} - {{ log::show(log=log, state="on_water", only_ones=true) }} - {% endif %} - {% endfor %} - {% else %} -

Kein Boot am Wasser

- {% endif %} + + {% if on_water | length > 0 %} + {% for log in on_water %} + {% if log.shipmaster == loggedin_user.id %} + {{ log::show(log=log, state="on_water", allowed_to_close=true, only_ones=loggedin_user.is_cox==false) }} + {% else %} + {{ log::show(log=log, state="on_water", only_ones=true) }} + {% endif %} + {% endfor %} + {% else %} +

Kein Boot am Wasser

+ {% endif %}
- + {% endblock content%}