From f3e54e595596a126fdb20b95c133962ff7347499 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Fri, 25 Nov 2022 15:59:12 +0100 Subject: [PATCH 1/2] Update deps & cleanup refresh tooltips --- poetry.lock | 24 ++++++++++++------------ src/character/views.py | 16 ++++++++-------- src/common/templates/common/base.html | 6 ++---- 3 files changed, 22 insertions(+), 24 deletions(-) diff --git a/poetry.lock b/poetry.lock index ec2572f..f23dc39 100644 --- a/poetry.lock +++ b/poetry.lock @@ -232,7 +232,7 @@ postal = ["cryptography"] [[package]] name = "django-bootstrap5" -version = "22.1" +version = "22.2" description = "Bootstrap 5 for Django" category = "main" optional = false @@ -332,7 +332,7 @@ Django = ">=3.2" [[package]] name = "exceptiongroup" -version = "1.0.2" +version = "1.0.4" description = "Backport of PEP 654 (exception groups)" category = "main" optional = false @@ -400,7 +400,7 @@ python-versions = ">=3.7" [[package]] name = "hypothesis" -version = "6.57.1" +version = "6.58.0" description = "A library for property-based testing" category = "dev" optional = false @@ -429,7 +429,7 @@ zoneinfo = ["backports.zoneinfo (>=0.2.1)", "tzdata (>=2022.6)"] [[package]] name = "identify" -version = "2.5.8" +version = "2.5.9" description = "File identification library for Python" category = "dev" optional = false @@ -1271,8 +1271,8 @@ django-anymail = [ {file = "django_anymail-8.6-py3-none-any.whl", hash = "sha256:49d83d7c16316ca86a624097496881d59b7d71b16bf1c5211cffa5b19ef98d0c"}, ] django-bootstrap5 = [ - {file = "django-bootstrap5-22.1.tar.gz", hash = "sha256:70b51f020ef95a64780a0b5d5fdb1fade6e7b5e26c53355cc4f3648eca239cab"}, - {file = "django_bootstrap5-22.1-py3-none-any.whl", hash = "sha256:cf3f257abf750f19e47eddc106066ddb182576185494965d1408eddcb3a7380b"}, + {file = "django-bootstrap5-22.2.tar.gz", hash = "sha256:e944f5ced342e0e16cde77e1ddacb4b9fd5bce4cc190df2f7da0b8e18a24c9cb"}, + {file = "django_bootstrap5-22.2-py3-none-any.whl", hash = "sha256:5d677bbfb94207c1a034d63a5f39d95ce287ef509e0b31dfb4d233cc81f93bcc"}, ] django-browser-reload = [ {file = "django-browser-reload-1.6.0.tar.gz", hash = "sha256:9ca69c71796f53868bdc7421f120d147f7a64faa0d5d8c06970ba3f8061af63c"}, @@ -1307,8 +1307,8 @@ django-registration = [ {file = "django_registration-3.3-py3-none-any.whl", hash = "sha256:dfa176f594fb465c93495caa55686be723a15829769511383e25172d2efbd0e6"}, ] exceptiongroup = [ - {file = "exceptiongroup-1.0.2-py3-none-any.whl", hash = "sha256:c22f11ec6a10d2b453871c5c5fe887436c4d1961324ce9090f2ca6ddc4180c27"}, - {file = "exceptiongroup-1.0.2.tar.gz", hash = "sha256:a31cd183c3dea02e617aab5153588d5f7258a77b51f0ef41b3815ae8a0d0f695"}, + {file = "exceptiongroup-1.0.4-py3-none-any.whl", hash = "sha256:542adf9dea4055530d6e1279602fa5cb11dab2395fa650b8674eaec35fc4a828"}, + {file = "exceptiongroup-1.0.4.tar.gz", hash = "sha256:bd14967b79cd9bdb54d97323216f8fdf533e278df937aa2a90089e7d6e06e5ec"}, ] filelock = [ {file = "filelock-3.8.0-py3-none-any.whl", hash = "sha256:617eb4e5eedc82fc5f47b6d61e4d11cb837c56cb4544e39081099fa17ad109d4"}, @@ -1389,12 +1389,12 @@ h11 = [ {file = "h11-0.14.0.tar.gz", hash = "sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d"}, ] hypothesis = [ - {file = "hypothesis-6.57.1-py3-none-any.whl", hash = "sha256:91c22db726ffd68f2658e273af111a6fcae2e53fa430580862e8522686b5c071"}, - {file = "hypothesis-6.57.1.tar.gz", hash = "sha256:1d8ed5136f368e343f39172b06f68aa7fd1312cf643c332ab18a75d56789fa90"}, + {file = "hypothesis-6.58.0-py3-none-any.whl", hash = "sha256:c2ffa10c94ff1a4a12f4ff515d78a4a3060a7c5b9968331d7b2707576a29570d"}, + {file = "hypothesis-6.58.0.tar.gz", hash = "sha256:89d9aa676dac7275755371d42d65fc81366ff0e0289ab525aa2bb3dcf7c98b9f"}, ] identify = [ - {file = "identify-2.5.8-py2.py3-none-any.whl", hash = "sha256:48b7925fe122720088aeb7a6c34f17b27e706b72c61070f27fe3789094233440"}, - {file = "identify-2.5.8.tar.gz", hash = "sha256:7a214a10313b9489a0d61467db2856ae8d0b8306fc923e03a9effa53d8aedc58"}, + {file = "identify-2.5.9-py2.py3-none-any.whl", hash = "sha256:a390fb696e164dbddb047a0db26e57972ae52fbd037ae68797e5ae2f4492485d"}, + {file = "identify-2.5.9.tar.gz", hash = "sha256:906036344ca769539610436e40a684e170c3648b552194980bb7b617a8daeb9f"}, ] idna = [ {file = "idna-3.4-py3-none-any.whl", hash = "sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2"}, diff --git a/src/character/views.py b/src/character/views.py index d6b25c8..4173fa9 100644 --- a/src/character/views.py +++ b/src/character/views.py @@ -125,7 +125,7 @@ def character_health_change(request, pk: int): character.health_remaining = value character.save(update_fields=["health_remaining"]) response = HttpResponse(value) - return trigger_client_event(response, "refresh_health_bar", {}) + return trigger_client_event(response, "refresh_health_bar") @login_required @@ -140,7 +140,7 @@ def character_mana_change(request, pk: int): character.mana_remaining = value character.save(update_fields=["mana_remaining"]) response = HttpResponse(value) - return trigger_client_event(response, "refresh_mana_bar", {}) + return trigger_client_event(response, "refresh_mana_bar") @login_required @@ -166,7 +166,7 @@ def character_defense_misc_change(request, pk: int): character.defense_misc = value character.save(update_fields=["defense_misc"]) response = HttpResponse(value) - return trigger_client_event(response, "update_defense", {}) + return trigger_client_event(response, "update_defense") @login_required @@ -178,7 +178,7 @@ def character_shield_change(request, pk: int): character.shield = value character.save(update_fields=["shield"]) response = HttpResponse(value) - return trigger_client_event(response, "update_defense", {}) + return trigger_client_event(response, "update_defense") @login_required @@ -190,7 +190,7 @@ def character_armor_change(request, pk: int): character.armor = value character.save(update_fields=["armor"]) response = HttpResponse(value) - return trigger_client_event(response, "update_defense", {}) + return trigger_client_event(response, "update_defense") @login_required @@ -202,7 +202,7 @@ def character_initiative_misc_change(request, pk: int): character.initiative_misc = value character.save(update_fields=["initiative_misc"]) response = HttpResponse(value) - return trigger_client_event(response, "update_initiative", {}) + return trigger_client_event(response, "update_initiative") @login_required @@ -394,7 +394,7 @@ def remove_state(request, pk: int, state_pk: int): response = render( request, "character/snippets/character_details/states.html", context ) - return trigger_client_event(response, "refresh_tooltips", {}) + return trigger_client_event(response, "refresh_tooltips", after="swap") @login_required @@ -408,7 +408,7 @@ def add_state(request, pk: int, state_pk: int): response = render( request, "character/snippets/character_details/states.html", context ) - return trigger_client_event(response, "refresh_tooltips", {}) + return trigger_client_event(response, "refresh_tooltips", after="swap") @login_required diff --git a/src/common/templates/common/base.html b/src/common/templates/common/base.html index 62184ae..8122730 100644 --- a/src/common/templates/common/base.html +++ b/src/common/templates/common/base.html @@ -56,10 +56,8 @@ let tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl)); addEventListener("refresh_tooltips", function (event) { tooltipList.forEach(tooltip => tooltip.dispose()); - setTimeout(() => { - tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]'); - tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl)); - }, 50); + tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]'); + tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl)); }); From a89af128772396285cc24e13768d0cab805be117 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Fri, 25 Nov 2022 17:46:50 +0100 Subject: [PATCH 2/2] Install Firefox manually in test setup steps Firefox isn't installed in ubuntu-latest anymore. --- .github/workflows/test.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index ae6f36e..16bb3c6 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -12,6 +12,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 + - name: Install Firefox + run: sudo snap remove firefox && sudo add-apt-repository ppa:mozillateam/ppa && sudo apt install --target-release 'o=LP-PPA-mozillateam' firefox - uses: browser-actions/setup-geckodriver@latest - name: Install poetry run: pipx install poetry==1.1.15