Skip to content

Commit 351ca10

Browse files
committed
Merge remote-tracking branch 'torchbox/main' into jinja
2 parents f6896c5 + 052b2ad commit 351ca10

File tree

19 files changed

+1019
-95
lines changed

19 files changed

+1019
-95
lines changed

.github/workflows/ci.yml

Lines changed: 32 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v3
12-
- uses: actions/setup-python@v3
12+
- run: pipx install "poetry>=1.1.12,<2"
13+
- uses: actions/setup-python@v4
1314
with:
14-
python-version: "3.10"
15-
- uses: Gr1n/setup-poetry@v7
16-
with:
17-
poetry-version: '1.1.12'
15+
python-version-file: pyproject.toml
16+
cache: 'poetry'
1817
- run: pip install tox
19-
- run: tox -e lint,py310-dj40
18+
- run: tox -e lint,py311-dj42
2019
test_compatibility:
2120
needs: test
2221
runs-on: ubuntu-latest
@@ -26,27 +25,26 @@ jobs:
2625
# Test with all supported Django versions, for all compatible Python versions.
2726
# See https://docs.djangoproject.com/en/4.0/faq/install/#what-python-version-can-i-use-with-django for the official matrix.
2827
# Additionally test on Django’s main branch with the most recent Python version.
29-
- python: "3.7"
30-
toxenv: py37-dj32
3128
- python: "3.8"
32-
toxenv: py38-dj32,py38-dj40,py38-dj41
29+
toxenv: py38-dj32,py38-dj41,py38-dj42
3330
- python: "3.9"
34-
toxenv: py39-dj32,py39-dj40,py39-dj41
31+
toxenv: py39-dj32,py39-dj41,py39-dj42
3532
- python: "3.10"
3633
# Skip testing Django 4.0, already tested in previous workflow job.
37-
toxenv: py310-dj32,py310-dj41,py310-djmain
38-
# Tentative support for next Python pre-release. For the correct specifier,
39-
# Check: https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json.
40-
- python: "3.11.0-beta.2"
41-
toxenv: py311-dj41
34+
toxenv: py310-dj32,py310-dj41,py310-dj42,py310-djmain
35+
- python: "3.11"
36+
toxenv: py311-dj41,py311-dj42,py311-djmain
37+
# Tentative support for next Python pre-release.
38+
# When django supports the version, uncomment this
39+
# - python: "3.12"
40+
# toxenv: py312-dj41
4241
steps:
4342
- uses: actions/checkout@v3
44-
- uses: actions/setup-python@v3
43+
- run: pipx install "poetry>=1.1.12,<2"
44+
- uses: actions/setup-python@v4
4545
with:
4646
python-version: ${{ matrix.python }}
47-
- uses: Gr1n/setup-poetry@v7
48-
with:
49-
poetry-version: '1.1.12'
47+
allow-prereleases: true
5048
- run: pip install tox
5149
- run: tox -q
5250
env:
@@ -62,24 +60,17 @@ jobs:
6260
- id: node-cache
6361
uses: actions/cache@v2
6462
with:
63+
# Cache node_modules rather than the npm cache, as we rarely update npm packages.
6564
path: node_modules
6665
key: ${{ runner.os }}-node-${{ hashFiles('**/.nvmrc') }}-${{ hashFiles('**/package-lock.json') }}
6766
- if: steps.node-cache.outputs.cache-hit != 'true'
6867
run: npm ci --no-audit
6968
- run: npm run build
70-
- uses: actions/setup-python@v3
71-
with:
72-
python-version: "3.10"
73-
- uses: Gr1n/setup-poetry@v7
74-
with:
75-
poetry-version: '1.1.12'
76-
- uses: actions/cache@v3
69+
- run: pipx install "poetry>=1.1.12,<2"
70+
- uses: actions/setup-python@v4
7771
with:
78-
path: ~/.cache/pip
79-
key: ${{ runner.os }}-python-py310-${{ hashFiles('**/pyproject.toml') }}
80-
restore-keys: |
81-
${{ runner.os }}-python-py310-
82-
- run: poetry config virtualenvs.create false
72+
python-version-file: pyproject.toml
73+
cache: 'poetry'
8374
- run: poetry install
8475
- run: poetry run django-admin runserver --settings=tests.settings.production --pythonpath=. &
8576
# Docs website build.
@@ -95,20 +86,19 @@ jobs:
9586
- run: cat pyproject.toml | awk '{sub(/^version = .+/,"version = \"0.0.0.dev\"")}1' > pyproject.toml.tmp && mv pyproject.toml.tmp pyproject.toml
9687
- run: poetry build
9788
- run: mv dist site
98-
- uses: actions/upload-artifact@v3
89+
- uses: actions/configure-pages@v3
90+
- uses: actions/upload-pages-artifact@v2
9991
with:
100-
name: site
10192
path: site
102-
retention-days: 1
10393
deploy_site:
104-
runs-on: ubuntu-latest
10594
needs: build_site
95+
runs-on: ubuntu-latest
96+
permissions:
97+
pages: write
98+
id-token: write
99+
environment:
100+
name: github-pages
101+
url: ${{ steps.deployment.outputs.page_url }}
106102
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
107103
steps:
108-
- uses: actions/checkout@v3
109-
- uses: actions/download-artifact@v3
110-
- uses: JamesIves/[email protected]
111-
with:
112-
branch: gh-pages
113-
folder: site
114-
clean: true
104+
- uses: actions/deploy-pages@v2

