Skip to content

Commit

Permalink
set categorical variable selection in world_map.html based on stored …
Browse files Browse the repository at this point in the history
…value
  • Loading branch information
edwardchalstrey1 committed May 16, 2024
1 parent 8b2b56b commit cbd2305
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions seshat/apps/core/templates/core/world_map.html
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,17 @@ <h3>Base Map</h3>
<script src="{% static 'core/js/map_functions.js' %}"></script>
<script>

var categorical_variables = {{ categorical_variables | safe }};
updateCategoricalVariableSelection('language'); // Set the default categorical variable selection

// If there's a variable stored in the local storage, set the variable selection to that
if (localStorage.getItem('variable')) {
document.getElementById('chooseVariable').value = localStorage.getItem('variable');
// If it's a categorical variable, set the categorical variable selection to that
if (localStorage.getItem('variable') in categorical_variables) {
updateCategoricalVariableSelection(localStorage.getItem('variable'));
};
}

var categorical_variables = {{ categorical_variables | safe }};
updateCategoricalVariableSelection('language'); // Set the default categorical variable selection

var displayedShapes = [];
var polityBorderWeight = 0;
Expand Down

0 comments on commit cbd2305

Please sign in to comment.