Compare commits

..

11 commits

Author SHA1 Message Date
Yohan Boniface
67238a837c
Merge e3c6dcf3fa into 05493d8a48 2025-04-22 13:48:56 +00:00
Yohan Boniface
e3c6dcf3fa chore: add test for template_list view 2025-04-22 15:48:42 +02:00
Yohan Boniface
6de878551b wip: mark template maps in maps list 2025-04-22 15:42:41 +02:00
Yohan Boniface
05493d8a48
chore: bump uvicorn from 0.34.1 to 0.34.2 (#2664)
Some checks failed
Release Charts / release (push) Has been cancelled
Test & Docs / tests (postgresql, 3.10) (push) Has been cancelled
Test & Docs / tests (postgresql, 3.12) (push) Has been cancelled
Test & Docs / lint (push) Has been cancelled
2025-04-22 15:06:34 +02:00
Yohan Boniface
fd8f403a69
chore: bump mkdocs-material from 9.6.11 to 9.6.12 (#2665) 2025-04-22 15:06:19 +02:00
Yohan Boniface
a6412c9539
chore: bump ruff from 0.11.4 to 0.11.6 (#2666) 2025-04-22 15:06:01 +02:00
Yohan Boniface
fe65a5351b
chore: bump moto[s3] from 5.1.3 to 5.1.4 (#2667) 2025-04-22 15:05:44 +02:00
dependabot[bot]
2ede25f541
chore: bump moto[s3] from 5.1.3 to 5.1.4
Bumps [moto[s3]](https://github.com/getmoto/moto) from 5.1.3 to 5.1.4.
- [Release notes](https://github.com/getmoto/moto/releases)
- [Changelog](https://github.com/getmoto/moto/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getmoto/moto/compare/5.1.3...5.1.4)

---
updated-dependencies:
- dependency-name: moto[s3]
  dependency-version: 5.1.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-21 17:46:08 +00:00
dependabot[bot]
b7acdcfd93
chore: bump ruff from 0.11.4 to 0.11.6
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.11.4 to 0.11.6.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.11.4...0.11.6)

---
updated-dependencies:
- dependency-name: ruff
  dependency-version: 0.11.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-21 17:39:19 +00:00
dependabot[bot]
a3d2330661
chore: bump mkdocs-material from 9.6.11 to 9.6.12
Bumps [mkdocs-material](https://github.com/squidfunk/mkdocs-material) from 9.6.11 to 9.6.12.
- [Release notes](https://github.com/squidfunk/mkdocs-material/releases)
- [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG)
- [Commits](https://github.com/squidfunk/mkdocs-material/compare/9.6.11...9.6.12)

---
updated-dependencies:
- dependency-name: mkdocs-material
  dependency-version: 9.6.12
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-21 17:33:21 +00:00
dependabot[bot]
20ae374173
chore: bump uvicorn from 0.34.1 to 0.34.2
Bumps [uvicorn](https://github.com/encode/uvicorn) from 0.34.1 to 0.34.2.
- [Release notes](https://github.com/encode/uvicorn/releases)
- [Changelog](https://github.com/encode/uvicorn/blob/master/docs/release-notes.md)
- [Commits](https://github.com/encode/uvicorn/compare/0.34.1...0.34.2)

---
updated-dependencies:
- dependency-name: uvicorn
  dependency-version: 0.34.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-21 17:29:12 +00:00
7 changed files with 69 additions and 10 deletions

View file

@ -1,5 +1,5 @@
# Force rtfd to use a recent version of mkdocs
mkdocs==1.6.1
pymdown-extensions==10.14.3
mkdocs-material==9.6.11
mkdocs-material==9.6.12
mkdocs-static-i18n==1.3.0

View file

@ -1,5 +1,5 @@
# Force rtfd to use a recent version of mkdocs
mkdocs==1.6.1
pymdown-extensions==10.14.3
mkdocs-material==9.6.11
mkdocs-material==9.6.12
mkdocs-static-i18n==1.3.0

View file

@ -44,10 +44,10 @@ dependencies = [
[project.optional-dependencies]
dev = [
"hatch==1.14.1",
"ruff==0.11.4",
"ruff==0.11.6",
"djlint==1.36.4",
"mkdocs==1.6.1",
"mkdocs-material==9.6.11",
"mkdocs-material==9.6.12",
"mkdocs-static-i18n==1.3.0",
"vermin==1.6.0",
"pymdown-extensions==10.14.3",
@ -62,10 +62,10 @@ test = [
"pytest-playwright==0.7.0",
"pytest-rerunfailures==15.0",
"pytest-xdist>=3.5.0,<4",
"moto[s3]==5.1.3"
"moto[s3]==5.1.4"
]
docker = [
"uvicorn==0.34.1",
"uvicorn==0.34.2",
]
s3 = [
"django-storages[s3]==1.14.6",

View file

@ -165,7 +165,6 @@ h2.tabs a:hover {
min-height: var(--map-fragment-height);
}
.tag-list {
margin-top: var(--text-margin);
margin-bottom: var(--text-margin);
display: flex;
flex-wrap: wrap;
@ -205,6 +204,7 @@ h2.tabs a:hover {
margin-bottom: 0;
flex-grow: 1;
gap: var(--gutter);
margin-top: var(--text-margin);
}
.card h3 {
margin-bottom: 0;

View file

@ -12,14 +12,14 @@
{% endfor %}
</ul>
{% endif %}
<h3>{{ map_inst.name }}</h3>
<h3>{% if map_inst.is_template %}<mark class="template-map">[{% trans "template" %}]</mark>{% endif %} {{ map_inst.name }}</h3>
{% with author=map_inst.get_author %}
{% if author %}
<p>{% trans "by" %} <a href="{{ author.get_url }}">{{ author }}</a></p>
{% endif %}
{% endwith %}
</div>
<a class="main" href="{{ map_inst.get_absolute_url }}">{% translate "See the map" %}</a>
<a class="main" href="{{ map_inst.get_absolute_url }}">{% if map_inst.is_template %}{% translate "See the template" %}{% else %}{% translate "See the map" %}{% endif %}</a>
</hgroup>
</div>
{% endfor %}

View file

@ -528,3 +528,62 @@ def test_can_find_small_usernames(client):
data = json.loads(response.content)["data"]
assert len(data) == 1
assert data[0]["label"] == "JoeJoe"
@pytest.mark.django_db
def test_templates_list(client, user, user2):
public = MapFactory(
owner=user,
name="A public template",
share_status=Map.PUBLIC,
is_template=True,
)
link_only = MapFactory(
owner=user,
name="A link-only template",
share_status=Map.OPEN,
is_template=True,
)
private = MapFactory(
owner=user,
name="A link-only template",
share_status=Map.PRIVATE,
is_template=True,
)
someone_else = MapFactory(
owner=user2,
name="A public template from someone else",
share_status=Map.PUBLIC,
is_template=True,
)
staff = UserFactory(username="Staff", is_staff=True)
Star.objects.create(by=staff, map=someone_else)
client.login(username=user.username, password="123123")
url = reverse("template_list")
# Ask for mine
response = client.get(f"{url}?source=mine")
templates = json.loads(response.content)["templates"]
ids = [t["id"] for t in templates]
assert public.pk in ids
assert link_only.pk in ids
assert private.pk in ids
assert someone_else.pk not in ids
# Ask for staff ones
response = client.get(f"{url}?source=staff")
templates = json.loads(response.content)["templates"]
ids = [t["id"] for t in templates]
assert public.pk not in ids
assert link_only.pk not in ids
assert private.pk not in ids
assert someone_else.pk in ids
# Ask for community ones
response = client.get(f"{url}?source=community")
templates = json.loads(response.content)["templates"]
ids = [t["id"] for t in templates]
assert public.pk in ids
assert link_only.pk not in ids
assert private.pk not in ids
assert someone_else.pk in ids

View file

@ -1471,6 +1471,6 @@ class TemplateList(ListView):
"description": m.description,
"url": m.get_absolute_url(),
}
for m in qs
for m in qs.order_by("-modified_at")
]
return simple_json_response(templates=templates)