From df53cdc5760d89bab8cd1705a8332a7a30a92a65 Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Fri, 24 May 2024 14:15:00 +0100 Subject: [PATCH 001/115] supress current borders spinner --- seshat/apps/core/templates/core/polity_map.html | 2 +- seshat/apps/core/templates/core/world_map.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/seshat/apps/core/templates/core/polity_map.html b/seshat/apps/core/templates/core/polity_map.html index 74a67973b..fc61850ce 100644 --- a/seshat/apps/core/templates/core/polity_map.html +++ b/seshat/apps/core/templates/core/polity_map.html @@ -51,7 +51,7 @@
Base Map:

Loading current borders...

-
+

diff --git a/seshat/apps/core/templates/core/world_map.html b/seshat/apps/core/templates/core/world_map.html index 15b227dd7..87e341aa4 100644 --- a/seshat/apps/core/templates/core/world_map.html +++ b/seshat/apps/core/templates/core/world_map.html @@ -180,7 +180,7 @@

Base Map

Loading current borders...

-
+

From 0a37c30f1624aef7e1dafaaa63a8c0c3f4d14794 Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Fri, 24 May 2024 14:21:10 +0100 Subject: [PATCH 002/115] stop loading wheel after one year loaded --- seshat/apps/core/templates/core/world_map.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/seshat/apps/core/templates/core/world_map.html b/seshat/apps/core/templates/core/world_map.html index 87e341aa4..b7605b112 100644 --- a/seshat/apps/core/templates/core/world_map.html +++ b/seshat/apps/core/templates/core/world_map.html @@ -291,6 +291,9 @@

Base Map

// Call plotPolities() after shapesData is updated plotPolities(); + // Hide the loading indicator after the fetch request is done + document.getElementById('loadingIndicator').style.display = 'none'; + }) .then(() => fetch('/core/world_map_all/')) .then(response => response.json()) @@ -315,9 +318,6 @@

Base Map

document.getElementById('dateSlide').min = data.earliest_year; document.getElementById('dateSlide').max = data.latest_year; - // Hide the loading indicator after the fetch request is done - document.getElementById('loadingIndicator').style.display = 'none'; - // Start the second fetch after the first one is complete return fetch('/core/provinces_and_countries'); }) From 70c2eb4ad534aa4593f02ee828915ada42111bc8 Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Fri, 24 May 2024 14:32:29 +0100 Subject: [PATCH 003/115] bring back loading indicator when adjusting the year if not all polities loaded --- seshat/apps/core/static/core/js/map_functions.js | 3 +++ seshat/apps/core/templates/core/polity_map.html | 4 ++++ seshat/apps/core/templates/core/world_map.html | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/seshat/apps/core/static/core/js/map_functions.js b/seshat/apps/core/static/core/js/map_functions.js index 7c7baf142..7a584c893 100644 --- a/seshat/apps/core/static/core/js/map_functions.js +++ b/seshat/apps/core/static/core/js/map_functions.js @@ -59,6 +59,9 @@ function stopPlay() { function storeYear() { var year = document.getElementById('enterYear').value; history.pushState(null, '', '/core/world_map/?year=' + year); + if (!allPolitiesLoaded) { + document.getElementById('loadingIndicator').style.display = 'block'; + } } function switchBaseMap() { diff --git a/seshat/apps/core/templates/core/polity_map.html b/seshat/apps/core/templates/core/polity_map.html index fc61850ce..a1e33ada3 100644 --- a/seshat/apps/core/templates/core/polity_map.html +++ b/seshat/apps/core/templates/core/polity_map.html @@ -67,6 +67,8 @@
Base Map:
+ {% endblock %} \ No newline at end of file diff --git a/seshat/apps/core/templates/core/form_base_for_new_approach_upgrade.html b/seshat/apps/core/templates/core/form_base_for_new_approach_upgrade.html new file mode 100644 index 000000000..0c6ee2748 --- /dev/null +++ b/seshat/apps/core/templates/core/form_base_for_new_approach_upgrade.html @@ -0,0 +1,220 @@ +{% extends "core/seshat-base.html" %} +{% load crispy_forms_tags %} + +{% block content %} + + + + + + + + + +
+
+ {% csrf_token %} + + +
+
+
Section: {{var_section}} / + {% if var_subsection %} + {{var_subsection}} + {% else %} +  - + {% endif %} +
+
Enter data for:
+

{{ myvar }}

+
+
+ {% autoescape off %} +
{{ myvar }}: {{my_exp}}
+ {% endautoescape %} + +
+ +
+
+
+ {% if messages %} +
    + {% for message in messages %} +
    + +
    + {% endfor %} + {% if form.non_field_errors %} + {% for error in form.non_field_errors %} +
    + +
    + {% endfor %} +
    + {% endif %} +
+
+ {% endif %} +
+
+
+ {{ form.polity|as_crispy_field }} +
+
+ {{ form.year_from|as_crispy_field }} +
+
+ {{ form.year_to|as_crispy_field }} +
+ {% block extra_vars %} + {% endblock extra_vars %} +
+ {{ form.is_disputed|as_crispy_field }} + {{ form.is_uncertain|as_crispy_field }} + {{ form.expert_reviewed|as_crispy_field }} +
+
+
+
+ {% for radio in form.tag %} + + {% endfor %} +
+
+
+
+
+ * Please note: You will have the opportunity to add descriptions, including references, on the next page. +
+
+ {% block delete_button %} + {% endblock delete_button %} +
+
+ +
+
+
+ + + + +
+ +
+ {% if request.user.is_staff %} +
+
+ You are a Seshat Expert; you can enter a fact. +
+ +
+ {% else %} +
+ + +
+ {% endif %} + +
+ + +
+ +
+
+
* Your entered data will soon be checked by a Seshat Expert.
+
+ + {% block delete_option %} + {% endblock delete_option %} + +
+ + +{% endblock %} \ No newline at end of file diff --git a/seshat/apps/core/templates/core/partials/_all_tags_inline_new.html b/seshat/apps/core/templates/core/partials/_all_tags_inline_new.html new file mode 100644 index 000000000..9b2aeb736 --- /dev/null +++ b/seshat/apps/core/templates/core/partials/_all_tags_inline_new.html @@ -0,0 +1,40 @@ + + + + {% if object.tag == "DSP" %} + {{ object.get_tag_display }} + {% elif object.tag == "SSP" %} + {{ object.get_tag_display }} + {% elif object.tag == "UNK" %} + {{ object.get_tag_display }} + {% elif object.tag == "IFR" %} + {{ object.get_tag_display }} + {% else %} + {{ object.get_tag_display }} + {% endif %} + + + +{% if object.is_disputed %} + + + Disputed + + +{% endif %} + + +{% if object.is_uncertain %} + + Uncertain + +{% endif %} + + +{% if object.expert_reviewed %} + + Expert + +{% endif %} + + \ No newline at end of file diff --git a/seshat/apps/core/templates/core/partials/_uncertain_value_inline.html b/seshat/apps/core/templates/core/partials/_uncertain_value_inline.html index 5d6c90d93..8505da118 100644 --- a/seshat/apps/core/templates/core/partials/_uncertain_value_inline.html +++ b/seshat/apps/core/templates/core/partials/_uncertain_value_inline.html @@ -1,6 +1,6 @@ {% if value.is_uncertain %} - + Uncertain {% endif %} diff --git a/seshat/apps/core/templates/core/seshatcomments/seshatcomment_update.html b/seshat/apps/core/templates/core/seshatcomments/seshatcomment_update.html index 70a7409c5..07c8232e1 100644 --- a/seshat/apps/core/templates/core/seshatcomments/seshatcomment_update.html +++ b/seshat/apps/core/templates/core/seshatcomments/seshatcomment_update.html @@ -6,6 +6,7 @@ {% block content %} + {% if object.text == "No Descriptions provided." %}

