Permalink
Browse files

Minor fixes

  • Loading branch information...
1 parent 7cd1d1c commit 978984ecc090df8d0a4a85166d8251e9c0763887 @madewulf committed Oct 1, 2012
Showing with 27 additions and 7 deletions.
  1. +1 −1 app.py
  2. +24 −4 static/js/pyramid.js
  3. +2 −2 templates/index.html
View
2 app.py
@@ -43,7 +43,7 @@ def pyramid(country="WORLD",year="2010",currentLetter=None):
country_tuples.append((c,countries_dict[c]))
big_tuple = (letter,country_tuples)
countries_lists.append(big_tuple)
- current_url = "http://populationpyramid.net/%s/%s"%(country,year)
+ current_url = "http://populationpyramid.net/%s/%s/"%(country,year)
return render_template("index.html",
currentCountry=country,
View
@@ -64,9 +64,20 @@ function generatePath()
}
window.onpopstate = function (event) {
- var state = event.state;
- currentCountry = state.currentCountry;
- currentYear = state.currentYear;
+ /* var state = event.state;
+ if (state)
+ {
+ console.log(state);
+ currentCountry = state.currentCountry;
+ currentYear = state.currentYear;
+ yearsDict[currentYear].attr({fill:'#D156BF',fontWeight:'bold'});
+ var p2 = generatePath( );
+ $("#yearSelect").val(year);
+ c.animate({path:p2}, 1000);
+ setTopLabels();
+ drawPopulationCurve();
+ drawCrossOnPopGraph();
+ }*/
};
@@ -148,7 +159,13 @@ function changeUrl() {
if (history.pushState)
- history.pushState({"currentYear":previousYear,"currentCountry":previousCountry}, "", "/" + currentCountry + "/" + currentYear);
+ history.pushState(
+ {
+ currentYear:previousYear,
+ currentCountry:previousCountry
+ },
+ "",
+ "/" + currentCountry + "/" + currentYear+"/");
}
function changePyramidInfo()
@@ -251,6 +268,7 @@ function getMouseoutHandlerPopGraph(rect)
function onYearPicked(year)
{
previousYear = currentYear;
+ previousCountry= currentCountry;
currentYear = year;
yearsSet.attr({fill:'#07669d'});
yearsDict[year].attr({fill:'#D156BF',fontWeight:'bold'});
@@ -390,6 +408,7 @@ function drawPopGraphCanvas()
$(function () {
$(".countryList").hide();
$("#years").hide();
+ $("#yearSelect").val(currentYear);
$("#yearSelect").change(function(){
var year = $(this).val();
onYearPicked(year);
@@ -431,6 +450,7 @@ $(function () {
$(".country_link").click(function (event) {
event.preventDefault();
previousCountry = currentCountry;
+ previousYear= currentYear;
currentCountry = $(this).attr("id");
$(".country_link").removeClass("selected_link");
$(this).addClass("selected_link");
View
@@ -101,8 +101,8 @@ <h2 style="float:right">
<div id="selectBox">
<select id="yearSelect">
{% for year in years %}
- <option value="{{year}}"
- {%if year==currentYear %}selected="selected"{%endif%}>{{year}}</option>
+ <option value="{{year}}"> {{year}}
+ </option>
{%endfor %}
</select>
</div>

0 comments on commit 978984e

Please sign in to comment.