mirror of
https://github.com/umap-project/umap.git
synced 2025-05-03 05:01:49 +02:00
Compare commits
No commits in common. "e3c6dcf3faaa017d746f5edf21cce175d94aa411" and "2c8022b422f5721f588d105a212bb241877ea435" have entirely different histories.
e3c6dcf3fa
...
2c8022b422
4 changed files with 4 additions and 63 deletions
|
@ -165,6 +165,7 @@ h2.tabs a:hover {
|
||||||
min-height: var(--map-fragment-height);
|
min-height: var(--map-fragment-height);
|
||||||
}
|
}
|
||||||
.tag-list {
|
.tag-list {
|
||||||
|
margin-top: var(--text-margin);
|
||||||
margin-bottom: var(--text-margin);
|
margin-bottom: var(--text-margin);
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
@ -204,7 +205,6 @@ h2.tabs a:hover {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
gap: var(--gutter);
|
gap: var(--gutter);
|
||||||
margin-top: var(--text-margin);
|
|
||||||
}
|
}
|
||||||
.card h3 {
|
.card h3 {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
|
|
|
@ -12,14 +12,14 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<h3>{% if map_inst.is_template %}<mark class="template-map">[{% trans "template" %}]</mark>{% endif %} {{ map_inst.name }}</h3>
|
<h3>{{ map_inst.name }}</h3>
|
||||||
{% with author=map_inst.get_author %}
|
{% with author=map_inst.get_author %}
|
||||||
{% if author %}
|
{% if author %}
|
||||||
<p>{% trans "by" %} <a href="{{ author.get_url }}">{{ author }}</a></p>
|
<p>{% trans "by" %} <a href="{{ author.get_url }}">{{ author }}</a></p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
</div>
|
</div>
|
||||||
<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>
|
<a class="main" href="{{ map_inst.get_absolute_url }}">{% translate "See the map" %}</a>
|
||||||
</hgroup>
|
</hgroup>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
@ -528,62 +528,3 @@ def test_can_find_small_usernames(client):
|
||||||
data = json.loads(response.content)["data"]
|
data = json.loads(response.content)["data"]
|
||||||
assert len(data) == 1
|
assert len(data) == 1
|
||||||
assert data[0]["label"] == "JoeJoe"
|
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,
|
"description": m.description,
|
||||||
"url": m.get_absolute_url(),
|
"url": m.get_absolute_url(),
|
||||||
}
|
}
|
||||||
for m in qs.order_by("-modified_at")
|
for m in qs
|
||||||
]
|
]
|
||||||
return simple_json_response(templates=templates)
|
return simple_json_response(templates=templates)
|
||||||
|
|
Loading…
Reference in a new issue