Skip to content

Commit

Permalink
Hide hellbox when no static image
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminleichter committed May 21, 2014
1 parent 6c7a1d4 commit 10ccb96
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 60 deletions.
3 changes: 0 additions & 3 deletions django_files/locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ msgstr "Products"
msgid "Bilateral"
msgstr "Bilateral"

msgid "Export"
msgstr "Export"

msgid "Imports"
msgstr "Imports"

Expand Down
10 changes: 6 additions & 4 deletions html/explore/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ <h2 style="margin-left:10px; width:700px;" id="text_title">{% if title %}{{title
<ul style="margin-bottom:0px; padding-bottom:0px;" class="nav nav-tabs">
<li id="helpTab" {% if app_name != "product_space" and app_name != "pie_scatter" %}class="active"{% endif %}><a href="#helpPane" data-toggle="tab">Help</a></li>

{% if previous_page != "http://atlas.cid.harvard.edu/" and previous_page != "http://127.0.0.1:8000/" and previous_page != "None" %}
{% if previous_page != "http://atlas.cid.harvard.edu/" and previous_page != "http://127.0.0.1:8000/" and previous_page != "None"%}
<li id="historyTab"><a href="#history" data-toggle="tab">History</a></li>
{% endif %}

Expand Down Expand Up @@ -1551,8 +1551,10 @@ <h4 style="border-bottom: solid 1px #999; font-family:'PT Sans Narrow',Helvetica
<script type="text/javascript" src="../media/js/explore/tooltips.js"></script>
<script type="text/javascript" src="../media/js/libs/tipsy/tipsy.jquery.js"></script>
<script type='text/javascript'>
$(function(){$('button[title]').tipsy({gravity: 'w', delayIn: 500});});
$(function(){$('label[title]').tipsy({gravity: 'n', delayIn: 500});});
$(function(){
$('button[title]').tipsy({gravity: 'w', delayIn: 500});
$('label[title]').tipsy({gravity: 'n', delayIn: 500});
});
</script>

<script type="text/javascript">
Expand All @@ -1561,7 +1563,7 @@ <h4 style="border-bottom: solid 1px #999; font-family:'PT Sans Narrow',Helvetica
$("#historyTab").css("display", "none");
$("#history").css("display", "none");
console.log("no previous page!");
} else if(previous_image == "{{ STATIC_URL }}img/empty_static.png"){
} else if(previous_image == "http://atlas.cid.harvard.edu/media/img/all/loader.gif"){
console.log("this page doesn't exist!");
} else{
previous_image = "http://atlas.cid.harvard.edu{{ displayImage }}";
Expand Down
7 changes: 4 additions & 3 deletions media/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -965,11 +965,11 @@ dl.file_list p {
width: 250px;
vertical-align: top;
}
.atlas_book_content{

#about .atlas_book_content{
overflow:auto;
}
#main #content .atlas_book_content img{
margin: 20px 60px;
margin: 0 auto;
}
#main #content .license{
font-size: 10px;
Expand Down Expand Up @@ -2149,3 +2149,4 @@ table tbody tr td span {
table tr.odd {
background-color: #EEE;
}

69 changes: 20 additions & 49 deletions media/js/explore/tooltips.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,12 @@
toolTips = [];
if($("body").attr("id") != "about"){
$.ajax({
url: "/about/glossary/",
cache: false
})
$.ajax({
type: "GET",
url: "/about/glossary/",
processData:false,
cache: false
})
.done(function( html ) {

.done(function( html ) { // creates array containing first sentences

var text = $("dl dd");

text.each(function(){

var elem = $(this);

var textParts = elem.html().split("."); // Breaks text at period and puts groups into array

var first = textParts.shift(); // removes and returns first element of said array

toolTips.push(first); // pushes said element to toolTips[]
})

});
}

else{

var text = $("dl dd");

Expand All @@ -36,21 +19,21 @@ else{
var first = textParts.shift(); // removes and returns first element of said array

toolTips.push(first); // pushes said element to toolTips[]
})
}
});
});

