From da771af8ef985d8282a87c7ade6c856ca73d2fae Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Thu, 27 Jun 2024 10:17:30 +0100 Subject: [PATCH 01/47] scroll adjust works but ticks missing --- .../apps/core/templates/core/world_map.html | 53 ++++++++++++++----- 1 file changed, 39 insertions(+), 14 deletions(-) diff --git a/seshat/apps/core/templates/core/world_map.html b/seshat/apps/core/templates/core/world_map.html index 19bf0f1ee..0a03bbadf 100644 --- a/seshat/apps/core/templates/core/world_map.html +++ b/seshat/apps/core/templates/core/world_map.html @@ -75,15 +75,26 @@ } #variableLegend { - position: absolute; - bottom: 75; - right: 0; - background-color: rgba(255, 255, 255, 0.8); /* Semi-transparent white */ - padding: 10px; - border-radius: 5px; - max-width: 200px; - z-index: 999; -} + position: absolute; + bottom: 75; + right: 0; + background-color: rgba(255, 255, 255, 0.8); /* Semi-transparent white */ + padding: 10px; + border-radius: 5px; + max-width: 200px; + z-index: 999; + } + + /* Hide scrollbar for WebKit browsers */ + #sliderdiv::-webkit-scrollbar { + display: none; + } + + /* Hide scrollbar for IE, Edge, and Firefox */ + #sliderdiv { + -ms-overflow-style: none; /* IE and Edge */ + scrollbar-width: none; /* Firefox */ + } @@ -190,13 +201,14 @@

Base Map

-
+
-
+
- +
@@ -207,6 +219,19 @@

Base Map

