add ids to pitstop elements

This commit is contained in:
Joachim Lusiardi 2016-08-07 13:18:04 +02:00
parent 4b73699750
commit 4acf36112c
1 changed files with 7 additions and 6 deletions

View File

@ -13,6 +13,7 @@
</ul>
<div id="my-tab-content" class="tab-content">
{% for vehicle in current_user.vehicles %}
{% set vehicleloop = loop %}
<div class="tab-pane {% if loop.first %}active{% endif %}" id="v{{vehicle.id}}">
<h3>{{vehicle.name}}</h3>
{% if vehicle.pitstops %}
@ -22,19 +23,19 @@
<table class="table table-striped table-bordered table-condensed">
<tr>
<th>Date</th>
<td>{{pitstop.date}}</td>
<td id="vehicle_{{vehicleloop.index}}_pitstop_{{loop.index}}_date">{{pitstop.date}}</td>
</tr>
<tr>
<th>Odometer</th>
<td>{{pitstop.odometer}} km</td>
<td id="vehicle_{{vehicleloop.index}}_pitstop_{{loop.index}}_odo">{{pitstop.odometer}} km</td>
</tr>
<tr>
<th>{{ pitstop.consumable.name }}</th>
<td>{{pitstop.amount}} {{ pitstop.consumable.unit }}</td>
<td id="vehicle_{{vehicleloop.index}}_pitstop_{{loop.index}}_anmount">{{pitstop.amount}} {{ pitstop.consumable.unit }}</td>
</tr>
<tr>
<th>Costs</th>
<td>
<td id="vehicle_{{vehicleloop.index}}_pitstop_{{loop.index}}_cost">
{% if pitstop.costs %}
{{pitstop.costs}} €
{% else %}
@ -44,10 +45,10 @@
</tr>
</table>
{% if loop.first %}
<a href="{{ url_for('edit_pit_stop_form', pid=pitstop.id) }}" class="btn btn-primary">
<a id="vehicle_{{vehicleloop.index}}_edit_pitstop_{{loop.index}}" href="{{ url_for('edit_pit_stop_form', pid=pitstop.id) }}" class="btn btn-primary">
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> edit
</a>
<a href="{{ url_for('delete_pit_stop_form', pid=pitstop.id) }}" class="btn btn-primary btn-warning ">
<a id="vehicle_{{vehicleloop.index}}_delete_pitstop_{{loop.index}}" href="{{ url_for('delete_pit_stop_form', pid=pitstop.id) }}" class="btn btn-primary btn-warning ">
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span> delete
</a>
{% endif %}