.github/workflows/codeql-analysis.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,19 @@ name: "CodeQL"
33
on:
44
push:
55
branches: [main]
6+
paths-ignore:
7+
- '**/*.md'
8+
- '**/*.yml'
9+
- '**/*.html'
10+
- '**/*.scss'
611
pull_request:
712
# The branches below must be a subset of the branches above
813
branches: [main]
14+
paths-ignore:
15+
- '**/*.md'
16+
- '**/*.yml'
17+
- '**/*.html'
18+
- '**/*.scss'
919
schedule:
1020
- cron: "28 20 * * 5"
1121

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ var/
3434
*.egg-info/
3535
.installed.cfg
3636
*.egg
37-
poetry.lock
3837
# PyInstaller
3938
# Usually these files are written by a python script from a template
4039
# before PyInstaller builds the exe, so as to inject date/other infos into it.

CHANGELOG.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,34 @@
11
# Changelog
22

3-
## [Unreleased]
3+
## [1.1.0](https://github.com/torchbox/django-pattern-library/releases/tag/v1.1.0) - 2023-10-25
4+
5+
### Added
6+
7+
- Add support for Django 4.2 ([#231](https://github.com/torchbox/django-pattern-library/pull/231))
8+
9+
### Changed
10+
11+
- Switch to the `poetry-core` build backend ([#232](https://github.com/torchbox/django-pattern-library/pull/232))
12+
13+
### Removed
14+
15+
- Drop support for Python 3.7 ([#231](https://github.com/torchbox/django-pattern-library/pull/231))
16+
- Drop support for Django 4.0 ([#231](https://github.com/torchbox/django-pattern-library/pull/231))
17+
18+
### Fixed
19+
20+
- Ensure the project root is on `sys.path` so tests etc. can be run in by Docker Compose ([#233](https://github.com/torchbox/django-pattern-library/issues/233), [#234](https://github.com/torchbox/django-pattern-library/pull/234))
21+
- Fix URL pattern matching for template with dashes in the file name ([#229](https://github.com/torchbox/django-pattern-library/issues/229), [#230](https://github.com/torchbox/django-pattern-library/pull/230))
22+
23+
## [1.0.1](https://github.com/torchbox/django-pattern-library/releases/tag/v1.0.1) - 2023-08-19
24+
25+
### Fixed
426

527
- Disable pointer events on menu chevron to allow clicks ([#202](https://github.com/torchbox/django-pattern-library/issues/202), [#205](https://github.com/torchbox/django-pattern-library/pull/205))
28+
- Improve menu accessibility by using buttons for menu items ([#202](https://github.com/torchbox/django-pattern-library/issues/202), [#207](https://github.com/torchbox/django-pattern-library/pull/207)).
29+
- Fix pattern name URL regex to account for Windows paths with backslash ([#222](https://github.com/torchbox/django-pattern-library/issues/222), [#223](https://github.com/torchbox/django-pattern-library/pull/223))
30+
- Use the correct iframe width with resize buttons ([#226](https://github.com/torchbox/django-pattern-library/issues/226), [#225](https://github.com/torchbox/django-pattern-library/pull/225)).
31+
- Update the project’s test matrix for upcoming Django 4.2 support ([#212](https://github.com/torchbox/django-pattern-library/issues/212),[#220](https://github.com/torchbox/django-pattern-library/pull/220)).
632

733
## [1.0.0](https://github.com/torchbox/django-pattern-library/releases/tag/v1.0.0) - 2022-06-10
834

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ RUN useradd --create-home dpl && \
77
chown -R dpl:dpl /venv/ /app/
88

99
ENV PATH=/venv/bin:/home/dpl/.local/bin:$PATH \
10+
PYTHONPATH=/app/ \
1011
VIRTUAL_ENV=/venv/ \
1112
DJANGO_SETTINGS_MODULE=tests.settings.dev
1213

docs/community/related-projects.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Here are other projects that are related to django-pattern-library, and may be r
88
- [django-components](https://github.com/EmilStenstrom/django-components/) – Reusable UI components for Django, going further than template partials.
99
- [django-component-tags](https://github.com/syse-i/django-component-tags) – Create advanced HTML components using Django Tags.
1010
- [slippers](https://github.com/mixxorz/slippers) – Reusable components for Django, without writing a single line of Python.
11-
- (Jinja only, incompatible but interesting) [Template Components (tcom)](https://tcom.scaletti.dev/) – Write server-side components as single Jinja template files. Use them as HTML tags without doing any importing.
11+
- (Jinja only, incompatible but interesting) [JinjaX](https://jinjax.scaletti.dev/) – Write server-side components as single Jinja template files. Use them as HTML tags without doing any importing.
1212

1313
## Alternatives
1414

pattern_library/static/pattern_library/src/js/components/navigation.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
export function toggleNavItems() {
2-
const headings = document.querySelectorAll('.js-toggle-pattern');
3-
headings.forEach(heading => {
4-
heading.addEventListener('click', e => {
2+
const categoryButtons = document.querySelectorAll('.js-toggle-pattern');
3+
4+
categoryButtons.forEach((button) => {
5+
button.addEventListener('click', (e) => {
56
e.target.classList.toggle('is-open');
6-
for ( const element of e.target.parentNode.childNodes ) {
7-
if ( element.nodeName === "UL" ){
7+
for (const element of e.target.closest('.js-list-item').childNodes) {
8+
if (element.nodeName === 'UL') {
89
element.classList.toggle('is-open');
910
}
1011
}

pattern_library/static/pattern_library/src/scss/components/_iframe.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.iframe {
2+
box-sizing: content-box;
23
width: 100%;
34
border: 1px solid $light-grey;
45
margin: 20px 0;

pattern_library/static/pattern_library/src/scss/components/_list.scss

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,24 @@
1919
padding-left: 15px;
2020
}
2121

22-
&__item-heading {
22+
&__button {
2323
display: flex;
2424
align-items: center;
2525
margin: 10px 0;
2626
user-select: none;
27-
font-weight: 500;
2827
font-size: 19px;
28+
appearance: none;
29+
background-color: transparent;
30+
border: 0;
31+
gap: 5px;
32+
padding: 0;
2933

3034
&:hover {
3135
cursor: pointer;
3236
}
3337

34-
&--light {
35-
font-weight: 200;
36-
}
37-
38-
&--small{
38+
&--child {
39+
color: $mid-grey;
3940
font-size: 13px;
4041
}
4142
}
@@ -44,7 +45,8 @@
4445
width: 15px;
4546
height: 15px;
4647
pointer-events: none;
47-
48+
transition: transform 0.15s ease-in-out;
49+
4850
.is-open > & {
4951
transform: rotate(90deg);
5052
}

pattern_library/static/pattern_library/src/scss/layout/_sidebar.scss

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
.sidebar {
22
background-color: $off-white;
3-
padding: 20px;
43
height: 100vh;
54
margin-left: 0;
65
overflow: auto;
76
-ms-grid-column: 1;
87
-ms-grid-row: 2;
98

9+
&__inner {
10+
padding: 20px;
11+
}
12+
1013
&__search {
1114
width: 100%;
1215
padding: 10px;

0 commit comments

Comments
 (0)