+ + {% block content %} {% if content.include_polity_map %} From bc2967a564c95c6b487a6de0bc5c8099cc279319 Mon Sep 17 00:00:00 2001 From: Kalle Westerling Date: Thu, 4 Jul 2024 09:35:04 +0100 Subject: [PATCH 40/47] Fixing up unnecessary `docs` import causing docs rendering issues --- docs/source/conf.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 2361951bb..571b3fda2 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -16,7 +16,6 @@ sys.path.insert(0, os.path.abspath('../..')) os.environ['DJANGO_SETTINGS_MODULE'] = 'seshat.settings.base' -import sphinx_rtd_theme import seshat @@ -36,7 +35,6 @@ "sphinx.ext.autodoc", "sphinx.ext.autosummary", "sphinx.ext.doctest", - # "sphinx_rtd_theme", "myst_parser", "autoapi.extension", "sphinx_copybutton", @@ -106,10 +104,7 @@ # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output html_theme = "sphinx_book_theme" - -# html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] html_static_path = ["_static"] - html_theme_options = { "use_download_button": True, } From 7ddd3b1785f0cab28842def831971f818c6bd25d Mon Sep 17 00:00:00 2001 From: Kalle Westerling Date: Thu, 4 Jul 2024 09:57:48 +0100 Subject: [PATCH 41/47] Create issue templates Fixes Seshat-Global-History-Databank/seshat#2 --- .github/ISSUE_TEMPLATE/BUG_REPORT.yml | 80 +++++++++++++++++ .github/ISSUE_TEMPLATE/DOCS_IMPROVEMENT.yml | 53 +++++++++++ .github/ISSUE_TEMPLATE/USER_STORY.yml | 97 +++++++++++++++++++++ 3 files changed, 230 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/BUG_REPORT.yml create mode 100644 .github/ISSUE_TEMPLATE/DOCS_IMPROVEMENT.yml create mode 100644 .github/ISSUE_TEMPLATE/USER_STORY.yml diff --git a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml new file mode 100644 index 000000000..1ce966773 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml @@ -0,0 +1,80 @@ +name: "🐛 Bug Report" +description: Create a new ticket for a bug. +title: "🐛 [BUG] - " +labels: [ + "bug" +] +body: + - type: textarea + id: description + attributes: + label: "Description" + description: Please enter an explicit description of your issue + placeholder: Short and explicit description of your incident... + validations: + required: true + # - type: input + # id: reprod-url + # attributes: + # label: "Reproduction URL" + # description: Please enter your GitHub URL to provide a reproduction of the issue + # placeholder: ex. https://github.com/USERNAME/REPO-NAME + # validations: + # required: true + - type: textarea + id: reprod + attributes: + label: "Reproduction steps" + description: Please enter an explicit description of your issue + value: | + 1. Go to '...' + 2. Click on '....' + 3. Scroll down to '....' + 4. See error + render: bash + validations: + required: true + - type: textarea + id: screenshot + attributes: + label: "Screenshots" + description: If applicable, add screenshots to help explain your problem. + value: | + ![DESCRIPTION](LINK.png) + render: bash + validations: + required: false + - type: textarea + id: logs + attributes: + label: "Logs" + description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. + render: bash + validations: + required: false + - type: dropdown + id: browsers + attributes: + label: "Browsers" + description: What browsers are you seeing the problem on ? + multiple: true + options: + - Firefox + - Chrome + - Safari + - Microsoft Edge + - Opera + validations: + required: false + - type: dropdown + id: os + attributes: + label: "OS" + description: What is the impacted environment ? + multiple: true + options: + - Windows + - Linux + - Mac + validations: + required: false \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/DOCS_IMPROVEMENT.yml b/.github/ISSUE_TEMPLATE/DOCS_IMPROVEMENT.yml new file mode 100644 index 000000000..2d1d9a133 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/DOCS_IMPROVEMENT.yml @@ -0,0 +1,53 @@ +name: Documentation Improvement + +description: Suggest changes or improvements to the documentation. + +title: "📚 [Documentation] <title>" + +labels: ["documentation"] + +body: + - type: markdown + attributes: + value: | + ## Documentation Improvement Request + + Thank you for taking the time to help improve our documentation! Please provide the details of your suggestion below. + + ### Example + + **Section of Documentation**: Installation Instructions + + **Description of Improvement**: Add a troubleshooting guide for common installation issues on Windows. + + **Benefits of Improvement**: Helps users resolve installation problems quickly, reducing frustration and support requests. + + **Additional Context**: Based on frequent questions from users in the community forums. + + - type: input + id: section + attributes: + label: Section of Documentation + description: Which section of the documentation does this improvement pertain to? + placeholder: "e.g., Installation Instructions, User Guide, API Reference" + + - type: textarea + id: description + attributes: + label: Description of Improvement + description: Provide a detailed description of the improvement you are suggesting. + placeholder: "Describe the change or addition you would like to see." + + - type: input + id: benefits + attributes: + label: Benefits of Improvement + description: Explain how this improvement will benefit users. + placeholder: "e.g., clearer instructions, easier navigation, more comprehensive coverage" + + - type: textarea + id: context + attributes: + label: Additional Context + description: Add any other context or information related to this improvement request. + placeholder: "Include any relevant links, examples, or references." diff --git a/.github/ISSUE_TEMPLATE/USER_STORY.yml b/.github/ISSUE_TEMPLATE/USER_STORY.yml new file mode 100644 index 000000000..f7772233d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/USER_STORY.yml @@ -0,0 +1,97 @@ +name: Feature request +description: To create a new feature request, we ask that you write a user story. +title: "👤 [User Story]: " +labels: ["feature-request"] +body: + - type: markdown + attributes: + value: | + Thank you for contributing an idea for a new feature! Please fill out the user story details below to help us understand your vision for the new feature. + + - type: input + id: role + attributes: + label: Role + description: Who is the user for this story? + placeholder: ex. As a [Admin] + validations: + required: true + + - type: input + id: feature + attributes: + label: Desired Feature + description: What is the feature you would like to have? + placeholder: I want to [feature description] + validations: + required: true + + - type: input + id: benefit + attributes: + label: Benefit + description: What is the benefit of this feature? + placeholder: So that I can [benefit description] + validations: + required: true + + - type: textarea + id: acceptance-criteria + attributes: + label: Acceptance Criteria + description: + Please describe the conditions that must be met for this story to be + considered complete. + placeholder: | + **GIVEN** [precondition] + **AND** [another precondition if necessary] + **WHEN** [action taken by the user] + **THEN** [expected outcome] + **AND** [another outcome if necessary] + validations: + required: true + + - type: textarea + id: dependencies + attributes: + label: Dependencies + description: Are there any other tasks that need to be completed first? + placeholder: | + - [ ] Dependency 1 (include issue link) + - [ ] Dependency 2 (include issue link) + validations: + required: false + + - type: textarea + id: technical-notes + attributes: + label: Technical Notes + description: + Any technical notes, potential challenges, or architectural + considerations for implementation? + placeholder: | + - Note 1 + - Note 2 + validations: + required: false + + - type: checkboxes + id: definition-of-done + attributes: + label: Definition of Done + description: + Please confirm the following are completed before this story can be + considered done. + options: + - label: The feature fulfills all acceptance criteria. + - label: The code is reviewed and meets team coding standards. + - label: All unit, integration, and end-to-end tests are passed. + - label: The feature meets accessibility standards set for the project. + - label: + The code passes the CI/CD pipeline quality controls (style and + linting). + - label: The feature is merged into the main branch. + - label: The feature is deployed and functional in the QA environment. + - label: + The feature was demonstrated to the team and accepted by the product + owner. \ No newline at end of file From 63cc9cf290df1d03709853e6c0c030fe8caa69c7 Mon Sep 17 00:00:00 2001 From: Ed Chalstrey <edwardchalstrey@gmail.com> Date: Thu, 4 Jul 2024 13:40:37 +0100 Subject: [PATCH 42/47] make popup blank --- seshat/apps/core/templates/core/world_map.html | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/seshat/apps/core/templates/core/world_map.html b/seshat/apps/core/templates/core/world_map.html index 5d40969c0..620d87526 100644 --- a/seshat/apps/core/templates/core/world_map.html +++ b/seshat/apps/core/templates/core/world_map.html @@ -483,6 +483,7 @@ <h1 class="text-teal federicka-huge" id="sliderDate"></h1> var variable = document.getElementById('chooseVariable').value; var selectedYear = document.getElementById('dateSlide').value; var opacity = document.getElementById('opacitySlide').value; + var atLeastOnePolityHighlighted = false; // If variable has changed from the previous selection if (localStorage.getItem('variable') != variable) { @@ -623,6 +624,10 @@ <h1 class="text-teal federicka-huge" id="sliderDate"></h1> // Ignore shapes that are in a union during this year (because we are plotting the union) if ((parseInt(shape.start_year) <= selectedYearInt && parseInt(shape.end_year) >= selectedYearInt) && !dontPlotMeBecauseImInAUnion.includes(shape.seshat_id)) { + if (shapeWeight > 0){ + atLeastOnePolityHighlighted = true; + } + // Format the area float const formattedArea = parseFloat(shape.area).toLocaleString('en-US', { minimumFractionDigits: 0, @@ -979,6 +984,10 @@ <h1 class="text-teal federicka-huge" id="sliderDate"></h1> }; adjustScroll(); + + if (!atLeastOnePolityHighlighted){ + document.getElementById('popup').innerHTML = ''; + } } // Initial plot on page load From 1706005375fc8b88bb291d11fdb59a329569b76c Mon Sep 17 00:00:00 2001 From: Ed Chalstrey <edwardchalstrey@gmail.com> Date: Thu, 4 Jul 2024 13:48:46 +0100 Subject: [PATCH 43/47] remove popup on second click --- .../apps/core/templates/core/world_map.html | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/seshat/apps/core/templates/core/world_map.html b/seshat/apps/core/templates/core/world_map.html index 620d87526..c01b9446a 100644 --- a/seshat/apps/core/templates/core/world_map.html +++ b/seshat/apps/core/templates/core/world_map.html @@ -824,13 +824,6 @@ <h1 class="text-teal federicka-huge" id="sliderDate"></h1> // Listen for the click event on the layer layer.on('click', function (e) { - - // Add the popup to the popup div - document.getElementById('popup').innerHTML = popupContent; - // Set the border colour of the popup div - document.getElementById('popup').style.borderColor = layer.feature.properties.colour; - // Increase the border width of the popup div - document.getElementById('popup').style.borderWidth = '4px'; if (variable == 'polity'){ if (shape.weight === 0) { @@ -838,10 +831,18 @@ <h1 class="text-teal federicka-huge" id="sliderDate"></h1> newWeight = polityBorderWeightSelected; this.setStyle({ weight: newWeight - }); + }); + // Add the popup to the popup div + document.getElementById('popup').innerHTML = popupContent; + // Set the border colour of the popup div + document.getElementById('popup').style.borderColor = layer.feature.properties.colour; + // Increase the border width of the popup div + document.getElementById('popup').style.borderWidth = '4px'; } else { // Decrease the weight of the clicked layer newWeight = polityBorderWeight; + // Remove the popup from the popup div + document.getElementById('popup').innerHTML = ''; }; // Update weights in this layer and others of the same polity map.eachLayer(function (layer) { @@ -881,7 +882,14 @@ <h1 class="text-teal federicka-huge" id="sliderDate"></h1> i++; }); updateLegend(); - }; + } else { + // Add the popup to the popup div + document.getElementById('popup').innerHTML = popupContent; + // Set the border colour of the popup div + document.getElementById('popup').style.borderColor = layer.feature.properties.colour; + // Increase the border width of the popup div + document.getElementById('popup').style.borderWidth = '4px'; + } L.DomEvent.stopPropagation(e); }); } From 888bd6507078741419d95623d0a78dde17400734 Mon Sep 17 00:00:00 2001 From: Kalle Westerling <kalle.westerling@gmail.com> Date: Mon, 8 Jul 2024 09:14:58 +0100 Subject: [PATCH 44/47] Correct the environment names for database connection Fixes #178 --- docs/source/getting-started/setup/local/macos.rst | 10 +++++----- seshat/settings/local.py | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/source/getting-started/setup/local/macos.rst b/docs/source/getting-started/setup/local/macos.rst index 76ad05577..cdf1f55b2 100644 --- a/docs/source/getting-started/setup/local/macos.rst +++ b/docs/source/getting-started/setup/local/macos.rst @@ -219,11 +219,11 @@ The file should look like this: .. code-block:: - NAME=<seshat_db_name> - USER=postgres - HOST=localhost - PORT=5432 - PASSWORD=<db_password> + DB_NAME=<seshat_db_name> + DB_USER=postgres + DB_HOST=localhost + DB_PORT=5432 + DB_PASSWORD=<db_password> Step 10: Migrate the database diff --git a/seshat/settings/local.py b/seshat/settings/local.py index cc8cff03c..2dbdcf9c9 100644 --- a/seshat/settings/local.py +++ b/seshat/settings/local.py @@ -39,11 +39,11 @@ DATABASES = { 'default': { 'ENGINE': 'django.contrib.gis.db.backends.postgis', - 'NAME': env('NAME'), - 'USER': 'postgres', - 'HOST': env('HOST'), - 'PORT': env('PORT'), - 'PASSWORD': env('PASSWORD') + 'NAME': env('DB_NAME'), + 'USER': env('DB_USER') or 'postgres', + 'HOST': env('DB_HOST'), + 'PORT': env('DB_PORT'), + 'PASSWORD': env('DB_PASSWORD') } } """ From bf8f8074e6ac72f726faaab9d005b1ec1c85b194 Mon Sep 17 00:00:00 2001 From: Ed Chalstrey <edwardchalstrey@gmail.com> Date: Mon, 8 Jul 2024 10:27:52 +0100 Subject: [PATCH 45/47] update repo --- .github/workflows/build.yml | 2 +- .github/workflows/tests.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b142a6f55..0893ae54a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,4 +30,4 @@ jobs: with: context: . push: true - tags: docker.pkg.github.com/edwardchalstrey1/seshat/tests-image:latest \ No newline at end of file + tags: docker.pkg.github.com/Seshat-Global-History-Databank/seshat/tests-image:latest \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 13b2c5912..02b0c19df 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -20,8 +20,8 @@ jobs: password: ${{ secrets.GH_TOKEN }} - name: Pull and run Docker image run: | - docker pull docker.pkg.github.com/edwardchalstrey1/seshat/tests-image:latest - docker run -d -p 5432:5432 -v ${{ github.workspace }}:/seshat -e DJANGO_SETTINGS_MODULE=seshat.settings.local -e POSTGRES_PASSWORD=postgres -e PGDATA=/var/lib/postgresql/data/db-files/ -e GITHUB_ACTIONS='true' --name seshat_testing docker.pkg.github.com/edwardchalstrey1/seshat/tests-image:latest + docker pull docker.pkg.github.com/Seshat-Global-History-Databank/seshat/tests-image:latest + docker run -d -p 5432:5432 -v ${{ github.workspace }}:/seshat -e DJANGO_SETTINGS_MODULE=seshat.settings.local -e POSTGRES_PASSWORD=postgres -e PGDATA=/var/lib/postgresql/data/db-files/ -e GITHUB_ACTIONS='true' --name seshat_testing docker.pkg.github.com/Seshat-Global-History-Databank/seshat/tests-image:latest - name: Sleep, then check PostgreSQL connectivity run: | sleep 10 From 10e737d719cd92d6c40bc2fd5cd4b19038f87670 Mon Sep 17 00:00:00 2001 From: Ed Chalstrey <edwardchalstrey@gmail.com> Date: Mon, 8 Jul 2024 10:53:40 +0100 Subject: [PATCH 46/47] rebuild if the build yml is changed --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0893ae54a..a204663d2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,11 +7,13 @@ on: paths: - 'Dockerfile' - 'requirements.txt' + - '.github/workflows/build.yml' pull_request: branches: [dev] paths: - 'Dockerfile' - 'requirements.txt' + - '.github/workflows/build.yml' jobs: build: From 2d582cf4054a4b2c09d24d3afc827cbda62ca849 Mon Sep 17 00:00:00 2001 From: Ed Chalstrey <edwardchalstrey@gmail.com> Date: Mon, 8 Jul 2024 10:55:07 +0100 Subject: [PATCH 47/47] org name to lower case --- .github/workflows/build.yml | 2 +- .github/workflows/tests.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a204663d2..b9a859f64 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,4 +32,4 @@ jobs: with: context: . push: true - tags: docker.pkg.github.com/Seshat-Global-History-Databank/seshat/tests-image:latest \ No newline at end of file + tags: docker.pkg.github.com/seshat-global-history-databank/seshat/tests-image:latest \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 02b0c19df..b74fabf63 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -20,8 +20,8 @@ jobs: password: ${{ secrets.GH_TOKEN }} - name: Pull and run Docker image run: | - docker pull docker.pkg.github.com/Seshat-Global-History-Databank/seshat/tests-image:latest - docker run -d -p 5432:5432 -v ${{ github.workspace }}:/seshat -e DJANGO_SETTINGS_MODULE=seshat.settings.local -e POSTGRES_PASSWORD=postgres -e PGDATA=/var/lib/postgresql/data/db-files/ -e GITHUB_ACTIONS='true' --name seshat_testing docker.pkg.github.com/Seshat-Global-History-Databank/seshat/tests-image:latest + docker pull docker.pkg.github.com/seshat-global-history-databank/seshat/tests-image:latest + docker run -d -p 5432:5432 -v ${{ github.workspace }}:/seshat -e DJANGO_SETTINGS_MODULE=seshat.settings.local -e POSTGRES_PASSWORD=postgres -e PGDATA=/var/lib/postgresql/data/db-files/ -e GITHUB_ACTIONS='true' --name seshat_testing docker.pkg.github.com/seshat-global-history-databank/seshat/tests-image:latest - name: Sleep, then check PostgreSQL connectivity run: | sleep 10