edited fuzzystops to indicate first/last stop v2

This commit is contained in:
Johnson Chetty 2012-08-09 22:05:25 +02:00
parent 2883e8b133
commit 5372afe74b
2 changed files with 11 additions and 6 deletions

View File

@ -117,12 +117,12 @@ def fuzzystops(request):
unrd = {} unrd = {}
fs = False fs = False
ls = False ls = False
if unr.from_stop==rds[0]: if unr.from_stop==rds[0].stop:
fs=True fs=True
else: else:
fs=False fs=False
if unr.to_stop==rds[len(rds)-1]: if unr.to_stop==rds[len(rds)-1].stop:
ls=True ls=True
else: else:
ls=False ls=False
@ -131,7 +131,7 @@ def fuzzystops(request):
# import pdb # import pdb
# pdb.set_trace() # pdb.set_trace()
context = RequestContext(request, { context = RequestContext(request, {
'unrs': unrs[0:100] 'unrs': unrs[0:20]
}) })
return render_to_response("fuzzystops.html", context) return render_to_response("fuzzystops.html", context)

View File

@ -21,6 +21,11 @@
<html> <html>
<head> <head>
<script type="text/javascript" src="/static/js/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="/static/js/jquery-1.7.1.min.js"></script>
<style>
.notfirstStop { background-color: #ffdddd }
.notlastStop { background-color: #ffdddd }
</style>
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function() {
$('.submitFuzzyEdit').click(function() { $('.submitFuzzyEdit').click(function() {
@ -83,7 +88,7 @@ function saveUNR(elem, markChecked) {
<td>{{ u.unr.route.alias }}</td> <td>{{ u.unr.route.alias }}</td>
<td>{{ u.unr.from_stop_txt }}</td> <td>{{ u.unr.from_stop_txt }}</td>
<td> <td>
<select class="fromStopSelect {% if u.fs %} firstStop {% endif %}" > <select class="fromStopSelect {% if not u.stop_is_first %} notfirstStop {% endif %}" >
{% for stop in u.unr.get_stop_choices %} {% for stop in u.unr.get_stop_choices %}
<option value="{{ stop.id }}" {% ifequal u.unr.from_stop stop %} selected="selected" {% endifequal %}> <option value="{{ stop.id }}" {% ifequal u.unr.from_stop stop %} selected="selected" {% endifequal %}>
{{ stop.display_name }} {{ stop.display_name }}
@ -91,10 +96,10 @@ function saveUNR(elem, markChecked) {
{% endfor %} {% endfor %}
</select> </select>
</td> </td>
<td>{{ u.unr.to_stop_txt }}</td> <td>{{ u.unr.to_stop_txt }}</td>
<td> <td>
<select class="toStopSelect {% if u.fs %} lastStop {% endif %}" > <select class="toStopSelect {% if not u.stop_is_last %} notlastStop {% endif %}" >
{% for stop in u.unr.get_stop_choices %} {% for stop in u.unr.get_stop_choices %}
<option value="{{ stop.id }}" {% ifequal u.unr.to_stop stop %} selected="selected" {% endifequal %}> <option value="{{ stop.id }}" {% ifequal u.unr.to_stop stop %} selected="selected" {% endifequal %}>
{{ stop.display_name }} {{ stop.display_name }}