var replace = {
"Capability Distance": "<span class='gTerm'title='Measures a country’s ability to make a specific product based upon its current export basket and productive capabilities.' toolTip='2'>Capability Distance</span>",
"Diversity": "<span class='gTerm'title='Measures how many different types of products a country is able to make.' toolTip='2'>Diversity</span>",
"Economic Complexity": "<span class='gTerm'title='A measure of the knowledge in a society that gets translated into the products it makes.' toolTip='2'>Economic Complexity</span>",
"Economic Complexity Indicator": "<span class='gTerm'title='ECI is a scale that shows which countries are economically complex and which are not.' toolTip='2'>Economic Complexity Indicator</span>",
"Expected Growth": "<span class='gTerm'title='Predicts the degree to which a country will grow dependent upon its current level of Economic Complexity, its location within The Product Space, as well as current GDP.' toolTip='2'>Expected Growth</span>",
"Nearby (adjacent possible)": "<span class='gTerm'title='Describes a product that requires similar productive capabilities to another product.' toolTip='2'>Nearby (adjacent possible)</span>",
"Productive Knowlege": "<span class='gTerm'title='A form of knowledge or know-how to produce things.' toolTip='2'>Productive Knowlege</span>",
"Product Complexity Index": "<span class='gTerm'title='A measure of how complex a product is, calculated as the mathematical limit of a measure based on how many countries export the product and how diversified those exporters are.' toolTip='2'>Product Complexity Index</span>",
"The Product Space": "<span class='gTerm'title='A map that depicts the network of possible export products, and shows paths through which productive knowledge is more easily accumulated.' toolTip='2'>The Product Space</span>",
"Proximity": "<span class='gTerm'title='A characteristic of a pair of products, showing how close the products are located to one another within the Product Space.' toolTip='2'>Proximity</span>"

var replace = {
"Capability Distance": "<span class='gTerm'title='Measures a country’s ability to make a specific product based upon its current export basket and productive capabilities.'>Capability Distance</span>",
"Diversity": "<span class='gTerm'title='{% trans 'def:Trade Flow' %}'>Diversity</span>",
"Economic Complexity": "<span class='gTerm'title='A measure of the knowledge in a society that gets translated into the products it makes.'>Economic Complexity</span>",
"Economic Complexity Indicator": "<span class='gTerm'title='ECI is a scale that shows which countries are economically complex and which are not.'>Economic Complexity Indicator</span>",
"Expected Growth": "<span class='gTerm'title='Predicts the degree to which a country will grow dependent upon its current level of Economic Complexity, its location within The Product Space, as well as current GDP.'>Expected Growth</span>",
"Nearby (adjacent possible)": "<span class='gTerm'title='Describes a product that requires similar productive capabilities to another product.'>Nearby (adjacent possible)</span>",
"Productive Knowlege": "<span class='gTerm'title='A form of knowledge or know-how to produce things.'>Productive Knowlege</span>",
"Product Complexity Index": "<span class='gTerm'title='A measure of how complex a product is, calculated as the mathematical limit of a measure based on how many countries export the product and how diversified those exporters are.'>Product Complexity Index</span>",
"The Product Space": "<span class='gTerm'title='A map that depicts the network of possible export products, and shows paths through which productive knowledge is more easily accumulated.'>The Product Space</span>",
"Proximity": "<span class='gTerm'title='A characteristic of a pair of products, showing how close the products are located to one another within the Product Space.'>Proximity</span>"
}

for(var key in replace){
Expand All @@ -62,20 +45,8 @@ for(var key in replace){
var result = s.replace(re, replace[key]);

$("#main").html(result);

}

$("*").mouseover(function(){
if($(this).attr("toolTip")){
$(this).attr("title", toolTips[$(this).attr("toolTip")]);
}
});

$("*").mouseleave(function(){
if($(this).attr("toolTip")){
console.log(toolTips[$(this).attr("toolTip")]);
}
});



Expand Down
14 changes: 13 additions & 1 deletion media/js/libs/helpbox.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
$(document).ready(function(){

// Defines Placeholder Varialbes for Help Box
if(app_name == "product_space"){
var h3_holder ="Product Space";
var p_holder = "";

} else if(app_name == "pie_scatter"){

console.log("pie");
} else{
console.log("ELSE");
var h3_holder =" ";
var p_holder = "Welcome to the Atlas of Economic Complexity. Hover over an element to see it's function.";
}

// Replaces displayed text with placeholder text

Expand Down Expand Up @@ -76,5 +85,8 @@ $(document).ready(function(){
});
$("#feedbackPlaceholder").mouseleave(function(e){
exit();
});
});
if(previous_image == "http://atlas.cid.harvard.edu/media/img/all/loader.gif"){
$("#history, #historyTab").hide();
}
});

0 comments on commit 10ccb96

Please sign in to comment.