No discriptions for this fact.

@@ -13,16 +14,13 @@
Add one please:
{% else %} -
- -
Update Description for: +
-
- + @@ -86,87 +84,66 @@
Update Description for:
VariableValueCoded Value Polity Year Range Certainty
-
- How its description appears on a page:
- +
+ Description:
- {% autoescape off %} +
+ -
- {{object}} -
- {% endautoescape %} -
- {% csrf_token %} - -
-
- - - - -
- Note that each description has several subdescriptions*. A subdescription is a combination of some text and its corresponding citation or citations.
-
- {% if messages %} -
    - {% for message in messages %} -
    - -
    - {% endfor %} -
+ {% autoescape off %} + + {% for subcom in object.inner_comments_related.all %} + + + + {{ subcom.comment_part_text }} + + + {% if subcom.display_citations_plus %} + {{ subcom.display_citations_plus }} + {% else %} + [No Refs] {% endif %} -
-
- - - - - - - - - - - - {% autoescape off %} - - {% for subcom in object.inner_comments_related.all %} - - - - - - - - {% endfor %} - {% endautoescape %} - -
# SubDescriptionText CitationsUpdate / Insert / Delete
{{ forloop.counter0|add:1}} - {{ subcom.comment_part_text }} - - {% if subcom.display_citations_plus %} - {{ subcom.display_citations_plus }} - {% else %} - - {% endif %} - + + - {% if subcom.citations_plus_count >= 5 %} - - {% else %} - - {% endif %} - + {% if subcom.citations_count >= 10 %} + + {% else %} + - - - -
-
+ {% endif %} + + + + + + + + + + + + {% endfor %} + + {% endautoescape %} + +
+ +
+ + + + +
- Note that each description has several subdescriptions*. +
+ * A subdescription is a combination of some text and its corresponding citation(s). +
+
+ {% endif %} {% endblock %} diff --git a/seshat/apps/core/templates/core/seshatcomments/seshatcommentpart_create2.html b/seshat/apps/core/templates/core/seshatcomments/seshatcommentpart_create2.html index 3e470d45b..f8ee62b9e 100644 --- a/seshat/apps/core/templates/core/seshatcomments/seshatcommentpart_create2.html +++ b/seshat/apps/core/templates/core/seshatcomments/seshatcommentpart_create2.html @@ -79,74 +79,99 @@ border-style: none; border-width: 0; } + + + .blinking-circle { + display: inline-block; /* Ensure it's treated as an inline element */ + width: 10px; + height: 20px; + padding: 0px; + margin: 0px; + + background-color: coral; + animation: blink 1s infinite alternate; + } + + @keyframes blink { + 0% { + opacity: 1; + } + + 100% { + opacity: 0; + } + } -
+
{% autoescape off %} -How it appears on a page:
+How it appears on a page (parent):
- {{comm_part_display}} + {% for subcom in parent_par.inner_comments_related.all %} + {% if subcom_order == subcom.comment_order|add:"1" %} + {{subcom}} + + + {% else %} + {{subcom}} + + {% endif %} + {% endfor %}
{% endautoescape %}
{% csrf_token %}
-
+
+
+ * Insert the description text here: {{ form.comment_text.label_tag }} {{ form.comment_text }}
{{ form.formset.management_form }} {{ form.management_form }} -
-
+
+ +
+ +
+
+ +
+
- {% for form1 in formset %} - - - - - - - - - - - - - - -
- {{ form.id }} {# Include the form ID for proper formset rendering #} - -
- - - - - - - {# Add a new row for parent_pars #} - - - - - - - -
ReferencePage fromPage toDelete
- {{ form1.ref|as_crispy_field }} - - {{ form1.page_from|as_crispy_field }} - - {{ form1.page_to|as_crispy_field }} - - {{ form1.DELETE }} -
- {{ form1.parent_pars|as_crispy_field }} -
-
+ {% for form1 in form.formset %} + + +
+ {{ form1.id }} {# Include the form ID for proper formset rendering #} +
+
+ Citation #{{ forloop.counter}} + Delete + {{ form1.DELETE }} + +
+
+ {{ form1.ref|as_crispy_field }} +
+
+ {{ form1.page_from|as_crispy_field }} +
+
+ {{ form1.page_to|as_crispy_field }} +
+ +
+ {{ form1.parent_pars|as_crispy_field }} +
+
+ +
{% endfor %}
@@ -156,11 +181,13 @@ {{ form.comment_order|as_crispy_field }}
- +
+ +
+ + + \ No newline at end of file diff --git a/seshat/apps/core/templates/core/form_base_for_new_approach_upgrade.html b/seshat/apps/core/templates/core/form_base_for_new_approach_upgrade.html index 0c6ee2748..d7d0a0ae2 100644 --- a/seshat/apps/core/templates/core/form_base_for_new_approach_upgrade.html +++ b/seshat/apps/core/templates/core/form_base_for_new_approach_upgrade.html @@ -125,6 +125,9 @@
{{ myvar }}: <
{{ form.year_to|as_crispy_field }}
+ {% block extra_vars %} {% endblock extra_vars %}
diff --git a/seshat/apps/core/templates/core/list_base_for_new_approach.html b/seshat/apps/core/templates/core/list_base_for_new_approach.html index 807e3415c..661a0b1d7 100644 --- a/seshat/apps/core/templates/core/list_base_for_new_approach.html +++ b/seshat/apps/core/templates/core/list_base_for_new_approach.html @@ -2,258 +2,170 @@ {% load static %} {% load humanize %} {% load mathfilters %} +{% load custom_filters %} {% block content %} + +
{% if object_list %}
-
+
-
Section: {{var_section}} +
Section: {{var_section}} {% if var_subsection %} / {{var_subsection}} {% endif %} -
+
-

{{myvar}}

+
Variable: {{myvar}}
{{var_main_desc}}  
-
-
- Contributors: Seshat RAs and Experts -
-
-
+
{% if inner_vars %} -
-
-
Metadata:
-
-
+ {% block download_button %} + {% endblock download_button %} {% block metadownload_button %} {% endblock metadownload_button %} -
-
-
-
-

- -

-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
VariableDefinition
PolityThe Seshat Polity Name
Year(s)The years for which we have the data. [negative = BCE]
ConfidenceInferred : The value is inferred.
- Suspected : The value is suspected (Expert Check Needed).
- Evidenced : The value is backed up by sufficient evidence.
Disputed? - No : No disagreement among scholars.
Yes : There is disagreement among scholars. -
Expert? : Not yet Checked by a Seshat Expert.
: Checked and accepted by a Seshat Expert (or RA).
-
-
-
-
-

- -

-
-
- - - - - - - - - {% for ktop, vtop in inner_vars.items %} - - - {% if vtop.var_exp %} - - {% elif "Definition" in potential_cols %} - - {% endif %} - {% if vtop.scale %} - - {% elif "Scale" in potential_cols %} - - {% endif %} - {% if vtop.units %} - - {% elif "Units" in potential_cols %} - - {% endif %} - {% if vtop.min %} - - {% elif "Min" in potential_cols %} - - {% endif %} - {% if vtop.max %} - - {% elif "Max" in potential_cols %} - - {% endif %} - - {% endfor %} - -
VariableDefinition
{{ktop}}{{vtop.var_exp}}{{vtop.scale}}{{vtop.units}}{{vtop.min}}{{vtop.max}}
-
-
-
- {% endif %} -
+ {% endif %}
{% block main_description %} {% endblock main_description %} {% block secondary_description %} {% endblock secondary_description %} -
-
-
-
Actual Data:
-
-
- - {% block download_button %} - {% endblock download_button %} -
-
+
- - {{myvar}} +
+ {{myvar}} - + - {% block myheadings_list %} {% endblock myheadings_list %} - {% include "core/partials/_confidence_disputed_expert.html" %} - - + + + + {% for obj in object_list %} - -
-
- {% if obj.polity %} - - {% else %} - - {% endif%} - - {% include "core/partials/_years_block_new_obj.html" %} + +
+ + +
- - + - - {% if obj.display_citations %} - -   - - {% endif %} - + {% if obj.polity %} + + {% else %} + + {% endif%} + + + {% block extra_vars_list %} + {% endblock extra_vars_list %} + {% include "core/partials/_all_tags_inline_obj.html" %} + + + {% include "core/partials/_years_block_new_obj.html" %} + + + {% block update_button %} + {% endblock update_button %} + - {% block update_button %} - {% endblock update_button %} - + + + + + + + + {% endfor %}
## -    Polity - - - -   -   Year(s)   +  Polity EditTags + + Year(s) + EditDesc
{{ forloop.counter }} - {% if obj.polity.long_name %} - - {{ obj.polity.long_name }} - - {% else %} - - {{ obj.polity.name }} - - {% endif %} - - -
+ {{ forloop.counter }} + {% if obj.comment and obj.comment.id > 1 %} + * + {% endif %} - - {% block extra_vars_list %} - {% endblock extra_vars_list %} - - {% if obj.tag == "DSP" %} - {{ obj.get_tag_display }} - {% elif obj.tag == "SSP" %} - {{ obj.get_tag_display }} - {% elif obj.tag == "UNK" %} - {{ obj.get_tag_display }} - {% elif obj.tag == "IFR" %} - {{ obj.get_tag_display }} - {% else %} - {{ obj.get_tag_display }} - {% endif %} - - {% if obj.is_disputed %} - Yes - {% else %} - No - {% endif %} - - {% if obj.expert_reviewed %} - - {% else %} - - {% endif %} - + {% if obj.polity.long_name %} + + {{ obj.polity.long_name }} + + {% else %} + + {{ obj.polity.name }} + + {% endif %} + + - +
+
+ + {% autoescape off %} + {% if obj.description %} + {{ obj.description|make_references_look_nicer }} +
+ {% else %} + - + {% endif%} + {% if obj.comment and obj.comment.id > 1 %} + {{obj.comment }} + + + + EDIT + + + {% endif %} + {% endautoescape %} +
+
+
+ {% else %}
@@ -278,4 +190,5 @@
{{var_main_desc}}
return new bootstrap.Popover(popoverTriggerEl) }) - {% endblock %} \ No newline at end of file + {% endblock %} + diff --git a/seshat/apps/core/templates/core/partials/_all_tags_inline_obj.html b/seshat/apps/core/templates/core/partials/_all_tags_inline_obj.html new file mode 100644 index 000000000..6d8476b3b --- /dev/null +++ b/seshat/apps/core/templates/core/partials/_all_tags_inline_obj.html @@ -0,0 +1,40 @@ + + + + {% if obj.tag == "DSP" %} + {{ obj.get_tag_display }} + {% elif obj.tag == "SSP" %} + {{ obj.get_tag_display }} + {% elif obj.tag == "UNK" %} + {{ obj.get_tag_display }} + {% elif obj.tag == "IFR" %} + {{ obj.get_tag_display }} + {% else %} + {{ obj.get_tag_display }} + {% endif %} + + + + {% if obj.is_disputed %} + + + Disputed + + + {% endif %} + + + {% if obj.is_uncertain %} + + Uncertain + + {% endif %} + + + {% if obj.expert_reviewed %} + + Expert + + {% endif %} + + \ No newline at end of file diff --git a/seshat/apps/core/templates/core/partials/_footer_bar.html b/seshat/apps/core/templates/core/partials/_footer_bar.html index 15df61099..8c22c317a 100644 --- a/seshat/apps/core/templates/core/partials/_footer_bar.html +++ b/seshat/apps/core/templates/core/partials/_footer_bar.html @@ -1,7 +1,7 @@
Copyright © - 2023, Seshat: Global History Databank. + 2024, Seshat: Global History Databank.
Stay in touch with us:   diff --git a/seshat/apps/core/templates/core/partials/_years_block_new_obj.html b/seshat/apps/core/templates/core/partials/_years_block_new_obj.html index 0355775bf..f718145e6 100644 --- a/seshat/apps/core/templates/core/partials/_years_block_new_obj.html +++ b/seshat/apps/core/templates/core/partials/_years_block_new_obj.html @@ -2,28 +2,27 @@ {% load mathfilters %} {% if obj.year_from == None %} - * Year Range of {{ obj.polity.long_name }} is assumed.
- [{{ obj.polity.start_year}}, {{ obj.polity.end_year}}] + - {% elif obj.year_from == obj.year_to %} {% if obj.year_from < 0 %} - {{ obj.year_from|abs|intcomma }} BCE + {{ obj.year_from|abs|intcomma }} BCE {% else %} - {{ obj.year_from }} CE + {{ obj.year_from }} CE {% endif %} {% elif obj.year_to == None %} {% if obj.year_from < 0 %} - {{ obj.year_from|abs }} BCE + {{ obj.year_from|abs }} BCE {% else %} - {{ obj.year_from }} CE + {{ obj.year_from }} CE {% endif %} {% elif obj.year_to == None and obj.year_from == None %} - + {% else %} {% if obj.year_from < 0 and obj.year_to < 0 %} - {{ obj.year_from|abs }} BCE {{ obj.year_to|abs }} BCE + {{ obj.year_from|abs }} BCE {{ obj.year_to|abs }} BCE {% elif obj.year_from < 0 and obj.year_to >= 0 %} - {{ obj.year_from|abs }} BCE {{ obj.year_to }} CE + {{ obj.year_from|abs }} BCE {{ obj.year_to }} CE {% else %} - {{ obj.year_from }} CE {{ obj.year_to }} CE + {{ obj.year_from }} CE {{ obj.year_to }} CE {% endif %} {% endif %} \ No newline at end of file diff --git a/seshat/apps/core/urls.py b/seshat/apps/core/urls.py index 2266d25ca..095635dcb 100644 --- a/seshat/apps/core/urls.py +++ b/seshat/apps/core/urls.py @@ -10,6 +10,9 @@ urlpatterns += [path('acknowledgements/', views.seshatacknowledgements, name='seshat-acknowledgements'),] urlpatterns += [path('download_oldcsv//', views.download_oldcsv, name='download_oldcsv'),] +urlpatterns += [path('code_book_new_1', views.seshatcodebooknew1, name='code_book_1'),] +#urlpatterns += [path('code_book_new_2', views.download_oldcsv, name='code_book_2'),] + #urlpatterns += [path('home_cards/', views.home_cards, name='home_cards'),] urlpatterns += [path('download_csv_all_polities/', views.download_csv_all_polities,name='download_csv_all_polities'),] diff --git a/seshat/apps/core/views.py b/seshat/apps/core/views.py index 15baf4929..628cdea8b 100644 --- a/seshat/apps/core/views.py +++ b/seshat/apps/core/views.py @@ -194,6 +194,17 @@ def seshatcodebookold(request): } return render(request, 'core/old_codebook.html', context=context) +def seshatcodebooknew1(request): + context = { + 'insta': "Instabilities All Over the Place..", + } + return render(request, 'core/code_book_1.html', context=context) + +# def seshatcodebooknew2(request): +# context = { +# 'insta': "Instabilities All Over the Place..", +# } +# return render(request, 'core/new_codebook_2.html', context=context) def seshatacknowledgements(request): context = { diff --git a/seshat/apps/crisisdb/urls.py b/seshat/apps/crisisdb/urls.py index 38f4e5148..5aaca6d51 100644 --- a/seshat/apps/crisisdb/urls.py +++ b/seshat/apps/crisisdb/urls.py @@ -18,9 +18,8 @@ path('vars/', views.QingVars, name='qing_vars'), path('playground/', views.playground, name='playground'), path('playgrounddownload/', views.playgrounddownload, - name="playgrounddownload"), - path('fpl_all/', views.fpl_all, - name="fpl_all"), + name="playgrounddownload"), + #path('fpl_all/', views.fpl_all,name="fpl_all"), ] urlpatterns += [ diff --git a/seshat/apps/crisisdb/views.py b/seshat/apps/crisisdb/views.py index 56cecbe48..0bbb4f2f8 100644 --- a/seshat/apps/crisisdb/views.py +++ b/seshat/apps/crisisdb/views.py @@ -3532,8 +3532,8 @@ def playgrounddownload(request): return final_response -def fpl_all(request): - return render(request, 'crisisdb/fpl_all.html') +#def fpl_all(request): +# return render(request, 'crisisdb/fpl_all.html') # ... Your existing imports ... diff --git a/seshat/apps/rt/templates/rt/rt_list_all.html b/seshat/apps/rt/templates/rt/rt_list_all.html index 15346b051..211f37a1d 100644 --- a/seshat/apps/rt/templates/rt/rt_list_all.html +++ b/seshat/apps/rt/templates/rt/rt_list_all.html @@ -6,25 +6,25 @@ {% block download_button %} -   Add More Facts -   Download All +   Add More Facts +   Download All {% endblock download_button %} {% block metadownload_button %} -   Download MetaData +   Download MetaData {% endblock metadownload_button %} {% block myheadings_list %} - -    coded value + +  Coded Value {% endblock myheadings_list %} {% block extra_vars_list %} - - + + - Edit + {% endblock update_button %} \ No newline at end of file diff --git a/seshat/apps/rt/templates/rt/rt_update.html b/seshat/apps/rt/templates/rt/rt_update.html index c445109c4..cf3f4bdd8 100644 --- a/seshat/apps/rt/templates/rt/rt_update.html +++ b/seshat/apps/rt/templates/rt/rt_update.html @@ -1,23 +1,22 @@ -{% extends "core/form_base_for_new_approach.html" %} +{% extends "core/form_base_for_new_approach_upgrade.html" %} {% load crispy_forms_tags %} {% load humanize %} {% block extra_vars %} - {% if extra_var2 %} -
+
{{ extra_var|as_crispy_field }}
-
+
{{ extra_var3|as_crispy_field }}
-
+
{{ extra_var2|as_crispy_field }}
{% else %} -
+
{{ extra_var|as_crispy_field }}
{% endif %} @@ -29,3 +28,5 @@ {% endblock delete_button %} + + diff --git a/seshat/apps/seshat_api/urls.py b/seshat/apps/seshat_api/urls.py index 24a901c16..7b45a68e2 100644 --- a/seshat/apps/seshat_api/urls.py +++ b/seshat/apps/seshat_api/urls.py @@ -8,8 +8,8 @@ router = routers.DefaultRouter() -router.register(r'users', views.UserViewSet) -router.register(r'groups', views.GroupViewSet) +#router.register(r'users', views.UserViewSet) +#router.register(r'groups', views.GroupViewSet) router.register(r'politys-api', views.PolityViewSet) #router.register(r'sections', views.SectionViewSet) From ba19701d0179193bc1e100b0021761fff8613ffd Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Tue, 18 Jun 2024 12:19:50 +0100 Subject: [PATCH 063/115] Area not Area_Km2 --- seshat/apps/core/management/commands/populate_videodata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seshat/apps/core/management/commands/populate_videodata.py b/seshat/apps/core/management/commands/populate_videodata.py index 18d53bb80..495333312 100644 --- a/seshat/apps/core/management/commands/populate_videodata.py +++ b/seshat/apps/core/management/commands/populate_videodata.py @@ -148,7 +148,7 @@ def handle(self, *args, **options): polity=polity_colour_key, wikipedia_name=properties['Wikipedia'], seshat_id=properties['SeshatID'], - area=properties['Area_km2'], + area=properties['Area'], start_year=properties['Year'], end_year=end_year, polity_start_year=polity_start_year, From 88bf793acf0c5bb245cb85e6d846ff66ce526b01 Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Tue, 18 Jun 2024 12:20:55 +0100 Subject: [PATCH 064/115] only simplify if you want to --- notebooks/cliopatria.ipynb | 45 +++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/notebooks/cliopatria.ipynb b/notebooks/cliopatria.ipynb index 1448108fb..8d8c8e95b 100644 --- a/notebooks/cliopatria.ipynb +++ b/notebooks/cliopatria.ipynb @@ -14,17 +14,17 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 5, "metadata": {}, "outputs": [], "source": [ - "cliopatria_geojson_path = \"../data/cliopatria_05192024/cliopatria.geojson\"\n", - "cliopatria_json_path = \"../data/cliopatria_05192024/name_years.json\"" + "cliopatria_geojson_path = \"../data/cliopatria_composite_unique_nonsimplified.geojson_06052024/cliopatria_composite_unique_nonsimplified.geojson\"\n", + "cliopatria_json_path = \"../data/cliopatria_composite_unique_nonsimplified.geojson_06052024/cliopatria_composite_unique_nonsimplified_name_years.json\"" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 6, "metadata": {}, "outputs": [], "source": [ @@ -33,7 +33,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 7, "metadata": {}, "outputs": [], "source": [ @@ -41,6 +41,17 @@ "gdf = cliopatria_gdf(cliopatria_geojson_path, cliopatria_json_path)" ] }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [], + "source": [ + "# Simplify the geometries if you want to (this is optional)\n", + "# gdf_simplified = gdf.copy()\n", + "# gdf_simplified[\"geometry\"] = gdf_simplified[\"geometry\"].simplify(tolerance=0.07)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -56,13 +67,13 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 19, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "fa3061f86d3a49b6b61bae11e432de5a", + "model_id": "0a1ca8ed56ca4b289f56007d1186d19a", "version_major": 2, "version_minor": 0 }, @@ -76,7 +87,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "99a5dec1f2754627b1ba036fe845f8b8", + "model_id": "f3d1d6b5caca4553b4822fc5e8e367ac", "version_major": 2, "version_minor": 0 }, @@ -90,7 +101,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "924777c86b174796b9a5beb0bd05e599", + "model_id": "808e7bcab78e48eca2f45df809f1db41", "version_major": 2, "version_minor": 0 }, @@ -100,18 +111,6 @@ }, "metadata": {}, "output_type": "display_data" - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/Users/echalstrey/.pyenv/versions/3.11.4/lib/python3.11/site-packages/geopandas/geodataframe.py:1760: SettingWithCopyWarning: \n", - "A value is trying to be set on a copy of a slice from a DataFrame.\n", - "Try using .loc[row_indexer,col_indexer] = value instead\n", - "\n", - "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", - " super().__setitem__(key, value)\n" - ] } ], "source": [ @@ -122,9 +121,9 @@ ], "metadata": { "kernelspec": { - "display_name": "Python (cliopatria)", + "display_name": "Python (cliopatria1)", "language": "python", - "name": "cliopatria" + "name": "cliopatria1" }, "language_info": { "codemirror_mode": { From b6b31c10a19dd9117e3b1095df0c5b19d3240d50 Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Tue, 18 Jun 2024 14:48:21 +0100 Subject: [PATCH 065/115] works with geopandas==0.13.2 --- notebooks/cliopatria.ipynb | 37 +++++++++++++++++++------------------ notebooks/requirements.txt | 2 +- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/notebooks/cliopatria.ipynb b/notebooks/cliopatria.ipynb index 8d8c8e95b..c48b61df0 100644 --- a/notebooks/cliopatria.ipynb +++ b/notebooks/cliopatria.ipynb @@ -14,7 +14,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ @@ -24,7 +24,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ @@ -33,7 +33,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ @@ -41,17 +41,6 @@ "gdf = cliopatria_gdf(cliopatria_geojson_path, cliopatria_json_path)" ] }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": {}, - "outputs": [], - "source": [ - "# Simplify the geometries if you want to (this is optional)\n", - "# gdf_simplified = gdf.copy()\n", - "# gdf_simplified[\"geometry\"] = gdf_simplified[\"geometry\"].simplify(tolerance=0.07)" - ] - }, { "cell_type": "markdown", "metadata": {}, @@ -67,13 +56,13 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "0a1ca8ed56ca4b289f56007d1186d19a", + "model_id": "a95aced3593446ceb228a171178f978b", "version_major": 2, "version_minor": 0 }, @@ -87,7 +76,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "f3d1d6b5caca4553b4822fc5e8e367ac", + "model_id": "80c96982f4a34628b3026e9f853a6af9", "version_major": 2, "version_minor": 0 }, @@ -101,7 +90,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "808e7bcab78e48eca2f45df809f1db41", + "model_id": "44078fdd8e91499bad99d7fd38b76a65", "version_major": 2, "version_minor": 0 }, @@ -111,6 +100,18 @@ }, "metadata": {}, "output_type": "display_data" + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/Users/echalstrey/.pyenv/versions/3.11.4/lib/python3.11/site-packages/geopandas/geodataframe.py:1538: SettingWithCopyWarning: \n", + "A value is trying to be set on a copy of a slice from a DataFrame.\n", + "Try using .loc[row_indexer,col_indexer] = value instead\n", + "\n", + "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", + " super().__setitem__(key, value)\n" + ] } ], "source": [ diff --git a/notebooks/requirements.txt b/notebooks/requirements.txt index 05d9d6823..03f14b0c2 100644 --- a/notebooks/requirements.txt +++ b/notebooks/requirements.txt @@ -1,5 +1,5 @@ jupyter==1.0.0 ipykernel==6.29.3 -geopandas +geopandas==0.13.2 contextily==1.6.0 folium==0.16.0 \ No newline at end of file From 828f0006606eed45f504bdb196512a174937f788 Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Tue, 18 Jun 2024 14:52:16 +0100 Subject: [PATCH 066/115] geopandas instructions --- notebooks/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/notebooks/README.md b/notebooks/README.md index 2636339e0..7c3275dee 100644 --- a/notebooks/README.md +++ b/notebooks/README.md @@ -12,6 +12,8 @@ Cliopatria is the shape dataset used by the Seshat Global History Databank websi conda activate cliopatria pip install -r requirements.txt python -m ipykernel install --user --name=cliopatria --display-name="Python (cliopatria)" + ``` + - Note: This will install Geopandas 0.13.2, but if you [install from source](https://geopandas.org/en/stable/getting_started/install.html#installing-from-source) it's much faster with version 1.0.0 (unreleased on pip as of 18th June 2024) 3. Open the `cliopatria.ipynb` notebook with Jupyter (or another application that can run notebooks such as VSCode). - `jupyter lab` (or `jupyter notebook`) From e5d65b513d04be045fa77d49861d15955fa593eb Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Wed, 19 Jun 2024 10:52:09 +0100 Subject: [PATCH 067/115] use duration when start or end year missing for absent present vars --- seshat/apps/core/templates/core/world_map.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/seshat/apps/core/templates/core/world_map.html b/seshat/apps/core/templates/core/world_map.html index c4ee1bed8..0b59007e9 100644 --- a/seshat/apps/core/templates/core/world_map.html +++ b/seshat/apps/core/templates/core/world_map.html @@ -626,12 +626,12 @@

Base Map

let startYear = value[0]; let endYear = value[1]; let variable_value = longAbsentPresentVarName(key); - // If startYear or endYear are None, state these as uncoded + // If startYear or endYear are None, set them to the polity start_year or end_year if (startYear == 'None' || startYear == null) { - startYear = '[Year Uncoded]' + startYear = shape.polity_start_year; } if (endYear == 'None' || endYear == null) { - endYear = '[Year Uncoded]' + endYear = shape.polity_end_year; } if (counter == 0) { popupContent = popupContent + ` From 71829871a40d1e484165b35d44dfd2270f001769 Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Wed, 19 Jun 2024 11:05:05 +0100 Subject: [PATCH 068/115] rename var --- seshat/apps/core/templates/core/world_map.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/seshat/apps/core/templates/core/world_map.html b/seshat/apps/core/templates/core/world_map.html index 0b59007e9..7e214c84d 100644 --- a/seshat/apps/core/templates/core/world_map.html +++ b/seshat/apps/core/templates/core/world_map.html @@ -623,28 +623,28 @@

Base Map

// Iterate through key/values in the dictionary var counter = 0; for (const [key, value] of Object.entries(shape[variable + '_dict'])) { - let startYear = value[0]; - let endYear = value[1]; + let variableStartYear = value[0]; + let variableEndYear = value[1]; let variable_value = longAbsentPresentVarName(key); // If startYear or endYear are None, set them to the polity start_year or end_year - if (startYear == 'None' || startYear == null) { - startYear = shape.polity_start_year; + if (variableStartYear == 'None' || variableStartYear == null) { + variableStartYear = displaystart_year; } - if (endYear == 'None' || endYear == null) { - endYear = shape.polity_end_year; + if (variableEndYear == 'None' || variableEndYear == null) { + variableEndYear = displayend_year; } if (counter == 0) { popupContent = popupContent + ` ${variable} - ${variable_value} from ${startYear} to ${endYear} + ${variable_value} from ${variableStartYear} to ${variableEndYear} `; } else { popupContent = popupContent + ` - ${variable_value} from ${startYear} to ${endYear} + ${variable_value} from ${variableStartYear} to ${variableEndYear} `; } From 9f7e513b67e9e17c8d402436b37d5dc0ed43d1a6 Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Wed, 19 Jun 2024 11:11:42 +0100 Subject: [PATCH 069/115] format BCE/CE correctly --- .../apps/core/templates/core/world_map.html | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/seshat/apps/core/templates/core/world_map.html b/seshat/apps/core/templates/core/world_map.html index 7e214c84d..7fb9ed194 100644 --- a/seshat/apps/core/templates/core/world_map.html +++ b/seshat/apps/core/templates/core/world_map.html @@ -626,13 +626,30 @@

Base Map

let variableStartYear = value[0]; let variableEndYear = value[1]; let variable_value = longAbsentPresentVarName(key); - // If startYear or endYear are None, set them to the polity start_year or end_year + // If startYear or endYear are None, set them to the polity start year or end year + // Format the years to BCE/CE if (variableStartYear == 'None' || variableStartYear == null) { variableStartYear = displaystart_year; + } else { + if (variableStartYear < 0) { + variableStartYear = Math.abs(variableStartYear) + ' BCE'; + } else { + variableStartYear = variableStartYear + ' CE'; + } } if (variableEndYear == 'None' || variableEndYear == null) { variableEndYear = displayend_year; - } + } else { + if (variableEndYear == {{ latest_year }}){ + variableEndYear = 'Present'; + } else { + if (variableEndYear < 0) { + variableEndYear = Math.abs(variableEndYear) + ' BCE'; + } else { + variableEndYear = variableEndYear + ' CE'; + } + } + } if (counter == 0) { popupContent = popupContent + ` From 10ecec774a5e5648efb220cdae85cb24ba7e7be4 Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Wed, 19 Jun 2024 11:39:31 +0100 Subject: [PATCH 070/115] make uncoded and no seshat page the same colour --- seshat/apps/core/static/core/js/map_functions.js | 6 ++++++ seshat/apps/core/templates/core/world_map.html | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/seshat/apps/core/static/core/js/map_functions.js b/seshat/apps/core/static/core/js/map_functions.js index 7a584c893..812930447 100644 --- a/seshat/apps/core/static/core/js/map_functions.js +++ b/seshat/apps/core/static/core/js/map_functions.js @@ -226,6 +226,9 @@ function updateLegend() { legendDiv.appendChild(legendTitle); for (var key in oneLanguageColourMapping) { + if (key === 'No Seshat page') { // Skip the "No Seshat page" key as it's the same colour as "Uncoded" (see world_map.html) + continue; + } var legendItem = document.createElement('p'); var colorBox = document.createElement('span'); @@ -254,6 +257,9 @@ function updateLegend() { legendDiv.appendChild(legendTitle); for (var key in variableColourMapping) { + if (key === 'no seshat page') { // Skip the "No Seshat page" key as it's the same colour as "Uncoded" (see world_map.html) + continue; + } var legendItem = document.createElement('p'); var colorBox = document.createElement('span'); diff --git a/seshat/apps/core/templates/core/world_map.html b/seshat/apps/core/templates/core/world_map.html index 7fb9ed194..ce5d2fca7 100644 --- a/seshat/apps/core/templates/core/world_map.html +++ b/seshat/apps/core/templates/core/world_map.html @@ -354,13 +354,15 @@

Base Map

var provinceLayers = []; // Keep track of province layers to remove them later // Note: these are the choices for the variable values as encoded in sc.models + // Note: uncoded and no seshat page are both now set to the same colour + // Note: if you modify this, you should check that updateLegend() is consistent (found in map_functions.js) let variableColourMapping = { 'present': 'green', 'absent': 'red', 'P~A': 'orange', 'A~P': 'blue', 'unknown': 'yellow', - 'uncoded': '#ffa2a1', + 'uncoded': 'grey', 'no seshat page': 'grey' }; @@ -369,7 +371,7 @@

Base Map

'Present': '#13d446', 'Absent': 'red', 'Unknown': 'yellow', - 'Uncoded': '#ffa2a1', + 'Uncoded': 'grey', 'No Seshat page': 'grey' }; From 434f886ac0431885ecfed9cf5bb5eb2d1671d748 Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Wed, 19 Jun 2024 11:56:13 +0100 Subject: [PATCH 071/115] make switch variable button consistent --- .../apps/core/templates/core/world_map.html | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/seshat/apps/core/templates/core/world_map.html b/seshat/apps/core/templates/core/world_map.html index ce5d2fca7..a4b6880ff 100644 --- a/seshat/apps/core/templates/core/world_map.html +++ b/seshat/apps/core/templates/core/world_map.html @@ -127,8 +127,8 @@

