forked from Ruderverein-Donau-Linz/rowt
fixes
This commit is contained in:
parent
c37d9fa393
commit
fad7d747d7
@ -7,7 +7,7 @@
|
||||
var selectedOption = selectElement.selectedOptions[0];
|
||||
var shipmaster_only_steering = selectedOption.getAttribute("extra-default_shipmaster_only_steering") === 'true';
|
||||
document.getElementById('shipmaster_only_steering').checked = shipmaster_only_steering;
|
||||
document.getElementById('new-rower-max_rower_allowed').innerHTML = selectedOption.getAttribute("extra-amount_seats");
|
||||
document.getElementById('newrower-max_rower_allowed').innerHTML = selectedOption.getAttribute("extra-amount_seats");
|
||||
}
|
||||
|
||||
document.getElementById('boat_id').addEventListener('change', updateElementsBasedOnSelectedOption);
|
||||
@ -35,7 +35,7 @@
|
||||
{{ macros::input(label="Distanz", name="distance_in_km", type="number", min=0) }}
|
||||
{{ macros::input(label="Kommentar", name="comments", type="text") }}
|
||||
{{ macros::select(data=logtypes, select_name='logtype', default="Normal") }}
|
||||
{{ log::rower_select(id="new-rower", selected=[]) }}
|
||||
{{ log::rower_select(id="newrower", selected=[]) }}
|
||||
<input type="submit" />
|
||||
|
||||
<script>
|
||||
@ -106,29 +106,29 @@
|
||||
{{ macros::input(label="Kommentar", name="comments", type="text", value=log.comments) }}
|
||||
{{ macros::select(data=logtypes, select_name='logtype', default="Normal", selected_id=log.logtype) }}
|
||||
|
||||
{{ log::rower_select(id="rowers-"~log.id, selected=log.rowers, amount_seats=log.boat.amount_seats) }}
|
||||
{{ log::rower_select(id="rowers"~log.id, selected=log.rowers, amount_seats=log.boat.amount_seats) }}
|
||||
<input type="submit" value="AUSFAHRT BEENDEN"/>
|
||||
</form>
|
||||
{% endmacro home %}
|
||||
|
||||
|
||||
{% macro rower_select(id, selected, amount_seats='') %}
|
||||
<select multiple="multiple" name="rower[]" id="{{id}}" onclick="updateSelectedRowersCount()" onblur="updateSelectedRowersCount()">
|
||||
{% for user in users %}
|
||||
{% set_global sel = false %}
|
||||
{% for rower in selected %}
|
||||
{% if rower.id == user.id %}
|
||||
{% set_global sel = true %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<option value="{{ user.id }}" {% if sel %}selected{% endif %} onmousedown="event.preventDefault();this.selected = !this.selected; return false;">{{user.name}}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<script>
|
||||
function updateSelectedRowersCount() {
|
||||
document.getElementById('{{id}}-amount_rower_selected').textContent = document.getElementById('{{id}}').selectedOptions.length+1;
|
||||
}
|
||||
document.addEventListener('DOMContentLoaded', updateSelectedRowersCount);
|
||||
</script>
|
||||
<span id="{{id}}-amount_rower_selected"></span>/<span id="{{id}}-max_rower_allowed">{{amount_seats}}</span> Ruderer ausgewählt
|
||||
<select multiple="multiple" name="rower[]" id="{{id}}" onclick="updateSelectedRowersCount{{id}}()" onblur="updateSelectedRowersCount{{id}}()">
|
||||
{% for user in users %}
|
||||
{% set_global sel = false %}
|
||||
{% for rower in selected %}
|
||||
{% if rower.id == user.id %}
|
||||
{% set_global sel = true %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<option value="{{ user.id }}" {% if sel %}selected{% endif %} onmousedown="event.preventDefault();this.selected = !this.selected; return false;">{{user.name}}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<script>
|
||||
function updateSelectedRowersCount{{id}}() {
|
||||
document.getElementById('{{id}}-amount_rower_selected').textContent = document.getElementById('{{id}}').selectedOptions.length+1;
|
||||
}
|
||||
document.addEventListener('DOMContentLoaded', updateSelectedRowersCount{{id}});
|
||||
</script>
|
||||
<span id="{{id}}-amount_rower_selected"></span>/<span id="{{id}}-max_rower_allowed">{{amount_seats}}</span> Ruderer ausgewählt
|
||||
{% endmacro rower_select %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user