Fix id outputting in fuzzystops template

Eliminate Save button
This commit is contained in:
Sanj 2012-08-10 02:53:04 +05:30
parent bc2b00b769
commit 36cf1cc2c4
2 changed files with 5 additions and 3 deletions

View File

@ -113,7 +113,7 @@ def fuzzystops(request):
end = int(request.GET.get("end", start + 50)) end = int(request.GET.get("end", start + 50))
show_checked = request.GET.get("show_checked", False) show_checked = request.GET.get("show_checked", False)
unrs = [] unrs = []
for unr in UniqueRoute.objects.all(): for unr in UniqueRoute.objects.all().order_by('route__code'):
if FuzzyStopMatch.objects.filter(unr=unr).filter(checked=True).count() > 0: if FuzzyStopMatch.objects.filter(unr=unr).filter(checked=True).count() > 0:
if not show_checked: if not show_checked:

View File

@ -40,11 +40,13 @@ $(function() {
$('.fromStopSelect').change(function() { $('.fromStopSelect').change(function() {
var firstOpt = $(this).children().first(); var firstOpt = $(this).children().first();
firstOpt.attr("selected") ? $(this).removeClass("notfirstStop") : $(this).addClass("notfirstStop"); firstOpt.attr("selected") ? $(this).removeClass("notfirstStop") : $(this).addClass("notfirstStop");
$(this).parents('tr').find('.submitFuzzyEdit').click();
}); });
$('.toStopSelect').change(function() { $('.toStopSelect').change(function() {
var lastOpt = $(this).children().last(); var lastOpt = $(this).children().last();
lastOpt.attr("selected") ? $(this).removeClass("notlastStop") : $(this).addClass("notlastStop"); lastOpt.attr("selected") ? $(this).removeClass("notlastStop") : $(this).addClass("notlastStop");
$(this).parents('tr').find('.submitFuzzyEdit').click();
}); });
}); });
@ -95,7 +97,7 @@ function saveUNR(elem, markChecked) {
</thead> </thead>
<tbody> <tbody>
{% for u in unrs %} {% for u in unrs %}
<tr data-id="{{ u.id }}"> <tr data-id="{{ u.unr.id }}">
<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>
@ -121,7 +123,7 @@ function saveUNR(elem, markChecked) {
<td> <td>
<!-- Change all: <input type="checkbox" class="changeAll" /> &nbsp; --> <!-- Change all: <input type="checkbox" class="changeAll" /> &nbsp; -->
<button class="submitFuzzyEdit">Save</button> &nbsp; <button class="submitFuzzyEdit" style="display:none;">Save</button> &nbsp;
<button class="markChecked">Checked</button> &nbsp; <button class="markChecked">Checked</button> &nbsp;
</td> </td>