Polities

{% endfor %}
@@ -404,12 +404,16 @@

Base Map

if (localStorage.getItem('variable') != variable) { // Update previously selected variable button document.getElementById('previouslySelectedVariable').setAttribute('variableSelection', localStorage.getItem('variable')); - if (localStorage.getItem('variable') in categorical_variables || localStorage.getItem('variable') == 'polity'){ - // Categorical variables don't have a full name so we need to modify TODO: Make this more consistent - document.getElementById('previouslySelectedVariable').innerHTML = localStorage.getItem('variable').replace(/_/g, ' ').split(' ').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(' '); - } else { - document.getElementById('previouslySelectedVariable').innerHTML = localStorage.getItem('variable') - } + + // Set the text of the previously selected variable button + // Note: we decided to not use the variabled name and instead keep the button text consistent + // if (localStorage.getItem('variable') in categorical_variables || localStorage.getItem('variable') == 'polity'){ + // // Categorical variables don't have a full name so we need to modify TODO: Make this more consistent + // document.getElementById('previouslySelectedVariable').innerHTML = localStorage.getItem('variable').replace(/_/g, ' ').split(' ').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(' '); + // } else { + // document.getElementById('previouslySelectedVariable').innerHTML = localStorage.getItem('variable') + // } + document.getElementById('previouslySelectedVariableFieldset').style.display = 'block'; } From dbbbc13ea092f8498e018125fb5ec5b949497088 Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Wed, 19 Jun 2024 14:14:09 +0100 Subject: [PATCH 072/115] add speed in y/s --- .../apps/core/static/core/js/map_functions.js | 22 +++++++++++++++++++ .../apps/core/templates/core/world_map.html | 13 +++++++++-- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/seshat/apps/core/static/core/js/map_functions.js b/seshat/apps/core/static/core/js/map_functions.js index 812930447..6e86468d7 100644 --- a/seshat/apps/core/static/core/js/map_functions.js +++ b/seshat/apps/core/static/core/js/map_functions.js @@ -20,6 +20,28 @@ function adjustSliderDown() { plotPolities(); // This function is defined differently in the world_map and polity_map templates } +function updateSliderValue(value) { + var sliderValue = document.getElementById('sliderValue'); + switch (value) { + case '1': + sliderValue.textContent = '1 y/s'; // See the values in the startPlay function below + break; + case '2': + sliderValue.textContent = '5 y/s'; + break; + case '3': + sliderValue.textContent = '20 y/s'; + break; + case '4': + sliderValue.textContent = '50 y/s'; + break; + case '5': + sliderValue.textContent = '100 y/s'; + break; + } + plotPolities(); +} + function startPlay() { stopPlay(); // Clear existing interval before starting a new one diff --git a/seshat/apps/core/templates/core/world_map.html b/seshat/apps/core/templates/core/world_map.html index a4b6880ff..8965f979f 100644 --- a/seshat/apps/core/templates/core/world_map.html +++ b/seshat/apps/core/templates/core/world_map.html @@ -144,8 +144,17 @@

Polities


- -
+ + + + + + + + + + 5 y/s



From 0e662f36a0d8d074e9c838754e67fa597ae0a982 Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Wed, 19 Jun 2024 14:31:27 +0100 Subject: [PATCH 073/115] simplify instructions --- .../apps/core/templates/core/world_map.html | 20 +------------------ 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/seshat/apps/core/templates/core/world_map.html b/seshat/apps/core/templates/core/world_map.html index 8965f979f..2a8b48da2 100644 --- a/seshat/apps/core/templates/core/world_map.html +++ b/seshat/apps/core/templates/core/world_map.html @@ -162,18 +162,7 @@

Polities



-->
- +

🗣️ Double clicks open Seshat pages.

Base Map

@@ -402,13 +391,6 @@

Base Map

var selectedYear = document.getElementById('dateSlide').value; var opacity = document.getElementById('opacitySlide').value; - // Show or hide the polity-specific info fieldset - if (variable == 'polity') { - document.getElementById('politySpecificInfo').style.display = 'block'; - } else { - document.getElementById('politySpecificInfo').style.display = 'none'; - } - // If variable has changed from the previous selection if (localStorage.getItem('variable') != variable) { // Update previously selected variable button From a03693f120a60eba08e4553f7e898cddaf389a98 Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Wed, 19 Jun 2024 14:39:21 +0100 Subject: [PATCH 074/115] update polity map playRate to be same as world map --- seshat/apps/core/templates/core/polity_map.html | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/seshat/apps/core/templates/core/polity_map.html b/seshat/apps/core/templates/core/polity_map.html index c7b2695f1..a038f05f8 100644 --- a/seshat/apps/core/templates/core/polity_map.html +++ b/seshat/apps/core/templates/core/polity_map.html @@ -28,8 +28,17 @@
- -
+ + + + + + + + + + 5 y/s
From 6066bb1b273be1ae29e18a76eb88c5b9f8d5889d Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Wed, 19 Jun 2024 14:45:58 +0100 Subject: [PATCH 075/115] set minZoom --- seshat/apps/core/templates/core/polity_map.html | 4 +++- seshat/apps/core/templates/core/world_map.html | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/seshat/apps/core/templates/core/polity_map.html b/seshat/apps/core/templates/core/polity_map.html index a038f05f8..3a2c93a62 100644 --- a/seshat/apps/core/templates/core/polity_map.html +++ b/seshat/apps/core/templates/core/polity_map.html @@ -126,7 +126,9 @@
Base Map:
}); }); - var map = L.map('map').setView([0, 0], 2); + var map = L.map('map', { + minZoom: 2, + }).setView([0, 0], 2); var baseLayers = { "carto": L.tileLayer('https://{s}.basemaps.cartocdn.com/rastertiles/voyager_nolabels/{z}/{x}/{y}.png'), diff --git a/seshat/apps/core/templates/core/world_map.html b/seshat/apps/core/templates/core/world_map.html index 2a8b48da2..002137924 100644 --- a/seshat/apps/core/templates/core/world_map.html +++ b/seshat/apps/core/templates/core/world_map.html @@ -340,7 +340,9 @@

Base Map

fetchData('/core/world_map_one_year/', displayYear); }); - var map = L.map('map').setView([0, 0], 2); + var map = L.map('map', { + minZoom: 2, + }).setView([0, 0], 2); var baseLayers = { "carto": L.tileLayer('https://{s}.basemaps.cartocdn.com/rastertiles/voyager_nolabels/{z}/{x}/{y}.png'), From cfb886e4141c21b3a2548af9c004606601fc9f65 Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Wed, 19 Jun 2024 14:48:59 +0100 Subject: [PATCH 076/115] restrict map bounds --- seshat/apps/core/templates/core/polity_map.html | 6 ++++++ seshat/apps/core/templates/core/world_map.html | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/seshat/apps/core/templates/core/polity_map.html b/seshat/apps/core/templates/core/polity_map.html index 3a2c93a62..55f1d3f68 100644 --- a/seshat/apps/core/templates/core/polity_map.html +++ b/seshat/apps/core/templates/core/polity_map.html @@ -126,8 +126,14 @@
Base Map:
}); }); + var southWest = L.latLng(-89.98155760646617, -180), + northEast = L.latLng(89.99346179538875, 180), + bounds = L.latLngBounds(southWest, northEast); + var map = L.map('map', { minZoom: 2, + maxBounds: bounds, + maxBoundsViscosity: 1.0 }).setView([0, 0], 2); var baseLayers = { diff --git a/seshat/apps/core/templates/core/world_map.html b/seshat/apps/core/templates/core/world_map.html index 002137924..cec245e02 100644 --- a/seshat/apps/core/templates/core/world_map.html +++ b/seshat/apps/core/templates/core/world_map.html @@ -340,8 +340,14 @@

Base Map

fetchData('/core/world_map_one_year/', displayYear); }); + var southWest = L.latLng(-89.98155760646617, -180), + northEast = L.latLng(89.99346179538875, 180), + bounds = L.latLngBounds(southWest, northEast); + var map = L.map('map', { minZoom: 2, + maxBounds: bounds, + maxBoundsViscosity: 1.0 }).setView([0, 0], 2); var baseLayers = { From 3dba1459adc9ac6d15cfd298aa951042dbbcb213 Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Wed, 19 Jun 2024 15:25:48 +0100 Subject: [PATCH 077/115] move year slider to bottom of polity map --- .../apps/core/templates/core/polity_map.html | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/seshat/apps/core/templates/core/polity_map.html b/seshat/apps/core/templates/core/polity_map.html index 55f1d3f68..4e6a30167 100644 --- a/seshat/apps/core/templates/core/polity_map.html +++ b/seshat/apps/core/templates/core/polity_map.html @@ -16,15 +16,6 @@
- - - -
-
- -


@@ -73,6 +64,19 @@
Base Map:

+
+
+ + + + + +
+
+
+