From bcb64eb4660417b4b59648132118618ffa125900 Mon Sep 17 00:00:00 2001 From: Marcel Kornblum Date: Fri, 21 Apr 2023 10:00:55 +0100 Subject: [PATCH] Redo linting (#358) switch flake8 and isort for ruff add djlint to ci-based checking tidy up makefile run full linting on the proejct --- .circleci/config.yml | 41 +- .gitignore | 1 + Makefile | 295 +++++--- about_us/templates/about_us/about_us.html | 16 +- .../templates/about_us/about_us_home.html | 2 +- content/templates/blocks/heading_2.html | 2 +- content/templates/blocks/heading_3.html | 2 +- content/templates/blocks/heading_4.html | 2 +- content/templates/blocks/heading_5.html | 2 +- content/templates/blocks/image.html | 8 +- content/templates/blocks/media.html | 18 +- content/templates/blocks/table.html | 90 ++- content/templates/blocks/text.html | 4 +- content/templates/blocks/video_embed.html | 6 +- content/templates/content/content_page.html | 2 +- core/templates/2_col_content.html | 24 +- core/templates/404.html | 6 +- core/templates/500.html | 26 +- core/templates/base.html | 8 +- core/templates/core/400.html | 4 +- core/templates/core/403.html | 4 +- core/templates/core/404.html | 4 +- core/templates/core/500.html | 4 +- core/templates/core/page_problem_found.html | 14 +- core/templates/includes/child-links.html | 8 +- core/templates/includes/footer.html | 32 +- core/templates/includes/govt_uk_form.html | 34 +- core/templates/includes/header.html | 50 +- core/templates/includes/header_searchv2.html | 66 +- core/templates/includes/news-attribution.html | 4 +- core/templates/includes/pagination.html | 17 +- core/templates/includes/pagination_v2.html | 39 +- core/templates/includes/problem_found.html | 29 +- core/templates/tags/breadcrumbs.html | 30 +- core/templates/tags/cookie_banner.html | 20 +- core/templates/tags/search_beta_banner.html | 13 +- core/templates/tags/site_alert.html | 4 +- core/templates/wagtailadmin/userbar/base.html | 5 +- .../userbar/item_accessibility.html | 1 + .../wagtailadmin/userbar/item_base.html | 2 +- .../country_fact_sheet_home.html | 10 +- home/migrations/test.html | 1 + home/templates/home/home_page.html | 96 +-- home/templates/home/includes/news_item.html | 11 +- networks/templates/networks/network.html | 2 +- .../templates/networks/networks_home.html | 2 +- news/templates/news/includes/lead_story.html | 10 +- .../news/includes/news_categories.html | 7 +- news/templates/news/news_home.html | 25 +- news/templates/news/news_page.html | 43 +- .../peoplefinder/components/audit-log.html | 14 +- .../peoplefinder/components/bullet-list.html | 8 +- .../peoplefinder/components/checkbox.html | 7 +- .../peoplefinder/components/checkboxes.html | 17 +- .../peoplefinder/components/htmx-form.html | 3 +- .../peoplefinder/components/manager/main.html | 32 +- .../components/manager/search-form.html | 22 +- .../components/manager/search-results.html | 18 +- .../peoplefinder/components/messages.html | 6 +- .../peoplefinder/components/pagination.html | 2 +- .../peoplefinder/components/role-edit.html | 48 +- .../components/search-result-person.html | 74 +- .../peoplefinder/components/team-card.html | 17 +- .../peoplefinder/components/team-form.html | 28 +- .../components/team-leaders-ordering.html | 37 +- .../components/team-member-card.html | 6 +- .../components/teams-and-roles.html | 14 +- .../components/update-user-form.html | 22 +- .../peoplefinder/components/warning.html | 2 +- .../peoplefinder/delete-confirmation.html | 27 +- peoplefinder/templates/peoplefinder/page.html | 35 +- .../templates/peoplefinder/profile-edit.html | 466 ++++++------- .../peoplefinder/profile-leaving-dit.html | 49 +- .../templates/peoplefinder/profile.html | 659 ++++++++++-------- .../templates/peoplefinder/search.html | 16 +- .../peoplefinder/team-add-new-subteam.html | 31 +- .../peoplefinder/team-confirm-delete.html | 29 +- .../templates/peoplefinder/team-edit.html | 39 +- .../templates/peoplefinder/team-people.html | 26 +- .../templates/peoplefinder/team-tree.html | 8 +- peoplefinder/templates/peoplefinder/team.html | 155 ++-- poetry.lock | 306 +------- pyproject.toml | 35 +- .../search/partials/result/page.html | 11 +- .../partials/search_category_all_tabs.html | 12 +- .../partials/search_category_single_tab.html | 8 +- .../search/partials/search_form.html | 2 +- .../search/partials/search_results_all.html | 12 +- .../partials/search_results_category.html | 21 +- .../search_results_single_category.html | 12 +- search/templates/search/search.html | 10 +- search/templates/search/search_v2.html | 8 +- setup.cfg | 34 - tools/templates/tools/tool.html | 2 +- tools/templates/tools/tools_home.html | 2 +- .../templates/transition/transition.html | 2 +- .../templates/transition/transition_home.html | 2 +- .../templates/working_at_dit/how_do_i.html | 6 +- .../working_at_dit/policy_guidance.html | 6 +- .../section_home_alpha_order.html | 22 +- .../templates/working_at_dit/topic.html | 102 ++- .../working_at_dit/working_at_dit_home.html | 17 +- 102 files changed, 1800 insertions(+), 1895 deletions(-) delete mode 100644 setup.cfg diff --git a/.circleci/config.yml b/.circleci/config.yml index 4e524ee29..24a261584 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -13,28 +13,20 @@ jobs: name: build containers command: make build - run: - name: install npm packages - command: | - nvm install 18 - npm ci + name: check linting + command: make check - run: - name: build webpack - command: npm run build + name: run containers + command: docker-compose up -d - run: name: check for missing migrations command: make checkmigrations - run: - name: run black (code formatting check) - command: make black-check - - run: - name: run isort - command: make isort-check - - run: - name: run flake8 (coding standards compliance test) - command: make flake8 - - run: - name: run containers - command: docker-compose up -d + name: build frontend + command: | + nvm install 18 + npm ci + npm run build - run: name: run unit tests command: make test @@ -43,9 +35,6 @@ jobs: command: | wget -O codecov.sh https://codecov.io/bash bash ./codecov.sh -t ${CODECOV_TOKEN} -s test-reports -f "*.xml" - - run: - name: Check for fixme comments - command: make check-fixme e2e-tests: machine: image: ubuntu-2004:202101-01 @@ -56,11 +45,11 @@ jobs: name: Copy env file command: cp .env.ci .env - run: - name: install npm packages - command: npm ci - - run: - name: build webpack - command: npm run build + name: build frontend + command: | + nvm install 18 + npm ci + npm run build - run: name: build containers command: make build-all @@ -68,7 +57,7 @@ jobs: name: run e2e tests (playwright) command: make test-e2e - run: - name: Publish unit test coverage + name: Publish e2e test coverage command: | wget -O codecov.sh https://codecov.io/bash bash ./codecov.sh -t ${CODECOV_TOKEN} -s test-reports -f "*.xml" diff --git a/.gitignore b/.gitignore index 9b694d69c..d45302fa1 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ __pycache__ .venv/ .pytest_cache/ .python-version +.ruff_cache /node_modules npm-debug.log* diff --git a/Makefile b/Makefile index 46476fbb8..f9e7edc30 100644 --- a/Makefile +++ b/Makefile @@ -1,90 +1,188 @@ SHELL := /bin/sh -clean: - npm run clean - find . -name '__pycache__' -exec rm -rf {} + +APPLICATION_NAME="Digital Workspace" + +# Colour coding for output +CLR__=\033[0m +CLR_G=\033[32;01m +CLR_Y=\033[33;01m +CLR_R='\033[0;31m' + +help: + @echo "$(CLR_G)|--- $(APPLICATION_NAME) ---|$(CLR__)" + @echo "\n$(CLR_G)Container management$(CLR__)" + @echo "$(CLR_Y)build$(CLR__) : Build the app's docker containers" + @echo "$(CLR_Y)up$(CLR__) : Start the app's docker containers" + @echo "$(CLR_Y)down$(CLR__) : Stop the app's docker containers" + @echo "$(CLR_Y)build-all$(CLR__) : Build all docker containers (inc. testrunner)" + @echo "$(CLR_Y)up-all$(CLR__) : Start all docker containers in the background (inc. testrunner)" + @echo "$(CLR_Y)down-all$(CLR__) : Stop all docker containers (inc. testrunner)" + @echo "\n$(CLR_G)Linting$(CLR__)" + @echo "$(CLR_Y)check$(CLR__) : Run black, ruff and djlint in 'check' modes, and scan for 'fixme' comments" + @echo "$(CLR_Y)fix$(CLR__) : Run black, ruff and djlint in 'fix' modes" + @echo "\n$(CLR_G)Dev utility$(CLR__)" + @echo "$(CLR_Y)shell$(CLR__) : Open a Django shell" + @echo "$(CLR_Y)bash$(CLR__) : Run bash in the wagtail container" + @echo "$(CLR_Y)psql$(CLR__) : Run the psql shell against the DB container" + @echo "$(CLR_Y)requirements$(CLR__) : Export the requirements to requirements.txt" + @echo "$(CLR_Y)clean$(CLR__) : Clean up python cache and webpack assets" + @echo "$(CLR_Y)local-setup$(CLR__) : Run the local setup commands for the host machine interpreter" + @echo "$(CLR_Y)dump-db$(CLR__) : Export the database to a local file" + @echo "$(CLR_Y)reset-db$(CLR__) : Reset the database" + @echo "$(CLR_Y)first-use$(CLR__) : Run the first use commands to set up the project for development" + @echo "$(CLR_Y)superuser$(CLR__) : Create a superuser" + @echo "\n$(CLR_G)Django$(CLR__)" + @echo "$(CLR_Y)makemigrations$(CLR__) : Run Django makemigrations command" + @echo "$(CLR_Y)empty-migration --app=???$(CLR__) : Run Django makemigrations command with `--empty` flag" + @echo "$(CLR_Y)checkmigrations$(CLR__) : Run Django makemigrations command with `--check` flag" + @echo "$(CLR_Y)migrate$(CLR__) : Run Django migrate command" + @echo "$(CLR_Y)collectstatic$(CLR__) : Run the Django collectstatic command" + @echo "$(CLR_Y)findstatic$(CLR__) : Run the Django findstatic command" + @echo "$(CLR_Y)fixtree$(CLR__) : Fix the tree structure of the pages" + @echo "\n$(CLR_G)Testing$(CLR__)" + @echo "$(CLR_Y)test$(CLR__) : Run (only) unit tests with pytest" + @echo "$(CLR_Y)test-e2e$(CLR__) : Run (only) end to end tests with playwright and pytest" + @echo "$(CLR_Y)test-all$(CLR__) : Run all tests with pytest" + @echo "$(CLR_Y)coverage$(CLR__) : Run tests with pytest and generate coverage report" + @echo "$(CLR_Y)e2e-codegen$(CLR__) : Set up local environment and run Playwright's interactive test recorder" + @echo "\n$(CLR_G)Front end$(CLR__)" + @echo "$(CLR_Y)compilescss$(CLR__) : Run Django compilescss command" + @echo "$(CLR_Y)webpack$(CLR__) : Run webpack" + @echo "\n$(CLR_G)Application-specific$(CLR__)" + @echo "$(CLR_Y)elevate --email=someone@example.com$(CLR__) : Elevate the permissions for a given email" + @echo "$(CLR_Y)menus$(CLR__) : Create the menus" + @echo "$(CLR_Y)index$(CLR__) : Reindex the search" + @echo "$(CLR_Y)listlinks$(CLR__) : List all the links in the site" + @echo "$(CLR_Y)wagtail-groups$(CLR__) : Create the wagtail groups" + @echo "$(CLR_Y)pf-groups$(CLR__) : Create the pf groups" + @echo "$(CLR_Y)create_section_homepages$(CLR__) : Create the section homepages" + @echo "$(CLR_Y)setup_v2_user --email=someone@example.com$(CLR__) : Create/enable Django user with v2 search flag" + @echo "$(CLR_Y)data-countries$(CLR__) : Import the countries data" + +# +# Makefile variables +# + +# Run a command in a new container +wagtail-run = docker-compose run --rm wagtail +# Run a command in an existing container +wagtail-exec = docker-compose exec wagtail +# run on existing container if available otherwise a new one +wagtail := ${if $(shell docker ps -q -f name=wagtail),$(wagtail-exec),$(wagtail-run)} + +# Run a command in a new container (don't start dependencies) +wagtail-run-no-deps = docker-compose run --rm --no-deps wagtail +# run on existing container if available otherwise a new one (with no deps) +wagtail-no-deps := ${if $(shell docker ps -q -f name=wagtail),$(wagtail-exec),$(wagtail-run-no-deps)} + +# Run tests in a new container named 'testrunner' +testrunner = docker-compose run --rm --name testrunner wagtail + +chown = $(wagtail-exec) chown $(shell id -u):$(shell id -g) + + +# +# Container management +# -wagtail = docker-compose run --rm wagtail -chown = $(wagtail) chown $(shell id -u):$(shell id -g) - -makemigrations: - $(wagtail) python manage.py makemigrations - $(chown) */migrations/* +build: + DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1 BUILDKIT_INLINE_CACHE=1 docker-compose build -migrations: - $(wagtail) python manage.py makemigrations - $(chown) */migrations/* +build-all: + DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1 BUILDKIT_INLINE_CACHE=1 docker-compose --profile playwright build -empty-migration: - $(wagtail) python manage.py makemigrations --empty $(app) - $(chown) */migrations/* +up: + docker-compose up -checkmigrations: - docker-compose run --rm --no-deps wagtail python manage.py makemigrations --check +up-all: + docker-compose --profile playwright up -d -migrate: - $(wagtail) python manage.py migrate +down: + docker-compose down -compilescss: - $(wagtail) python manage.py compilescss +down-all: + docker-compose --profile playwright down -test: - docker-compose run --rm --name testrunner wagtail pytest -m "not e2e" --reuse-db $(tests) +# +# Linting +# -test-e2e: up-all - docker-compose exec playwright poetry run pytest -m "e2e" - docker-compose stop playwright +check: + $(wagtail-no-deps) black --check . + $(wagtail-no-deps) ruff check . + $(wagtail-no-deps) djlint --check . + ! git --no-pager grep -rni fixme -- ':!./Makefile' ':!./.circleci/config.yml' -test-all: - docker-compose run --rm --name testrunner wagtail pytest +fix: + $(wagtail-no-deps) black . + $(wagtail-no-deps) ruff check --fix . + $(wagtail-no-deps) djlint --reformat . -coverage: - docker-compose run --rm --name testrunner wagtail ./scripts/coverage.sh +# +# Dev utility +# shell: $(wagtail) python manage.py shell_plus -flake8: - docker-compose run --rm --no-deps wagtail flake8 +bash: + $(wagtail) bash -black-check: - docker-compose run --rm --no-deps wagtail black --check . +psql: + PGPASSWORD='postgres' psql -h localhost -U postgres -black: - docker-compose run --rm --no-deps wagtail black . +requirements: + $(wagtail) poetry export --without-hashes --output requirements.txt -isort-check: - docker-compose run --rm --no-deps wagtail isort --check . +clean: + npm run clean + find . -name '__pycache__' -exec rm -rf {} + -isort: - docker-compose run --rm --no-deps wagtail isort . +local-setup: + poetry install -G dev + npm install -check-fixme: - ! git --no-pager grep -rni fixme -- ':!./Makefile' ':!./.circleci/config.yml' +dump-db: + pg_dump digital_workspace -U postgres -h localhost -p 5432 -O -x -c -f dw.dump -up: - docker-compose up +reset-db: + docker-compose kill db + rm -rf ./.db/ + docker-compose start db -up-all: - docker-compose --profile playwright up -d +first-use: + docker-compose --profile playwright down + make reset-db + make migrate + make data-countries + make menus + make create_section_homepages + make wagtail-groups + make pf-groups + make superuser + docker-compose up + make local-setup -down: - docker-compose down +superuser: + $(wagtail) python manage.py shell --command="from django.contrib.auth import get_user_model; get_user_model().objects.create_superuser('admin', email='admin', password='password', first_name='admin', last_name='test')" -down-all: - docker-compose --profile playwright down +# +# Django +# -build: - DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1 BUILDKIT_INLINE_CACHE=1 docker-compose build +makemigrations: + $(wagtail) python manage.py makemigrations + $(chown) */migrations/* -build-all: - DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1 BUILDKIT_INLINE_CACHE=1 docker-compose --profile playwright build +empty-migration: + $(wagtail) python manage.py makemigrations --empty $(app) + $(chown) */migrations/* -webpack: - npm run dev +checkmigrations: + $(wagtail) python manage.py makemigrations --check -elevate: - $(wagtail) python manage.py elevate_sso_user_permissions --email=$(email) +migrate: + $(wagtail) python manage.py migrate collectstatic: $(wagtail) python manage.py collectstatic @@ -92,20 +190,52 @@ collectstatic: findstatic: $(wagtail) python manage.py findstatic $(app) -bash: - $(wagtail) bash +fixtree: + $(wagtail) python manage.py fixtree -psql: - PGPASSWORD='postgres' psql -h localhost -U postgres +# +# Testing +# -requirements: - $(wagtail) poetry export --without-hashes --output requirements.txt +test: + $(testrunner) pytest -m "not e2e" --reuse-db $(tests) -superuser: - $(wagtail) python manage.py shell --command="from django.contrib.auth import get_user_model; get_user_model().objects.create_superuser('admin', email='admin', password='password', first_name='admin', last_name='test')" +test-e2e: up-all + docker-compose exec playwright poetry run pytest -m "e2e" + docker-compose stop playwright -fixtree: - $(wagtail) python manage.py fixtree +test-all: + $(testrunner) pytest + +coverage: + $(testrunner) ./scripts/coverage.sh + +e2e-codegen: + cp .env .env.orig + cp .env.ci .env + docker-compose stop wagtail + docker-compose run --rm -d -p 8000:8000 --env DJANGO_SETTINGS_MODULE=config.settings.test --name wagtail-test-server wagtail + sleep 5 + poetry run playwright codegen http://localhost:8000 + mv .env.orig .env + docker stop wagtail-test-server + +# +# Front end +# + +compilescss: + $(wagtail) python manage.py compilescss + +webpack: + npm run dev + +# +# Application-specific +# + +elevate: + $(wagtail) python manage.py elevate_sso_user_permissions --email=$(email) menus: $(wagtail) python manage.py create_menus @@ -125,37 +255,8 @@ pf-groups: create_section_homepages: $(wagtail) python manage.py create_section_homepages -first-use: - docker-compose --profile playwright down - make migrate - make data-countries - make menus - make create_section_homepages - make wagtail-groups - make pf-groups - make superuser - docker-compose up - setup_v2_user: $(wagtail) python manage.py setup_v2_user $(email) -# Data data-countries: $(wagtail) python manage.py loaddata countries.json - -local-setup: - poetry install - npm install - -e2e-codegen: - cp .env .env.orig - cp .env.ci .env - docker-compose stop wagtail - docker-compose run --rm -d -p 8000:8000 --env DJANGO_SETTINGS_MODULE=config.settings.test --name wagtail-test-server wagtail - sleep 5 - poetry run playwright codegen http://localhost:8000 - mv .env.orig .env - docker stop wagtail-test-server - -dump-db: - pg_dump digital_workspace -U postgres -h localhost -p 5432 -O -x -c -f dw.dump diff --git a/about_us/templates/about_us/about_us.html b/about_us/templates/about_us/about_us.html index 5390e0d82..b7af651d9 100644 --- a/about_us/templates/about_us/about_us.html +++ b/about_us/templates/about_us/about_us.html @@ -11,15 +11,17 @@

{{ page.title }}

{% if page_topics.count > 0 %} {% endif %} {% include "includes/child-links.html" with children=children num_cols=3 %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/about_us/templates/about_us/about_us_home.html b/about_us/templates/about_us/about_us_home.html index 0c107ac54..51378ec1d 100644 --- a/about_us/templates/about_us/about_us_home.html +++ b/about_us/templates/about_us/about_us_home.html @@ -8,4 +8,4 @@

{{ page.title }}

{% endfor %}
{% include "includes/child-links.html" with children=children num_cols=2 %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/content/templates/blocks/heading_2.html b/content/templates/blocks/heading_2.html index 2d01018e3..8fe6a3d60 100644 --- a/content/templates/blocks/heading_2.html +++ b/content/templates/blocks/heading_2.html @@ -1 +1 @@ -

{{ value }}

\ No newline at end of file +

{{ value }}

diff --git a/content/templates/blocks/heading_3.html b/content/templates/blocks/heading_3.html index 44a53ebf6..e5651c179 100644 --- a/content/templates/blocks/heading_3.html +++ b/content/templates/blocks/heading_3.html @@ -1 +1 @@ -

{{ value }}

\ No newline at end of file +

{{ value }}

diff --git a/content/templates/blocks/heading_4.html b/content/templates/blocks/heading_4.html index e9b2a88e6..01716c1d5 100644 --- a/content/templates/blocks/heading_4.html +++ b/content/templates/blocks/heading_4.html @@ -1 +1 @@ -

{{ value }}

\ No newline at end of file +

{{ value }}

diff --git a/content/templates/blocks/heading_5.html b/content/templates/blocks/heading_5.html index 29c8fa10f..22cd58c1a 100644 --- a/content/templates/blocks/heading_5.html +++ b/content/templates/blocks/heading_5.html @@ -1 +1 @@ -
{{ value }}
\ No newline at end of file +
{{ value }}
diff --git a/content/templates/blocks/image.html b/content/templates/blocks/image.html index 22868d3af..b1e4e429e 100644 --- a/content/templates/blocks/image.html +++ b/content/templates/blocks/image.html @@ -1,11 +1,7 @@ {% load wagtailimages_tags %}
- {% image value.image width-825 alt=value.alt %} + {% image value.image width-825 alt=value.alt %} - {% if value.caption %} -
- {{ value.caption }} -
- {% endif %} + {% if value.caption %}
{{ value.caption }}
{% endif %}
diff --git a/content/templates/blocks/media.html b/content/templates/blocks/media.html index f50b90fc4..0263c69f3 100644 --- a/content/templates/blocks/media.html +++ b/content/templates/blocks/media.html @@ -1,9 +1,9 @@ - <{{ value.media_file.type }} preload="meta" controls class="ws-streamfield-content__media"{% if value.media_file.thumbnail %} poster="{{ value.media_file.thumbnail.url }}"{% endif %}> - {% for s in value.media_file.sources %} - - {% endfor %} -

- {{ value.media_file.type|capfirst }} file: - {{ value.media_file.title }} -

- +<{{ value.media_file.type }} preload="meta" controls class="ws-streamfield-content__media" +{% if value.media_file.thumbnail %}poster="{{ value.media_file.thumbnail.url }}"{% endif %} +> +{% for s in value.media_file.sources %}{% endfor %} +

+ {{ value.media_file.type|capfirst }} file: + {{ value.media_file.title }} +

+ diff --git a/content/templates/blocks/table.html b/content/templates/blocks/table.html index 5b23b3ed1..c58555de1 100644 --- a/content/templates/blocks/table.html +++ b/content/templates/blocks/table.html @@ -1,59 +1,57 @@ {% load table_block_tags %} - {% if table_caption %} - - {% endif %} + {% if table_caption %}{% endif %} {% if table_header %} - - {% for column in table_header %} - {% with forloop.counter0 as col_index %} - - {% endwith %} - {% endfor %} - + + {% for column in table_header %} + {% with forloop.counter0 as col_index %} + + {% endwith %} + {% endfor %} + {% endif %} - {% for row in data %} - {% with forloop.counter0 as row_index %} - - {% for column in row %} - {% with forloop.counter0 as col_index %} - {% if first_col_is_header and forloop.first %} - - {% else %} - + {% for column in row %} + {% with forloop.counter0 as col_index %} + {% if first_col_is_header and forloop.first %} + {% else %} - {{ column.strip|linebreaksbr }} + {% endif %} - {% endif %} - - {% endif %} + {% endwith %} + {% endfor %} + {% endwith %} - {% endfor %} - - {% endwith %} - {% endfor %} + {% endfor %}
{{ table_caption }}{{ table_caption }}
- {% if column.strip %} - {% if html_renderer %} - {{ column.strip|safe|linebreaksbr }} - {% else %} - {{ column.strip|linebreaksbr }} - {% endif %} - {% endif %} -
+ {% if column.strip %} + {% if html_renderer %} + {{ column.strip|safe|linebreaksbr }} + {% else %} + {{ column.strip|linebreaksbr }} + {% endif %} + {% endif %} +
- {% if column.strip %} - {% if html_renderer %} - {{ column.strip|safe|linebreaksbr }} - {% else %} - {{ column.strip|linebreaksbr }} - {% endif %} - {% endif %} - - {% if column.strip %} - {% if html_renderer %} - {{ column.strip|safe|linebreaksbr }} + {% for row in data %} + {% with forloop.counter0 as row_index %} +
+ {% if column.strip %} + {% if html_renderer %} + {{ column.strip|safe|linebreaksbr }} + {% else %} + {{ column.strip|linebreaksbr }} + {% endif %} + {% endif %} + + {% if column.strip %} + {% if html_renderer %} + {{ column.strip|safe|linebreaksbr }} + {% else %} + {{ column.strip|linebreaksbr }} + {% endif %} + {% endif %} +
diff --git a/content/templates/blocks/text.html b/content/templates/blocks/text.html index 21a8cb8db..c3e91fe19 100644 --- a/content/templates/blocks/text.html +++ b/content/templates/blocks/text.html @@ -1,5 +1,3 @@ {% load wagtailcore_tags %} -
- {{ value|richtext }} -
+
{{ value|richtext }}
diff --git a/content/templates/blocks/video_embed.html b/content/templates/blocks/video_embed.html index 422243922..ca5ee6e20 100644 --- a/content/templates/blocks/video_embed.html +++ b/content/templates/blocks/video_embed.html @@ -1,7 +1,5 @@ {% load wagtailcore_tags wagtailembeds_tags %} {% block content %} -
- {% embed self.video.url max_width=540 %} -
-{% endblock %} \ No newline at end of file +
{% embed self.video.url max_width=540 %}
+{% endblock %} diff --git a/content/templates/content/content_page.html b/content/templates/content/content_page.html index 4d42cc6c9..6eb608126 100644 --- a/content/templates/content/content_page.html +++ b/content/templates/content/content_page.html @@ -7,4 +7,4 @@

{{ page.title }}

{% for block in page.body %} {% include_block block %} {% endfor %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/core/templates/2_col_content.html b/core/templates/2_col_content.html index dfa73a850..061242f47 100644 --- a/core/templates/2_col_content.html +++ b/core/templates/2_col_content.html @@ -1,18 +1,18 @@ {% extends "base.html" %} {% block main_content %} -
-
-
-
- {% block content %}{% endblock %} -
-
+
+
+
+
+ {% block content %}{% endblock %} +
-
-
- {% block tertiary_col_content %}{% endblock %} -
+
+
+
+ {% block tertiary_col_content %}{% endblock %}
-{% endblock %} \ No newline at end of file +
+{% endblock %} diff --git a/core/templates/404.html b/core/templates/404.html index 694194880..0ff6177a6 100644 --- a/core/templates/404.html +++ b/core/templates/404.html @@ -10,8 +10,8 @@

Page not found

If you pasted the web address, check you copied the entire address.

- If the web address is correct or you selected a link or button, - contact the Digital Workspace team - to let us know. + If the web address is correct or you selected a link or button, + contact the Digital Workspace team + to let us know.

{% endblock %} diff --git a/core/templates/500.html b/core/templates/500.html index 47fa97127..5c49ce450 100644 --- a/core/templates/500.html +++ b/core/templates/500.html @@ -1,21 +1,23 @@ - - Digital Workspace - Sorry, there is a problem + + Digital Workspace - Sorry, there is a problem - - + + - - + + - -

Sorry, there is a problem with Digital Workspace

-

The Digital Workspace team have been notified and are working to fix it. Please try again later.

-

Return to the homepage

- + +

Sorry, there is a problem with Digital Workspace

+

The Digital Workspace team have been notified and are working to fix it. Please try again later.

+

+ Return to the homepage +

+ diff --git a/core/templates/base.html b/core/templates/base.html index 22bbb001a..5b5686601 100644 --- a/core/templates/base.html +++ b/core/templates/base.html @@ -8,7 +8,7 @@ {% if request.in_preview_panel %}{% endif %} - + {% block title %} {% if self.seo_title %} @@ -21,8 +21,8 @@ - - + + {% if settings.GTM_CODE %} + -

Edit profile

-
- {% csrf_token %} +

Edit profile

+ + {% csrf_token %} - {% include 'peoplefinder/components/error-summary.html' with form=form %} + {% include 'peoplefinder/components/error-summary.html' with form=form %} -
-

Personal details

+
+

Personal details

- {% include 'peoplefinder/components/input.html' with field=form.first_name %} - {% include 'peoplefinder/components/input.html' with field=form.last_name %} + {% include 'peoplefinder/components/input.html' with field=form.first_name %} + {% include 'peoplefinder/components/input.html' with field=form.last_name %} -
- - - Add pronouns (optional) - - -
- {% include 'peoplefinder/components/input.html' with field=form.pronouns %} +
+ + Add pronouns (optional) + +
{% include 'peoplefinder/components/input.html' with field=form.pronouns %}
+
+
+ +
+

Email addresses

+ + {% include 'peoplefinder/components/input.html' with field=form.email %} + +
+ + + Warning + Do not enter any of the following as your main work email address: +
    +
  • a shared email address, for example, a Private Office or jobshare mailbox
  • +
  • a secondary work email address, for example, a trade.gov.uk email address if you are employed by FCO at post
  • +
  • an alternative work email address that is not safe for official information, for example, fcowebmail.gov.uk
  • +
  • a personal email address, for example, Gmail
  • +
+
- -
-
-

Email addresses

- - {% include 'peoplefinder/components/input.html' with field=form.email %} - -
- - - Warning - Do not enter any of the following as your main work email address: -
    -
  • a shared email address, for example, a Private Office or jobshare mailbox
  • -
  • a secondary work email address, for example, a trade.gov.uk email address if you are employed by FCO at post
  • -
  • an alternative work email address that is not safe for official information, for example, fcowebmail.gov.uk
  • -
  • a personal email address, for example, Gmail
  • -
-
-
- -

- If you want to show a different email address on your profile for your colleagues to contact you on instead, - for example a jobshare mailbox or your Private Office address, you can: +

+ If you want to show a different email address on your profile for your colleagues to contact you on instead, + for example a jobshare mailbox or your Private Office address, you can: +

+ + Add a contact email address (optional) + +
{% include 'peoplefinder/components/input.html' with field=form.contact_email %}
+
+

+ +
+ +
+

Contact details

+ + {% include 'peoplefinder/components/input.html' with field=form.primary_phone_number %} +
- - Add a contact email address (optional) - + Add alternative contact number (optional)
- {% include 'peoplefinder/components/input.html' with field=form.contact_email %} + {% include 'peoplefinder/components/input.html' with field=form.secondary_phone_number %}
-

+
-
+
+

Location and working patterns

-
-

Contact details

+ {% include 'peoplefinder/components/input.html' with field=form.country %} - {% include 'peoplefinder/components/input.html' with field=form.primary_phone_number %} + {% include 'peoplefinder/components/input.html' with field=form.town_city_or_region %} -
- - - Add alternative contact number (optional) - - -
- {% include 'peoplefinder/components/input.html' with field=form.secondary_phone_number %} -
-
-
+ {% include 'peoplefinder/components/checkboxes.html' with field=form.buildings %} -
-

Location and working patterns

+
+ + Add UK regional or international location (if applicable) + +
+ {% include 'peoplefinder/components/input.html' with field=form.regional_building %} - {% include 'peoplefinder/components/input.html' with field=form.country %} + {% include 'peoplefinder/components/input.html' with field=form.international_building %} +
+
- {% include 'peoplefinder/components/input.html' with field=form.town_city_or_region %} +
+ + Add location in building or change working days (optional) + +
+ {% include 'peoplefinder/components/input.html' with field=form.location_in_building %} + {% include 'peoplefinder/components/checkboxes.html' with field=form.workdays %} +
+
+
- {% include 'peoplefinder/components/checkboxes.html' with field=form.buildings %} +
+

Grade and manager

-
- - - Add UK regional or international location (if applicable) - - -
- {% include 'peoplefinder/components/input.html' with field=form.regional_building %} + {% include 'peoplefinder/components/input.html' with field=form.grade %} - {% include 'peoplefinder/components/input.html' with field=form.international_building %} -
-
- -
- - - Add location in building or change working days (optional) - - -
- {% include 'peoplefinder/components/input.html' with field=form.location_in_building %} - {% include 'peoplefinder/components/checkboxes.html' with field=form.workdays %} +
+ + {% include 'peoplefinder/components/manager/main.html' with profile=profile manager=profile.manager %}
-
-
-
-

Grade and manager

+ {% include 'peoplefinder/components/checkbox.html' with field=form.do_not_work_for_dit %} +
- {% include 'peoplefinder/components/input.html' with field=form.grade %} +
+

Skills, interests and networks

-
- - {% include 'peoplefinder/components/manager/main.html' with profile=profile manager=profile.manager %} -
+
+ + Add skills + +
+ {% include 'peoplefinder/components/checkboxes.html' with field=form.key_skills %} + {% include 'peoplefinder/components/input.html' with field=form.other_key_skills %} +
+
- {% include 'peoplefinder/components/checkbox.html' with field=form.do_not_work_for_dit %} -
+
+ + Add languages + +
+ {% include 'peoplefinder/components/input.html' with field=form.fluent_languages %} + {% include 'peoplefinder/components/input.html' with field=form.intermediate_languages %} +
+
-
-

Skills, interests and networks

- -
- - - Add skills - - -
- {% include 'peoplefinder/components/checkboxes.html' with field=form.key_skills %} - {% include 'peoplefinder/components/input.html' with field=form.other_key_skills %} -
-
- -
- - - Add languages - - -
- {% include 'peoplefinder/components/input.html' with field=form.fluent_languages %} - {% include 'peoplefinder/components/input.html' with field=form.intermediate_languages %} -
-
- -
- - - Add learning and development interests - - -
- {% include 'peoplefinder/components/checkboxes.html' with field=form.learning_interests %} - {% include 'peoplefinder/components/input.html' with field=form.other_learning_interests %} -

Get opportunities to learn and develop.

-
-
- -
- - - Add networks I belong to - - -
- {% include 'peoplefinder/components/checkboxes.html' with field=form.networks %} -

Join a network.

-
-
- -
- - - Add professions I belong to - - -
- {% include 'peoplefinder/components/checkboxes.html' with field=form.professions %} -

Find out about our professions.

-
-
- -
- - - Add additional roles and responsibilities - - -
- {% include 'peoplefinder/components/checkboxes.html' with field=form.additional_roles %} - {% include 'peoplefinder/components/input.html' with field=form.other_additional_roles %} -
-
- -
- - - Add previous experience - - -
- {% include 'peoplefinder/components/input.html' with field=form.previous_experience %} -
-
-
+
+ + Add learning and development interests + +
+ {% include 'peoplefinder/components/checkboxes.html' with field=form.learning_interests %} + {% include 'peoplefinder/components/input.html' with field=form.other_learning_interests %} +

+ Get opportunities to learn and develop. +

+
+
-
-

Profile photo

- -
- +
+ + Add networks I belong to + +
+ {% include 'peoplefinder/components/checkboxes.html' with field=form.networks %} +

+ Join a network. +

+
+
-
- {% include 'peoplefinder/components/teams-and-roles.html' with profile=profile role_forms=role_forms %} -
+
+ + Add professions I belong to + +
+ {% include 'peoplefinder/components/checkboxes.html' with field=form.professions %} +

+ Find out about our professions. +

+
+
+ +
+ + Add additional roles and responsibilities + +
+ {% include 'peoplefinder/components/checkboxes.html' with field=form.additional_roles %} + {% include 'peoplefinder/components/input.html' with field=form.other_additional_roles %} +
+
+ +
+ + Add previous experience + +
+ {% include 'peoplefinder/components/input.html' with field=form.previous_experience %} +
+
+
+ +
+

Profile photo

+ +
+ -{% if perms.peoplefinder.delete_person %}
-

SSO user

- {% include 'peoplefinder/components/update-user-form.html' with profile=profile form=update_user_form %} + {% include 'peoplefinder/components/teams-and-roles.html' with profile=profile role_forms=role_forms %}
-{% endif %} - -{% if request.user.is_superuser %} -
-

Administrative options

- -
- - - Permissions - - -
-
- Administrators on People Finder can view global audit trails, reports, and debugging - information as well as perform all groups and people management functions. + + {% if perms.peoplefinder.delete_person %} +
+

SSO user

+ {% include 'peoplefinder/components/update-user-form.html' with profile=profile form=update_user_form %} +
+ {% endif %} + + {% if request.user.is_superuser %} +
+

Administrative options

+ +
+ + Permissions + +
+
+ Administrators on People Finder can view global audit trails, reports, and debugging + information as well as perform all groups and people management functions. +
+ {% include 'peoplefinder/components/checkbox.html' with field=form.is_superuser %} + {% include 'peoplefinder/components/checkbox.html' with field=form.is_team_admin %} + {% include 'peoplefinder/components/checkbox.html' with field=form.is_person_admin %}
- {% include 'peoplefinder/components/checkbox.html' with field=form.is_superuser %} - {% include 'peoplefinder/components/checkbox.html' with field=form.is_team_admin %} - {% include 'peoplefinder/components/checkbox.html' with field=form.is_person_admin %} -
-
-
-{% endif %} - -

- All the information on your profile will be visible to DBT staff and contractors on - Digital Workspace and other internal DBT tools. Occasionally, we may collate this - data for departmental insights. -

-

- This is a voluntary collection of your information, by submitting this form you are agreeing to the terms and conditions regarding the collection and processing of your data and are providing consent for this information to be collected and processed. - This follows our privacy policy. -

- -{# Actions #} - -Cancel and go back - -{% endblock %} \ No newline at end of file + + + {% endif %} + +

+ All the information on your profile will be visible to DBT staff and contractors on + Digital Workspace and other internal DBT tools. Occasionally, we may collate this + data for departmental insights. +

+

+ This is a voluntary collection of your information, by submitting this form you are agreeing to the terms and conditions regarding the collection and processing of your data and are providing consent for this information to be collected and processed. + This follows our privacy policy. +

+ + {# Actions #} + + Cancel and go back + +{% endblock %} diff --git a/peoplefinder/templates/peoplefinder/profile-leaving-dit.html b/peoplefinder/templates/peoplefinder/profile-leaving-dit.html index 1f807c13d..a3830bfb1 100644 --- a/peoplefinder/templates/peoplefinder/profile-leaving-dit.html +++ b/peoplefinder/templates/peoplefinder/profile-leaving-dit.html @@ -11,28 +11,29 @@ {% block location %}Let us know someone is leaving{% endblock %} {% block content %} -{% if request.user == profile.user %} -

Let us know you are leaving DBT

- -

- If you are leaving DBT, please provide details in the form below. Our support team - will confirm the details and remove your profile. -

-{% else %} -

Let us know {{ profile.full_name }} is leaving DBT

- -

- If {{ profile.full_name }} has left DBT, please provide details in the form below. Our support team - will confirm the details and remove their profile. Your profile details will be included with the request. -

-{% endif %} - -
- {% csrf_token %} - - {% include 'peoplefinder/components/input.html' with field=form.comment %} - - - Cancel and go back -
+ {% if request.user == profile.user %} +

Let us know you are leaving DBT

+ +

+ If you are leaving DBT, please provide details in the form below. Our support team + will confirm the details and remove your profile. +

+ {% else %} +

Let us know {{ profile.full_name }} is leaving DBT

+ +

+ If {{ profile.full_name }} has left DBT, please provide details in the form below. Our support team + will confirm the details and remove their profile. Your profile details will be included with the request. +

+ {% endif %} + +
+ {% csrf_token %} + + {% include 'peoplefinder/components/input.html' with field=form.comment %} + + + Cancel and go back +
{% endblock %} diff --git a/peoplefinder/templates/peoplefinder/profile.html b/peoplefinder/templates/peoplefinder/profile.html index 343f1983c..313f173c2 100644 --- a/peoplefinder/templates/peoplefinder/profile.html +++ b/peoplefinder/templates/peoplefinder/profile.html @@ -8,337 +8,408 @@ {% block location %}{{ profile.full_name }}{% endblock %} {% block content %} -
-
- {% if profile.photo %} - - {% else %} - - {% endif %} -
-
-

{{ profile.full_name }}

- - {% if not profile.is_active %} -
- - - Warning - This profile is inactive since {{ profile.became_inactive|naturaltime }}. - -
- {% endif %} - - {% if profile.is_stale %} -
- - - Warning - This profile was last edited {{ profile.edited_or_confirmed_at|naturaltime }}. - -
- {% else %} -

Last edited {{ profile.edited_or_confirmed_at|naturalday:"j F Y" }}

- {% endif %} - - {% if profile.profile_completion < 100 %} -
- - - Warning - Your profile is only {{ profile.profile_completion|floatformat:0 }}% complete. - -
- {% endif %} +
+
+ {% if profile.photo %} + + {% else %} + + {% endif %} +
+
+

{{ profile.full_name }}

+ + {% if not profile.is_active %} +
+ + + Warning + This profile is inactive since {{ profile.became_inactive|naturaltime }}. + +
+ {% endif %} -
-
Preferred email
- {% if profile.contact_email %} -
{{ profile.contact_email }}
+ {% if profile.is_stale %} +
+ + + Warning + This profile was last edited {{ profile.edited_or_confirmed_at|naturaltime }}. + +
{% else %} -
{{ profile.email }}
+

Last edited {{ profile.edited_or_confirmed_at|naturalday:"j F Y" }}

{% endif %} - {% if profile.primary_phone_number %} -
Preferred contact number
-
{{ profile.primary_phone_number }}
+ {% if profile.profile_completion < 100 %} +
+ + + Warning + Your profile is only {{ profile.profile_completion|floatformat:0 }}% complete. + +
{% endif %} -
- {% for role in roles %} -

- {% if role.job_title %} - {{ role.job_title }} in +

+
Preferred email
+ {% if profile.contact_email %} +
+ {{ profile.contact_email }} +
{% else %} - Member of +
+ {{ profile.email }} +
{% endif %} - {{ role.team.name }} -

- {% endfor %} - -
-

- {% if profile.is_active %} - Edit profile - - {% if profile.is_stale and request.user == profile.user %} - - {% endif %} - {% if perms.peoplefinder.delete_person and request.user != profile.user %} -

- {% csrf_token %} - -
- {% endif %} - {% elif perms.peoplefinder.delete_person %} - + {% if profile.primary_phone_number %} +
Preferred contact number
+
+ {{ profile.primary_phone_number }} +
{% endif %} -

-
+
- {% if request.user == profile.user %} -

Let us know if you are leaving DBT.

- {% else %} -

Let us know if {{ profile.full_name }} has left DBT.

- {% endif %} + {% for role in roles %} +

+ {% if role.job_title %} + {{ role.job_title }} in + {% else %} + Member of + {% endif %} + {{ role.team.name }} +

+ {% endfor %} + +
+

+ {% if profile.is_active %} + Edit profile + + {% if profile.is_stale and request.user == profile.user %} + + {% endif %} + + {% if perms.peoplefinder.delete_person and request.user != profile.user %} +

+ {% csrf_token %} + +
+ {% endif %} + {% elif perms.peoplefinder.delete_person %} + + {% endif %} +

+
+ + {% if request.user == profile.user %} +

+ Let us know if you are leaving DBT. +

+ {% else %} +

+ Let us know if {{ profile.full_name }} has left DBT. +

+ {% endif %} +
-
-
+
-
- {% if profile.buildings %} -
-
Place(s) I usually work
-
{{ profile.buildings.all|join:", " }}
-
- {% endif %} +
+ {% if profile.buildings %} +
+
Place(s) I usually work
+
+ {{ profile.buildings.all|join:", " }} +
+
+ {% endif %} - {% if profile.location_in_building %} -
-
Location in building
-
{{ profile.location_in_building }}
-
- {% endif %} + {% if profile.location_in_building %} +
+
Location in building
+
+ {{ profile.location_in_building }} +
+
+ {% endif %} - {% if profile.town_city_or_region %} -
-
Town, city or region
-
{{ profile.town_city_or_region }}
-
- {% endif %} + {% if profile.town_city_or_region %} +
+
Town, city or region
+
+ {{ profile.town_city_or_region }} +
+
+ {% endif %} - {% if profile.country %} -
-
Country
-
{{ profile.country }}
-
- {% endif %} + {% if profile.country %} +
+
Country
+
+ {{ profile.country }} +
+
+ {% endif %} - {% if profile.regional_building %} -
-
Other - UK regional
-
{{ profile.regional_building }}
-
- {% endif %} + {% if profile.regional_building %} +
+
Other - UK regional
+
+ {{ profile.regional_building }} +
+
+ {% endif %} + + {% if profile.international_building %} +
+
Other - Overseas
+
+ {{ profile.international_building }} +
+
+ {% endif %} - {% if profile.international_building %}
-
Other - Overseas
-
{{ profile.international_building }}
+
Preferred email
+ {% if profile.contact_email %} +
+ {{ profile.contact_email }} +
+ {% else %} +
+ {{ profile.email }} +
+ {% endif %}
- {% endif %} -
-
Preferred email
- {% if profile.contact_email %} -
{{ profile.contact_email }}
- {% else %} -
{{ profile.email }}
+ {% if profile.primary_phone_number %} +
+
Preferred contact number
+
+ {{ profile.primary_phone_number }} +
+
{% endif %} -
- {% if profile.primary_phone_number %} -
-
Preferred contact number
-
{{ profile.primary_phone_number }}
-
- {% endif %} + {% if profile.secondary_phone_number %} +
+
Alternative contact number
+
+ {{ profile.secondary_phone_number }} +
+
+ {% endif %} - {% if profile.secondary_phone_number %} -
-
Alternative contact number
-
{{ profile.secondary_phone_number }}
-
- {% endif %} + {% if profile.manager %} +
+
My manager
+
+ {{ profile.manager.full_name }} +
+
+ {% endif %} - {% if profile.manager %} - - {% endif %} + {% if profile.pronouns %} +
+
My pronouns
+
+ {{ profile.pronouns }} +
+
+ {% endif %} - {% if profile.pronouns %} -
-
My pronouns
-
{{ profile.pronouns }}
-
- {% endif %} + {% if profile.workdays.exists %} +
+
Days I work
+
+ {{ profile.get_workdays_display }} +
+
+ {% endif %} - {% if profile.workdays.exists %} -
-
Days I work
-
{{ profile.get_workdays_display }}
-
- {% endif %} + {% if profile.key_skills.exists or profile.other_key_skills %} +
+
Skills
+
+ {{ profile.get_all_key_skills|join:", " }} +
+
+ {% endif %} - {% if profile.key_skills.exists or profile.other_key_skills %} -
-
Skills
-
{{ profile.get_all_key_skills|join:", " }}
-
- {% endif %} + {% if profile.fluent_languages %} +
+
Fluent languages
+
+ {{ profile.fluent_languages }} +
+
+ {% endif %} - {% if profile.fluent_languages %} -
-
Fluent languages
-
{{ profile.fluent_languages }}
-
- {% endif %} + {% if profile.intermediate_languages %} +
+
Intermediate languages
+
+ {{ profile.intermediate_languages }} +
+
+ {% endif %} - {% if profile.intermediate_languages %} -
-
Intermediate languages
-
{{ profile.intermediate_languages }}
-
- {% endif %} + {% if profile.grade %} +
+
Grade
+
+ {{ profile.grade }} +
+
+ {% endif %} - {% if profile.grade %} -
-
Grade
-
{{ profile.grade }}
-
- {% endif %} + {% if profile.previous_experience %} +
+
Previous positions held
+
+ {{ profile.previous_experience|linebreaksbr }} +
+
+ {% endif %} - {% if profile.previous_experience %} -
-
Previous positions held
-
{{ profile.previous_experience|linebreaksbr }}
-
- {% endif %} + {% if profile.learning_interests.exists or profile.other_learning_interests %} +
+
My learning and development interests
+
+ {{ profile.get_all_learning_interests|join:", " }} +
+
+ {% endif %} - {% if profile.learning_interests.exists or profile.other_learning_interests %} -
-
My learning and development interests
-
{{ profile.get_all_learning_interests|join:", " }}
-
- {% endif %} + {% if profile.networks.exists %} +
+
Networks I belong to
+
+ {{ profile.networks.all|join:", " }} +
+
+ {% endif %} - {% if profile.networks.exists %} -
-
Networks I belong to
-
{{ profile.networks.all|join:", " }}
-
- {% endif %} + {% if profile.professions.exists %} +
+
Professions I belong to
+
+ {{ profile.professions.all|join:", " }} +
+
+ {% endif %} - {% if profile.professions.exists %} -
-
Professions I belong to
-
{{ profile.professions.all|join:", " }}
-
+ {% if profile.additional_roles.exists or profile.other_additional_roles %} +
+
My additional roles and responsibilities
+
+ {{ profile.get_all_additional_roles|join:", " }} +
+
+ {% endif %} +
+ + {% if perms.peoplefinder.view_auditlog %} +
+ + Internal user details + +
+
+
+
Staff SSO user ID
+
+ {{ profile.user.username }} +
+
+
+
Legacy staff SSO user ID
+
+ {{ profile.user.legacy_sso_user_id }} +
+
+
+
Internal user ID
+
+ {{ profile.user_id }} +
+
+
+
Groups
+
+ {% include 'peoplefinder/components/bullet-list.html' with list=profile.user.groups.all %} +
+
+
+
User permissions
+
+ {% include 'peoplefinder/components/bullet-list.html' with list=profile.user.user_permissions.all %} +
+
+
+
Is staff
+
+ {{ profile.user.is_staff }} +
+
+
+
Is superuser
+
+ {{ profile.user.is_superuser }} +
+
+
+
Profile created at
+
+ {{ profile.created_at }} +
+
+
+
Profile updated at
+
+ {{ profile.updated_at }} +
+
+
+
Profile edited or confirmed at
+
+ {{ profile.edited_or_confirmed_at }} +
+
+
+
+
{% endif %} - {% if profile.additional_roles.exists or profile.other_additional_roles %} -
-
My additional roles and responsibilities
-
{{ profile.get_all_additional_roles|join:", " }}
-
+ {% if request.user == profile.user or perms.peoplefinder.view_auditlog %} +
+ + Audit log + +
+ {% include 'peoplefinder/components/audit-log.html' with audit_log=profile_audit_log.reverse excluded_keys=profile_audit_log_excluded_keys %} +
+
{% endif %} -
- -{% if perms.peoplefinder.view_auditlog %} -
- - - Internal user details - - -
-
-
-
Staff SSO user ID
-
{{ profile.user.username }}
-
-
-
Legacy staff SSO user ID
-
{{ profile.user.legacy_sso_user_id }}
-
-
-
Internal user ID
-
{{ profile.user_id }}
-
-
-
Groups
-
- {% include 'peoplefinder/components/bullet-list.html' with list=profile.user.groups.all %} -
-
-
-
User permissions
-
- {% include 'peoplefinder/components/bullet-list.html' with list=profile.user.user_permissions.all %} -
-
-
-
Is staff
-
{{ profile.user.is_staff }}
-
-
-
Is superuser
-
{{ profile.user.is_superuser }}
-
-
-
Profile created at
-
{{ profile.created_at }}
-
-
-
Profile updated at
-
{{ profile.updated_at }}
-
-
-
Profile edited or confirmed at
-
{{ profile.edited_or_confirmed_at }}
-
-
-
-
-{% endif %} - -{% if request.user == profile.user or perms.peoplefinder.view_auditlog %} -
- - - Audit log - - -
- {% include 'peoplefinder/components/audit-log.html' with audit_log=profile_audit_log.reverse excluded_keys=profile_audit_log_excluded_keys %} -
-
-{% endif %} {% endblock %} diff --git a/peoplefinder/templates/peoplefinder/search.html b/peoplefinder/templates/peoplefinder/search.html index 5f9b0d3c0..919b9affd 100644 --- a/peoplefinder/templates/peoplefinder/search.html +++ b/peoplefinder/templates/peoplefinder/search.html @@ -1,6 +1,10 @@ {% extends 'peoplefinder/page.html' %} -{% block title %}Search results for '{{ form.cleaned_data.query }}'{% endblock title %} -{% block location %}Search results{% endblock location %} +{% block title %} + Search results for '{{ form.cleaned_data.query }}' +{% endblock title %} +{% block location %} + Search results +{% endblock location %} {% block content %} {% if total_matches %}

{{ total_matches }} search results for '{{ query }}'

@@ -14,17 +18,13 @@

No search results for '{{ query }}'

- - Filter by: - + Filter by:
{% for checkbox in form.filters %}
{{ checkbox.tag }} + for="{{ checkbox.id_for_label }}">{{ checkbox.choice_label }}
{% endfor %}
diff --git a/peoplefinder/templates/peoplefinder/team-add-new-subteam.html b/peoplefinder/templates/peoplefinder/team-add-new-subteam.html index dfa0375ba..54f3bcdae 100644 --- a/peoplefinder/templates/peoplefinder/team-add-new-subteam.html +++ b/peoplefinder/templates/peoplefinder/team-add-new-subteam.html @@ -5,22 +5,23 @@ {% block location %}Add new sub-team{% endblock %} {% block content %} -
-
- {{ parent_team.short_name }} -

Add new sub-team

-
+
+
+ {{ parent_team.short_name }} +

Add new sub-team

+
+
-
- - {% csrf_token %} + + {% csrf_token %} - {% include 'peoplefinder/components/team-form.html' %} + {% include 'peoplefinder/components/team-form.html' %} -
- - Cancel -
- -{% endblock %} \ No newline at end of file +
+ + Cancel +
+ +{% endblock %} diff --git a/peoplefinder/templates/peoplefinder/team-confirm-delete.html b/peoplefinder/templates/peoplefinder/team-confirm-delete.html index 96eef363c..4d9031854 100644 --- a/peoplefinder/templates/peoplefinder/team-confirm-delete.html +++ b/peoplefinder/templates/peoplefinder/team-confirm-delete.html @@ -5,20 +5,23 @@ {% block location %}{{ team.name }}{% endblock %} {% block content %} -

{{ team.name }}

+

+ {{ team.name }} +

-
- {% csrf_token %} + + {% csrf_token %} - {% if can_team_be_deleted %} -

Are you sure you want to delete the team {{ team }}?

- {% else %} - {% include 'peoplefinder/components/bullet-list.html' with introduction='This team cannot be deleted because it has' list=reasons_team_cannot_be_deleted %} - {% endif %} + {% if can_team_be_deleted %} +

Are you sure you want to delete the team {{ team }}?

+ {% else %} + {% include 'peoplefinder/components/bullet-list.html' with introduction='This team cannot be deleted because it has' list=reasons_team_cannot_be_deleted %} + {% endif %} - {% if can_team_be_deleted %} - - {% endif %} - Cancel -
+ {% if can_team_be_deleted %} + + {% endif %} + Cancel + {% endblock %} diff --git a/peoplefinder/templates/peoplefinder/team-edit.html b/peoplefinder/templates/peoplefinder/team-edit.html index eb3dd0533..843e14e2b 100644 --- a/peoplefinder/templates/peoplefinder/team-edit.html +++ b/peoplefinder/templates/peoplefinder/team-edit.html @@ -1,8 +1,8 @@ {% extends 'peoplefinder/page.html' %} {% block libraries %} -{{ block.super }} - + {{ block.super }} + {% endblock %} {% block title %}Edit {{ team.name }}{% endblock %} @@ -10,26 +10,25 @@ {% block location %}{{ team.name }}{% endblock %} {% block content %} -
-
- {% if team.abbreviation %} - {{ team.abbreviation }} - {% endif %} -

Edit {{ team.name }}

-
+
+
+ {% if team.abbreviation %}{{ team.abbreviation }}{% endif %} +

Edit {{ team.name }}

+
+
-
-
- {% csrf_token %} + + {% csrf_token %} - {% include 'peoplefinder/components/team-form.html' %} + {% include 'peoplefinder/components/team-form.html' %} - {% include 'peoplefinder/components/team-leaders-ordering.html' %} + {% include 'peoplefinder/components/team-leaders-ordering.html' %} -
- - Cancel -
-
-{% endblock %} \ No newline at end of file +
+ + Cancel +
+ +{% endblock %} diff --git a/peoplefinder/templates/peoplefinder/team-people.html b/peoplefinder/templates/peoplefinder/team-people.html index 62575845e..2786415ae 100644 --- a/peoplefinder/templates/peoplefinder/team-people.html +++ b/peoplefinder/templates/peoplefinder/team-people.html @@ -5,20 +5,20 @@ {% block location %}{{ team.name }}{% endblock %} {% block content %} -{{ team.short_name }} -

{{ heading }}

+ {{ team.short_name }} +

+ {{ heading }} +

-
+
-{% include 'peoplefinder/components/pagination.html' with page=team_members page_numbers=page_numbers page_obj_name='people' %} + {% include 'peoplefinder/components/pagination.html' with page=team_members page_numbers=page_numbers page_obj_name='people' %} -
    - {% for member in team_members %} -
  • - {% include 'peoplefinder/components/team-member-card.html' with member=member %} -
  • - {% endfor %} -
+
    + {% for member in team_members %} +
  • {% include 'peoplefinder/components/team-member-card.html' with member=member %}
  • + {% endfor %} +
-{% include 'peoplefinder/components/pagination.html' with page=team_members page_numbers=page_numbers page_obj_name='people' %} -{% endblock %} \ No newline at end of file + {% include 'peoplefinder/components/pagination.html' with page=team_members page_numbers=page_numbers page_obj_name='people' %} +{% endblock %} diff --git a/peoplefinder/templates/peoplefinder/team-tree.html b/peoplefinder/templates/peoplefinder/team-tree.html index ac5629db0..83c38f596 100644 --- a/peoplefinder/templates/peoplefinder/team-tree.html +++ b/peoplefinder/templates/peoplefinder/team-tree.html @@ -7,8 +7,8 @@ {% block location %}{{ team.name }}{% endblock %} {% block content %} -{{ team.short_name }} -

All sub-teams

+ {{ team.short_name }} +

All sub-teams

-{% sub_teams_tree team %} -{% endblock %} \ No newline at end of file + {% sub_teams_tree team %} +{% endblock %} diff --git a/peoplefinder/templates/peoplefinder/team.html b/peoplefinder/templates/peoplefinder/team.html index 4eb6a7d6a..8a13194c3 100644 --- a/peoplefinder/templates/peoplefinder/team.html +++ b/peoplefinder/templates/peoplefinder/team.html @@ -7,93 +7,92 @@ {% block location %}{{ team.name }}{% endblock %} {% block content %} -
-
- {% if team.abbreviation %} - {{ team.abbreviation }} - {% endif %} -

{{ team.name }}

-
-
-
- -
-
-

Team leader{{ team.leaders|length|pluralize }}

-
- {% for member in team.leaders %} - {% include 'peoplefinder/components/team-member-card.html' with member=member %} - {% endfor %} +
+
+ {% if team.abbreviation %} + {{ team.abbreviation }} + {% endif %} +

{{ team.name }}

+
-
-

About the team

-
- {{ team.description|markdown }} + +
+
+

Team leader{{ team.leaders|length|pluralize }}

+
+ {% for member in team.leaders %} + {% include 'peoplefinder/components/team-member-card.html' with member=member %} + {% endfor %} +
-
- {% if perms.peoplefinder.change_team %} - Edit team - {% endif %} - {% if perms.peoplefinder.add_team %} - Add new sub-team +
+

About the team

+
{{ team.description|markdown }}
+
+ {% if perms.peoplefinder.change_team %} + Edit team + {% endif %} + {% if perms.peoplefinder.add_team %} + Add new sub-team + {% endif %} +
+ {% if perms.peoplefinder.delete_team %} + {% if can_team_be_deleted %} + Delete team + {% else %} + {% include 'peoplefinder/components/bullet-list.html' with introduction='This team cannot be deleted because it has' list=reasons_team_cannot_be_deleted %} + {% endif %} {% endif %}
- {% if perms.peoplefinder.delete_team %} - {% if can_team_be_deleted %} - Delete team - {% else %} - {% include 'peoplefinder/components/bullet-list.html' with introduction='This team cannot be deleted because it has' list=reasons_team_cannot_be_deleted %} - {% endif %} - {% endif %}
-
-
+
-
-
- {% if sub_teams %} -
-
-

Teams within {{ team.short_name }}

+
+ -
    - {% for team in sub_teams %} -
  • - {% include 'peoplefinder/components/team-card.html' with team=team %} -
  • - {% endfor %} -
- {% else %} -

People in {{ team.short_name }}

-
    - {% for member in members %} -
  • - {% include 'peoplefinder/components/team-member-card.html' with member=member %} -
  • - {% endfor %} -
- {% endif %} +
    + {% for team in sub_teams %} +
  • {% include 'peoplefinder/components/team-card.html' with team=team %}
  • + {% endfor %} +
+ {% else %} +

People in {{ team.short_name }}

+
    + {% for member in members %} +
  • {% include 'peoplefinder/components/team-member-card.html' with member=member %}
  • + {% endfor %} +
+ {% endif %} +
-
-{% if perms.peoplefinder.change_team and perms.peoplefinder.view_auditlog %} -
- - - Audit log - - -
- {% include 'peoplefinder/components/audit-log.html' with audit_log=team_audit_log.reverse %} -
-
-{% endif %} + {% if perms.peoplefinder.change_team and perms.peoplefinder.view_auditlog %} +
+ + Audit log + +
+ {% include 'peoplefinder/components/audit-log.html' with audit_log=team_audit_log.reverse %} +
+
+ {% endif %} {% endblock %} diff --git a/poetry.lock b/poetry.lock index ea5844391..fc05070a4 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry and should not be changed by hand. +# This file is automatically @generated by Poetry 1.4.2 and should not be changed by hand. [[package]] name = "amqp" @@ -105,30 +105,6 @@ docs = ["furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphinxcontrib- tests = ["attrs[tests-no-zope]", "zope-interface"] tests-no-zope = ["cloudpickle", "hypothesis", "mypy (>=1.1.1)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-xdist[psutil]"] -[[package]] -name = "bandit" -version = "1.7.5" -description = "Security oriented static analyser for python code." -category = "dev" -optional = false -python-versions = ">=3.7" -files = [ - {file = "bandit-1.7.5-py3-none-any.whl", hash = "sha256:75665181dc1e0096369112541a056c59d1c5f66f9bb74a8d686c3c362b83f549"}, - {file = "bandit-1.7.5.tar.gz", hash = "sha256:bdfc739baa03b880c2d15d0431b31c658ffc348e907fe197e54e0389dd59e11e"}, -] - -[package.dependencies] -colorama = {version = ">=0.3.9", markers = "platform_system == \"Windows\""} -GitPython = ">=1.0.1" -PyYAML = ">=5.3.1" -rich = "*" -stevedore = ">=1.20.0" - -[package.extras] -test = ["beautifulsoup4 (>=4.8.0)", "coverage (>=4.5.4)", "fixtures (>=3.0.0)", "flake8 (>=4.0.0)", "pylint (==1.9.4)", "stestr (>=2.5.0)", "testscenarios (>=0.5.0)", "testtools (>=2.3.0)", "tomli (>=1.1.0)"] -toml = ["tomli (>=1.1.0)"] -yaml = ["PyYAML"] - [[package]] name = "beautifulsoup4" version = "4.11.2" @@ -1582,88 +1558,6 @@ files = [ docs = ["furo (>=2023.3.27)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"] testing = ["covdefaults (>=2.3)", "coverage (>=7.2.3)", "diff-cover (>=7.5)", "pytest (>=7.3.1)", "pytest-cov (>=4)", "pytest-mock (>=3.10)", "pytest-timeout (>=2.1)"] -[[package]] -name = "flake8" -version = "6.0.0" -description = "the modular source code checker: pep8 pyflakes and co" -category = "dev" -optional = false -python-versions = ">=3.8.1" -files = [ - {file = "flake8-6.0.0-py2.py3-none-any.whl", hash = "sha256:3833794e27ff64ea4e9cf5d410082a8b97ff1a06c16aa3d2027339cd0f1195c7"}, - {file = "flake8-6.0.0.tar.gz", hash = "sha256:c61007e76655af75e6785a931f452915b371dc48f56efd765247c8fe68f2b181"}, -] - -[package.dependencies] -mccabe = ">=0.7.0,<0.8.0" -pycodestyle = ">=2.10.0,<2.11.0" -pyflakes = ">=3.0.0,<3.1.0" - -[[package]] -name = "flake8-bandit" -version = "4.1.1" -description = "Automated security testing with bandit and flake8." -category = "dev" -optional = false -python-versions = ">=3.6" -files = [ - {file = "flake8_bandit-4.1.1-py3-none-any.whl", hash = "sha256:4c8a53eb48f23d4ef1e59293657181a3c989d0077c9952717e98a0eace43e06d"}, - {file = "flake8_bandit-4.1.1.tar.gz", hash = "sha256:068e09287189cbfd7f986e92605adea2067630b75380c6b5733dab7d87f9a84e"}, -] - -[package.dependencies] -bandit = ">=1.7.3" -flake8 = ">=5.0.0" - -[[package]] -name = "flake8-bugbear" -version = "23.3.23" -description = "A plugin for flake8 finding likely bugs and design problems in your program. Contains warnings that don't belong in pyflakes and pycodestyle." -category = "dev" -optional = false -python-versions = ">=3.8.1" -files = [ - {file = "flake8-bugbear-23.3.23.tar.gz", hash = "sha256:ea565bdb87b96b56dc499edd6cc3ba7f695373d902a5f56c989b74fad7c7719d"}, - {file = "flake8_bugbear-23.3.23-py3-none-any.whl", hash = "sha256:8a218d13abd6904800970381057ce8e72cde8eea743240c4ef3ede4dd0bc9cfb"}, -] - -[package.dependencies] -attrs = ">=19.2.0" -flake8 = ">=6.0.0" - -[package.extras] -dev = ["coverage", "hypothesis", "hypothesmith (>=0.2)", "pre-commit", "pytest", "tox"] - -[[package]] -name = "gitdb" -version = "4.0.10" -description = "Git Object Database" -category = "dev" -optional = false -python-versions = ">=3.7" -files = [ - {file = "gitdb-4.0.10-py3-none-any.whl", hash = "sha256:c286cf298426064079ed96a9e4a9d39e7f3e9bf15ba60701e95f5492f28415c7"}, - {file = "gitdb-4.0.10.tar.gz", hash = "sha256:6eb990b69df4e15bad899ea868dc46572c3f75339735663b81de79b06f17eb9a"}, -] - -[package.dependencies] -smmap = ">=3.0.1,<6" - -[[package]] -name = "gitpython" -version = "3.1.31" -description = "GitPython is a Python library used to interact with Git repositories" -category = "dev" -optional = false -python-versions = ">=3.7" -files = [ - {file = "GitPython-3.1.31-py3-none-any.whl", hash = "sha256:f04893614f6aa713a60cbbe1e6a97403ef633103cdd0ef5eb6efe0deb98dbe8d"}, - {file = "GitPython-3.1.31.tar.gz", hash = "sha256:8ce3bcf69adfdf7c7d503e78fd3b1c492af782d58893b650adb2ac8912ddd573"}, -] - -[package.dependencies] -gitdb = ">=4.0.1,<5" - [[package]] name = "greenlet" version = "2.0.1" @@ -1840,24 +1734,6 @@ files = [ {file = "installer-0.7.0.tar.gz", hash = "sha256:a26d3e3116289bb08216e0d0f7d925fcef0b0194eedfa0c944bcaaa106c4b631"}, ] -[[package]] -name = "isort" -version = "5.12.0" -description = "A Python utility / library to sort Python imports." -category = "dev" -optional = false -python-versions = ">=3.8.0" -files = [ - {file = "isort-5.12.0-py3-none-any.whl", hash = "sha256:f84c2818376e66cf843d497486ea8fed8700b340f308f076c6fb1229dff318b6"}, - {file = "isort-5.12.0.tar.gz", hash = "sha256:8bef7dde241278824a6d83f44a544709b065191b95b6e50894bdc722fcba0504"}, -] - -[package.extras] -colors = ["colorama (>=0.4.3)"] -pipfile-deprecated-finder = ["pip-shims (>=0.5.2)", "pipreqs", "requirementslib"] -plugins = ["setuptools"] -requirements-deprecated-finder = ["pip-api", "pipreqs"] - [[package]] name = "jaraco-classes" version = "3.2.3" @@ -2069,31 +1945,6 @@ files = [ [package.extras] testing = ["coverage", "pyyaml"] -[[package]] -name = "markdown-it-py" -version = "2.2.0" -description = "Python port of markdown-it. Markdown parsing, done right!" -category = "dev" -optional = false -python-versions = ">=3.7" -files = [ - {file = "markdown-it-py-2.2.0.tar.gz", hash = "sha256:7c9a5e412688bc771c67432cbfebcdd686c93ce6484913dccf06cb5a0bea35a1"}, - {file = "markdown_it_py-2.2.0-py3-none-any.whl", hash = "sha256:5a35f8d1870171d9acc47b99612dc146129b631baf04970128b568f190d0cc30"}, -] - -[package.dependencies] -mdurl = ">=0.1,<1.0" - -[package.extras] -benchmarking = ["psutil", "pytest", "pytest-benchmark"] -code-style = ["pre-commit (>=3.0,<4.0)"] -compare = ["commonmark (>=0.9,<1.0)", "markdown (>=3.4,<4.0)", "mistletoe (>=1.0,<2.0)", "mistune (>=2.0,<3.0)", "panflute (>=2.3,<3.0)"] -linkify = ["linkify-it-py (>=1,<3)"] -plugins = ["mdit-py-plugins"] -profiling = ["gprof2dot"] -rtd = ["attrs", "myst-parser", "pyyaml", "sphinx", "sphinx-copybutton", "sphinx-design", "sphinx_book_theme"] -testing = ["coverage", "pytest", "pytest-cov", "pytest-regressions"] - [[package]] name = "markupsafe" version = "2.1.2" @@ -2175,30 +2026,6 @@ docs = ["alabaster (==0.7.12)", "autodocsumm (==0.2.9)", "sphinx (==5.3.0)", "sp lint = ["flake8 (==5.0.4)", "flake8-bugbear (==22.10.25)", "mypy (==0.990)", "pre-commit (>=2.4,<3.0)"] tests = ["pytest", "pytz", "simplejson"] -[[package]] -name = "mccabe" -version = "0.7.0" -description = "McCabe checker, plugin for flake8" -category = "dev" -optional = false -python-versions = ">=3.6" -files = [ - {file = "mccabe-0.7.0-py2.py3-none-any.whl", hash = "sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e"}, - {file = "mccabe-0.7.0.tar.gz", hash = "sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325"}, -] - -[[package]] -name = "mdurl" -version = "0.1.2" -description = "Markdown URL utilities" -category = "dev" -optional = false -python-versions = ">=3.7" -files = [ - {file = "mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8"}, - {file = "mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"}, -] - [[package]] name = "mohawk" version = "1.1.0" @@ -2383,18 +2210,6 @@ files = [ {file = "pathspec-0.11.1.tar.gz", hash = "sha256:2798de800fa92780e33acca925945e9a19a133b715067cf165b8866c15a31687"}, ] -[[package]] -name = "pbr" -version = "5.11.1" -description = "Python Build Reasonableness" -category = "dev" -optional = false -python-versions = ">=2.6" -files = [ - {file = "pbr-5.11.1-py2.py3-none-any.whl", hash = "sha256:567f09558bae2b3ab53cb3c1e2e33e726ff3338e7bae3db5dc954b3a44eef12b"}, - {file = "pbr-5.11.1.tar.gz", hash = "sha256:aefc51675b0b533d56bb5fd1c8c6c0522fe31896679882e1c4c63d5e4a0fccb3"}, -] - [[package]] name = "pexpect" version = "4.8.0" @@ -2676,18 +2491,6 @@ files = [ {file = "ptyprocess-0.7.0.tar.gz", hash = "sha256:5c5d0a3b48ceee0b48485e0c26037c0acd7d29765ca3fbb5cb3831d347423220"}, ] -[[package]] -name = "pycodestyle" -version = "2.10.0" -description = "Python style guide checker" -category = "dev" -optional = false -python-versions = ">=3.6" -files = [ - {file = "pycodestyle-2.10.0-py2.py3-none-any.whl", hash = "sha256:8a4eaf0d0495c7395bdab3589ac2db602797d76207242c17d470186815706610"}, - {file = "pycodestyle-2.10.0.tar.gz", hash = "sha256:347187bdb476329d98f695c213d7295a846d1152ff4fe9bacb8a9590b8ee7053"}, -] - [[package]] name = "pycparser" version = "2.21" @@ -2700,24 +2503,6 @@ files = [ {file = "pycparser-2.21.tar.gz", hash = "sha256:e644fdec12f7872f86c58ff790da456218b10f863970249516d60a5eaca77206"}, ] -[[package]] -name = "pydocstyle" -version = "6.3.0" -description = "Python docstring style checker" -category = "dev" -optional = false -python-versions = ">=3.6" -files = [ - {file = "pydocstyle-6.3.0-py3-none-any.whl", hash = "sha256:118762d452a49d6b05e194ef344a55822987a462831ade91ec5c06fd2169d019"}, - {file = "pydocstyle-6.3.0.tar.gz", hash = "sha256:7ce43f0c0ac87b07494eb9c0b462c0b73e6ff276807f204d6b53edc72b7e44e1"}, -] - -[package.dependencies] -snowballstemmer = ">=2.2.0" - -[package.extras] -toml = ["tomli (>=1.2.3)"] - [[package]] name = "pyee" version = "9.0.4" @@ -2733,18 +2518,6 @@ files = [ [package.dependencies] typing-extensions = "*" -[[package]] -name = "pyflakes" -version = "3.0.1" -description = "passive checker of Python programs" -category = "dev" -optional = false -python-versions = ">=3.6" -files = [ - {file = "pyflakes-3.0.1-py2.py3-none-any.whl", hash = "sha256:ec55bf7fe21fff7f1ad2f7da62363d749e2a470500eab1b555334b67aa1ef8cf"}, - {file = "pyflakes-3.0.1.tar.gz", hash = "sha256:ec8b276a6b60bd80defed25add7e439881c19e64850afd9b346283d4165fd0fd"}, -] - [[package]] name = "pygments" version = "2.15.1" @@ -3290,24 +3063,32 @@ files = [ requests = ">=2.0.1,<3.0.0" [[package]] -name = "rich" -version = "13.3.4" -description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" -category = "dev" +name = "ruff" +version = "0.0.262" +description = "An extremely fast Python linter, written in Rust." +category = "main" optional = false -python-versions = ">=3.7.0" +python-versions = ">=3.7" files = [ - {file = "rich-13.3.4-py3-none-any.whl", hash = "sha256:22b74cae0278fd5086ff44144d3813be1cedc9115bdfabbfefd86400cb88b20a"}, - {file = "rich-13.3.4.tar.gz", hash = "sha256:b5d573e13605423ec80bdd0cd5f8541f7844a0e71a13f74cf454ccb2f490708b"}, + {file = "ruff-0.0.262-py3-none-macosx_10_7_x86_64.whl", hash = "sha256:c26c1abd420d041592d05d63aee8c6a18feb24aed4deb6e91129e9f2c7b4914a"}, + {file = "ruff-0.0.262-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:b379e9765afa679316e52288a942df085e590862f8945088936a7bce3116d8f3"}, + {file = "ruff-0.0.262-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9b7e0ca6821aafbd2b059df3119fcd5881250721ca8e825789fd2c471f7c59be"}, + {file = "ruff-0.0.262-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:4cca35e2aeddff72bb4379a1dabc134e0c0d25ebc754a2cb733a1f8d4dbbb5e0"}, + {file = "ruff-0.0.262-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:15bf5533ce169aebbafa00017987f673e879f60a625d932b464b8cdaf32a4fce"}, + {file = "ruff-0.0.262-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:3909e249d984c4517194005a1c30eaa0c3a6d906c789d9fc0c9c7e007fb3e759"}, + {file = "ruff-0.0.262-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:4e2813013a19b3e147e840bdb2e42db5825b53b47364e58e7b467c5fa47ffda2"}, + {file = "ruff-0.0.262-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d25a94996b2037e566c2a801c8b324c0a826194d5d4d90ad7c1ccb8cf06521fa"}, + {file = "ruff-0.0.262-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:85ca04348372efc59f6ee808d903d35e0d352cf2c78e487757cd48b65104b83e"}, + {file = "ruff-0.0.262-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:24f989363e9bb5d0283490298102a5218682e49ebf300e445d69e24bee03ac83"}, + {file = "ruff-0.0.262-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:3c24e678e43ca4b67e29cc9a7a54eea05f31a5898cbf17bfec47b68f08d32a60"}, + {file = "ruff-0.0.262-py3-none-musllinux_1_2_i686.whl", hash = "sha256:0baff3c9a22227358ea109c165efe62dbdd0f2b9fd5256567dda8682b444fe23"}, + {file = "ruff-0.0.262-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:083bac6e238d8b7d5ac3618666ea63b7ac661cf94c5da160070a58e190082831"}, + {file = "ruff-0.0.262-py3-none-win32.whl", hash = "sha256:15bbfa2d15c137717627e0d56b0e535ae297b734551e34e03fcc25d7642cf43a"}, + {file = "ruff-0.0.262-py3-none-win_amd64.whl", hash = "sha256:973ac29193f718349cf5746b7d86dfeaf7d40e9651ed97790a9b9327305888b9"}, + {file = "ruff-0.0.262-py3-none-win_arm64.whl", hash = "sha256:f102904ebe395acd2a181d295b98120acd7a63f732b691672977fc688674f4af"}, + {file = "ruff-0.0.262.tar.gz", hash = "sha256:faea54231c265f5349975ba6f3d855b71881a01f391b2000c47740390c6d5f68"}, ] -[package.dependencies] -markdown-it-py = ">=2.2.0,<3.0.0" -pygments = ">=2.13.0,<3.0.0" - -[package.extras] -jupyter = ["ipywidgets (>=7.5.1,<9)"] - [[package]] name = "s3transfer" version = "0.6.0" @@ -3408,30 +3189,6 @@ files = [ {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, ] -[[package]] -name = "smmap" -version = "5.0.0" -description = "A pure Python implementation of a sliding window memory map manager" -category = "dev" -optional = false -python-versions = ">=3.6" -files = [ - {file = "smmap-5.0.0-py3-none-any.whl", hash = "sha256:2aba19d6a040e78d8b09de5c57e96207b09ed71d8e55ce0959eeee6c8e190d94"}, - {file = "smmap-5.0.0.tar.gz", hash = "sha256:c840e62059cd3be204b0c9c9f74be2c09d5648eddd4580d9314c3ecde0b30936"}, -] - -[[package]] -name = "snowballstemmer" -version = "2.2.0" -description = "This package provides 29 stemmers for 28 languages generated from Snowball algorithms." -category = "dev" -optional = false -python-versions = "*" -files = [ - {file = "snowballstemmer-2.2.0-py2.py3-none-any.whl", hash = "sha256:c8e1716e83cc398ae16824e5572ae04e0d9fc2c6b985fb0f900f5f0c96ecba1a"}, - {file = "snowballstemmer-2.2.0.tar.gz", hash = "sha256:09b16deb8547d3412ad7b590689584cd0fe25ec8db3be37788be3810cbf19cb1"}, -] - [[package]] name = "soupsieve" version = "2.4.1" @@ -3461,21 +3218,6 @@ dev = ["build", "flake8"] doc = ["sphinx"] test = ["pytest", "pytest-cov"] -[[package]] -name = "stevedore" -version = "5.0.0" -description = "Manage dynamic plugins for Python applications" -category = "dev" -optional = false -python-versions = ">=3.8" -files = [ - {file = "stevedore-5.0.0-py3-none-any.whl", hash = "sha256:bd5a71ff5e5e5f5ea983880e4a1dd1bb47f8feebbb3d95b592398e2f02194771"}, - {file = "stevedore-5.0.0.tar.gz", hash = "sha256:2c428d2338976279e8eb2196f7a94910960d9f7ba2f41f3988511e95ca447021"}, -] - -[package.dependencies] -pbr = ">=2.0.0,<2.1.0 || >2.1.0" - [[package]] name = "telepath" version = "0.3" @@ -4050,4 +3792,4 @@ testing = ["big-O", "flake8 (<5)", "jaraco.functools", "jaraco.itertools", "more [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "534404b4dccea3761ead9e4c8e46f20424c0997df0aa0f7f4efcf3672c52441e" +content-hash = "052636ca0e79f0701465f8581716d26fb5aee754ced186a437ae332d60024967" diff --git a/pyproject.toml b/pyproject.toml index f3942e735..6f833c470 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,17 +55,14 @@ requests = "^2.28.2" boto3 = "^1.26.115" pyjwt = {extras = ["crypto"], version = "^2.6.0"} django-taggit = "^3.1.0" +ruff = "^0.0.262" [tool.poetry.group.dev.dependencies] poetry = "^1.4.2" # Linters black = "^23.3.0" -isort = "^5.12.0" -flake8 = "^6.0.0" -flake8-bandit = "^4.1.1" -flake8-bugbear = "^23.3.23" djlint = "^1.23.2" -pydocstyle = "^6.3.0" +ruff = "^0.0.262" # Testing pytest = "^7.3.1" pytest-django = "^4.5.2" @@ -101,17 +98,29 @@ omit = [ "e2e_tests/*", ] -[tool.isort] -profile = "black" -multi_line_output = 3 -skip_gitignore = true -line_length = 88 -lines_after_imports = 2 +[tool.ruff] +extend-select = ["B", "S"] +ignore = ["B904", "E501", "N818", "S101"] +extend-exclude = [ + "manage.py", + "*/migrations/*", + "# Not actually Python", + "node_modules/", + "assets/", + "media/", + "static/", + "*/test/*", + ".venv/", + "bin/", + "hawk-api-access-test.py", + ".pythonrc.py" +] + +[tool.ruff.isort] +lines-after-imports = 2 [tool.djlint] extension="html" profile="django" -format_js=false -format_css=false ignore="T002,H006,H017,H023" preserve_blank_lines=true diff --git a/search/templates/search/partials/result/page.html b/search/templates/search/partials/result/page.html index ea74478ce..186b3aba1 100644 --- a/search/templates/search/partials/result/page.html +++ b/search/templates/search/partials/result/page.html @@ -2,15 +2,8 @@

{{ object.title }} + href="{% pageurl object %}" + onclick="gtm_data_then_click(this, { 'event': 'search_result', 'search_result_selected_url': '{% pageurl object %}', 'search_result_selected_type': '{{ type }}', 'search_result_selected_section': '{{ section }}', 'search_result_selected_number_overall': {{ number_overall }}, 'search_result_selected_number_section': {{ number_section }} })">{{ object.title }}

{{ object.preview_text }}

Updated: {{ object.last_published_at }}

diff --git a/search/templates/search/partials/search_category_all_tabs.html b/search/templates/search/partials/search_category_all_tabs.html index 72c7dbd89..189dbe4c3 100644 --- a/search/templates/search/partials/search_category_all_tabs.html +++ b/search/templates/search/partials/search_category_all_tabs.html @@ -1,10 +1,10 @@
- {% include 'search/partials/search_category_single_tab.html' with name='all' search_count_category='all_pages' %} - {% include 'search/partials/search_category_single_tab.html' with name='people' search_count_category='people' %} - {% include 'search/partials/search_category_single_tab.html' with name='teams' search_count_category='teams' %} - {% include 'search/partials/search_category_single_tab.html' with name='guidance' search_count_category='guidance' %} - {% include 'search/partials/search_category_single_tab.html' with name='tools' search_count_category='tools' %} - {% include 'search/partials/search_category_single_tab.html' with name='news' search_count_category='news' %} + {% include 'search/partials/search_category_single_tab.html' with name='all' search_count_category='all_pages' %} + {% include 'search/partials/search_category_single_tab.html' with name='people' search_count_category='people' %} + {% include 'search/partials/search_category_single_tab.html' with name='teams' search_count_category='teams' %} + {% include 'search/partials/search_category_single_tab.html' with name='guidance' search_count_category='guidance' %} + {% include 'search/partials/search_category_single_tab.html' with name='tools' search_count_category='tools' %} + {% include 'search/partials/search_category_single_tab.html' with name='news' search_count_category='news' %}
diff --git a/search/templates/search/partials/search_category_single_tab.html b/search/templates/search/partials/search_category_single_tab.html index 1a080cf52..4c5ef46f9 100644 --- a/search/templates/search/partials/search_category_single_tab.html +++ b/search/templates/search/partials/search_category_single_tab.html @@ -1,10 +1,8 @@ {% load search %} {% search_count category=search_count_category as hits %} -{{ name|title }} ({{ hits }}) +{{ name|title }} ({{ hits }})