Skip to content

Commit

Permalink
all apps working in TF tab #186
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminleichter committed Jun 18, 2014
1 parent 334de61 commit 1d1e7fe
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 20 deletions.
2 changes: 1 addition & 1 deletion django_files/observatory/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1332,7 +1332,7 @@ def explore(request, app_name, trade_flow, country1, country2, product, year="20
if app_type in ["cspy", "sapy"]:
prod_or_partner = "product"
elif app_type == "casy":
if app_name in ("stacked", "map", "tree_map"):
if app_name in ("stacked", "map", "tree_map","pie_scatter", "product_space"):
prod_or_partner = "product"


Expand Down
42 changes: 25 additions & 17 deletions html/explore/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -253,23 +253,34 @@ <h2 style="margin-left:10px; width:700px;" id="text_title" >{% if title %}{{titl
<div id="tfViz" data-toggle="buttons" style="margin-left:5px;">

<label value="tree_map" class="btn btn-default {% if app_name == 'tree_map' %}active{% endif %} tooltipbs" data-placement="top" data-toggle="tooltip">
<input type="radio" style="background:url({{ STATIC_URL }}img/home/treeMap-thumb.png) no-repeat;"> <img src="{{ STATIC_URL }}img/home/treeMap-thumb.png" style="width:38px;"/>
<input type="radio" style="background:url({{ STATIC_URL }}img/home/treeMap-thumb.png) no-repeat;">
<img src="{{ STATIC_URL }}img/home/treeMap-thumb.png" style="width:38px;"/>
</label>

<label value="map" class="btn btn-default {% if app_name == 'map' %}active{% endif %}" data-placement="top" data-toggle="tooltip" title="Map" >
<input type="radio" style="background:url({{ STATIC_URL }}img/home/geo-thumb.png) no-repeat;"> <img src="{{ STATIC_URL }}img/home/geo-thumb.png" style="width:38px;"/>
<input type="radio" style="background:url({{ STATIC_URL }}img/home/geo-thumb.png) no-repeat;">
<img src="{{ STATIC_URL }}img/home/geo-thumb.png" style="width:38px;"/>
</label>

<label value="stacked" class="btn btn-default {% if year_interval_list %}active{%endif%} tooltipbs" data-placement="top" data-toggle="tooltip" title="Stacked Graph" >
<input type="radio" name="viz_apps"> <img src="{{ STATIC_URL }}img/home/stacked-thumb.png" style="width:38px;"/>
<input type="radio" name="viz_apps">
<img src="{{ STATIC_URL }}img/home/stacked-thumb.png" style="width:38px;"/>
</label>
<label value="product_space" class="btn btn-default {% if year_interval_list %}active{%endif%} tooltipbs" data-placement="top" data-toggle="tooltip" title="Product Space" >
<input type="radio" name="viz_apps" > <img src="{{ STATIC_URL }}img/home/productSpace-thumb.png" style="width:38px;"/>

<label value="product_space" class="btn btn-default {% if app_name == 'product_space' %}active{% endif %}" data-placement="top" data-toggle="tooltip" title="Product Space" >
<input type="radio" style="background:url({{ STATIC_URL }}img/home/productSpace-thumb.png) no-repeat;">
<img src="{{ STATIC_URL }}img/home/productSpace-thumb.png" style="width:38px;"/>
</label>

<label value="pie_scatter" class="btn btn-default {% if app_name == 'pie_scatter' %}active{% endif %}" data-placement="top" data-toggle="tooltip" title="Product Feasability" >
<input type="radio" style="background:url({{ STATIC_URL }}img/home/ProductFeas2-thumb.png) no-repeat;">
<img src="{{ STATIC_URL }}img/home/ProductFeas2-thumb.png" style="width:38px;"/>
</label>
<label value="pie_scatter" class="btn btn-default {% if year_interval_list %}active{%endif%} tooltipbs" data-placement="top" data-toggle="tooltip" title="Product Feasability">
<input type="radio" name="viz_apps"> <img src="{{ STATIC_URL }}img/home/ProductFeas2-thumb.png" style="width:38px;"/>
</label>

{% if app_name == "rings" %}
<label value="rings" class="btn btn-default {% if year_interval_list %}active{%endif%} tooltipbs" data-placement="top" data-toggle="tooltip" title="Rings" >
<input type="radio" name="viz_apps"> <img src="{{ STATIC_URL }}img/home/rings-thumb.png" style="width:38px;"/>
<input type="radio" name="viz_apps">
<img src="{{ STATIC_URL }}img/home/rings-thumb.png" style="width:38px;"/>
</label>
{% endif %}
{% if app_name == 'scatterplot' or app_name == 'rankings' %}
Expand Down Expand Up @@ -1566,13 +1577,10 @@ <h4 style="border-bottom: solid 1px #999; font-family:'PT Sans Narrow',Helvetica
$(this).tab('show')
})

$('label[value=map]').click(function() { return update_viz("map"); } );
$('label[value=tree_map]').click(function() { return update_viz("tree_map"); } );
$('label[value=stacked]').click(function() { return update_viz("stacked"); } );
$('label[value=scatterplot]').click(function() { return update_viz("scatterplot"); } );
$('label[value=rankings]').click(function() { return update_viz("rankings"); } );
$('label[value=pie_scatter]').click(function() { return update_viz("pie_scatter"); } );
$('label[value=product_space]').click(function() { return update_viz("product_space"); } );

$("label").click(function(){
return update_viz($(this).attr("value"));
});

//To display visualization in full screen, while viewing stories
var contentWidth=$("#content").width();
Expand Down Expand Up @@ -1654,7 +1662,7 @@ <h4 style="border-bottom: solid 1px #999; font-family:'PT Sans Narrow',Helvetica
remove_overlay();
}
}
});
});
</script>
</body>
{% include "story/story_forms.html" %}
Expand Down
6 changes: 4 additions & 2 deletions media/js/explore/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ function update_viz(viz) {
// http://127.0.0.1:8000/explore/tree_map/export/usa/all/show/2011/
if(current_year2=="") {

if(current_viz == "tree_map" || current_viz == "scatterplot" || current_viz == "rankings")
if(current_viz == "tree_map" || current_viz == "scatterplot" || current_viz == "rankings" || current_viz == "pie_scatter" || current_viz == "product_space")
url += current_viz+"/"+current_flow+"/"+current_country1+"/all/show/"+current_year1+"/";
else if(current_viz == "map") // Can't be a map of products
url += current_viz+"/"+current_flow+"/"+current_country1+"/show/all/"+current_year1+"/";
Expand Down Expand Up @@ -358,7 +358,9 @@ function update_viz(viz) {
if(current_viz == "tree_map" || current_viz == "scatterplot" || current_viz == "rankings")
url += current_viz+"/"+current_flow+"/"+current_country1+"/"+current_country2+"/show/"+current_year1+"/";
else if(current_viz == "map") // Can't be a map of products
url += current_viz+"/"+current_flow+"/"+current_country1+"/show/all/"+current_year1+"/";
url += current_viz+"/"+current_flow+"/"+current_country1+"/show/all/"+current_year1+"/";
else if(current_viz == "pie_scatter" || current_viz == "product_space")
url += current_viz+"/"+current_flow+"/"+current_country1+"/show/all/"+current_year1+"/";
else
console.log("Should not be here")

Expand Down

0 comments on commit 1d1e7fe

Please sign in to comment.