This commit is contained in:
Sanj 2012-02-22 15:43:29 +05:30
parent 5edb287f65
commit ae87b507d3
3 changed files with 57 additions and 7 deletions

View File

@ -1,6 +1,7 @@
html, body { html, body {
width: 100%; width: 100%;
height: 100%; height: 100%;
font-family: Arial, Helvetica, Verdana, sans-serif;
} }
#wrapper { #wrapper {
@ -38,6 +39,7 @@ html, body {
.listItem { .listItem {
cursor: pointer; cursor: pointer;
font-size: 13px;
} }
.tabButton { .tabButton {
@ -49,12 +51,20 @@ html, body {
padding: 4px; padding: 4px;
} }
.listItemText {
display: block;
}
.selectedListItem .listItemText { .selectedListItem .listItemText {
color: blue; background: #666;
color: #fff;
} }
.selectedStop { .selectedStop {
color: blue !important; background: #ffff00;
color: #666 !important;
font-weight: bold;
} }
.clear { .clear {
@ -71,10 +81,30 @@ html, body {
ul { ul {
list-style-type: none; list-style-type: none;
padding-left: 4px; padding: 4px;
font-size: 12px;
} }
.highlightedStop { .highlightedStop {
background-color: #FFFF00; background-color: #FFFF00;
} }
#formCol {
font-size: 13px;
}
#formCol div {
margin-bottom: 4px;
}
.stopSlug {
font-style: italic;
}
#stopForm label {
display: block;
}
#stopForm input {
width: 90%;
}

View File

@ -43,10 +43,19 @@ var API_BASE = "/1.0/",
if ($target.data("loading")) { if ($target.data("loading")) {
return; return;
} }
$('.selectedListItem').find(".stopsList").hide(); if ($target.hasClass("selectedListItem")) {
$target.find(".stopsList").hide().remove();
$target.removeClass("selectedListItem");
return;
}
$('.selectedListItem').find(".stopsList").hide().remove();
$('.selectedListItem').removeClass("selectedListItem"); $('.selectedListItem').removeClass("selectedListItem");
$target.addClass("selectedListItem"); $target.addClass("selectedListItem");
if ($target.data("hasList")) { if ($target.data("hasList")) {
var $stopsList = $target.find(".stopsList");
$stopsList.slideDown();
return;
/*
var $stopsList = $target.find(".stopsList"); var $stopsList = $target.find(".stopsList");
if (!$stopsList.is(":visible")) { if (!$stopsList.is(":visible")) {
$stopsList.slideDown(); $stopsList.slideDown();
@ -54,7 +63,8 @@ var API_BASE = "/1.0/",
$stopsList.slideUp(); $stopsList.slideUp();
$target.removeClass("selectedListItem"); $target.removeClass("selectedListItem");
} }
return; return;
*/
} }
var url = API_BASE + name + "/" + $target.find(".listItemText").text(); var url = API_BASE + name + "/" + $target.find(".listItemText").text();
$target.data("loading", true); $target.data("loading", true);
@ -77,7 +87,7 @@ var API_BASE = "/1.0/",
var maxExtent = jsonLayer.getDataExtent(); var maxExtent = jsonLayer.getDataExtent();
map.zoomToExtent(maxExtent); map.zoomToExtent(maxExtent);
$target.append($stopsList); $target.append($stopsList);
$target.data("hasList", true); // $target.data("hasList", true);
$target.data("loading", false); $target.data("loading", false);
}); });
}); });
@ -149,8 +159,9 @@ var API_BASE = "/1.0/",
var $displayName = $('<div />').text(stop.display_name).appendTo($div); var $displayName = $('<div />').text(stop.display_name).appendTo($div);
var $slug = $('<div />').addClass("stopSlug").text(stop.slug).appendTo($div); var $slug = $('<div />').addClass("stopSlug").text(stop.slug).appendTo($div);
var $routes = $('<div />').text("Routes: " + stop.routes).appendTo($div); var $routes = $('<div />').text("Routes: " + stop.routes).appendTo($div);
// var $formLabel = $("<div />").text("Edit:").appendTo($div);
var $form = $('<form />').attr("id", "stopForm").appendTo($div); var $form = $('<form />').attr("id", "stopForm").appendTo($div);
var $display_name_label = $('<label />').attr("for", "displayName").text("Display Name:").appendTo($form);;
var $display_name_input = $('<input />') var $display_name_input = $('<input />')
.val(stop.display_name) .val(stop.display_name)
.attr("id", "displayName") .attr("id", "displayName")
@ -158,6 +169,8 @@ var API_BASE = "/1.0/",
$form.submit(); $form.submit();
}) })
.appendTo($form); .appendTo($form);
$('<br />').appendTo($form);
var $name_mr_label = $('<label />').attr("for", "displayNameMr").text("Marathi Name:").appendTo($form);
var $name_mr_input = $('<input />') var $name_mr_input = $('<input />')
.val(stop.name_mr) .val(stop.name_mr)
.attr("id", "displayNameMr") .attr("id", "displayNameMr")
@ -165,6 +178,8 @@ var API_BASE = "/1.0/",
$form.submit(); $form.submit();
}) })
.appendTo($form); .appendTo($form);
$('<br />').appendTo($form);
var $alt_names_label = $('<label />').attr("for", "altNames").text("Alternative Names:").appendTo($form);
var $alt_names_input = $('<input />') var $alt_names_input = $('<input />')
.val(stop.alternative_names) .val(stop.alternative_names)
.attr("id", "altNames") .attr("id", "altNames")
@ -243,6 +258,7 @@ var API_BASE = "/1.0/",
} else { } else {
var pt = new OpenLayers.Geometry.Point(lonlat.lon, lonlat.lat); var pt = new OpenLayers.Geometry.Point(lonlat.lon, lonlat.lat);
var feature = new OpenLayers.Feature.Vector(pt, stop); var feature = new OpenLayers.Feature.Vector(pt, stop);
$('.selectedStop').removeClass("no_has_point").addClass("has_point");
//console.log("trying to add", feature); //console.log("trying to add", feature);
jsonLayer.addFeatures([feature]); jsonLayer.addFeatures([feature]);
mapControl.select(feature); mapControl.select(feature);

View File

@ -1,5 +1,9 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% block title %}
Edit Stops
{% endblock %}
{% block head %} {% block head %}
<link rel="stylesheet" href="/static/css/editstops.css" /> <link rel="stylesheet" href="/static/css/editstops.css" />
<script type="text/javascript" src="/static/js/editstops.js"></script> <script type="text/javascript" src="/static/js/editstops.js"></script>