mirror of
https://github.com/umap-project/umap.git
synced 2025-04-28 11:32:38 +02:00
Compare commits
11 commits
d5571457cd
...
67238a837c
Author | SHA1 | Date | |
---|---|---|---|
![]() |
67238a837c | ||
![]() |
e3c6dcf3fa | ||
![]() |
6de878551b | ||
![]() |
05493d8a48 | ||
![]() |
fd8f403a69 | ||
![]() |
a6412c9539 | ||
![]() |
fe65a5351b | ||
![]() |
2ede25f541 | ||
![]() |
b7acdcfd93 | ||
![]() |
a3d2330661 | ||
![]() |
20ae374173 |
7 changed files with 69 additions and 10 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 %}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue