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> </ul>
<div id="my-tab-content" class="tab-content"> <div id="my-tab-content" class="tab-content">
{% for vehicle in current_user.vehicles %} {% for vehicle in current_user.vehicles %}
{% set vehicleloop = loop %}
<div class="tab-pane {% if loop.first %}active{% endif %}" id="v{{vehicle.id}}"> <div class="tab-pane {% if loop.first %}active{% endif %}" id="v{{vehicle.id}}">
<h3>{{vehicle.name}}</h3> <h3>{{vehicle.name}}</h3>
{% if vehicle.pitstops %} {% if vehicle.pitstops %}
@ -22,19 +23,19 @@
<table class="table table-striped table-bordered table-condensed"> <table class="table table-striped table-bordered table-condensed">
<tr> <tr>
<th>Date</th> <th>Date</th>
<td>{{pitstop.date}}</td> <td id="vehicle_{{vehicleloop.index}}_pitstop_{{loop.index}}_date">{{pitstop.date}}</td>
</tr> </tr>
<tr> <tr>
<th>Odometer</th> <th>Odometer</th>
<td>{{pitstop.odometer}} km</td> <td id="vehicle_{{vehicleloop.index}}_pitstop_{{loop.index}}_odo">{{pitstop.odometer}} km</td>
</tr> </tr>
<tr> <tr>
<th>{{ pitstop.consumable.name }}</th> <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>
<tr> <tr>
<th>Costs</th> <th>Costs</th>
<td> <td id="vehicle_{{vehicleloop.index}}_pitstop_{{loop.index}}_cost">
{% if pitstop.costs %} {% if pitstop.costs %}
{{pitstop.costs}} € {{pitstop.costs}} €
{% else %} {% else %}
@ -44,10 +45,10 @@
</tr> </tr>
</table> </table>
{% if loop.first %} {% 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 <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> edit
</a> </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 <span class="glyphicon glyphicon-trash" aria-hidden="true"></span> delete
</a> </a>
{% endif %} {% endif %}