diff options
author | 2023-05-11 22:30:42 -0700 | |
---|---|---|
committer | 2023-05-11 22:30:42 -0700 | |
commit | 3def0dd92a0c4d8bcd41f60c71888d4890e0939a (patch) | |
tree | 2172d38745d7792778c5513fe73f047c008faafb | |
parent | Add Django-specific rules for ruff (diff) | |
parent | Merge pull request #971 from python-discord/no-duplicate-tag-page-github-edit... (diff) |
Merge branch 'main' into django-rules-ruff
-rw-r--r-- | pydis_site/apps/content/tests/test_views.py | 8 | ||||
-rw-r--r-- | pydis_site/templates/content/base.html | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/pydis_site/apps/content/tests/test_views.py b/pydis_site/apps/content/tests/test_views.py index e4f898ef..cfc580c0 100644 --- a/pydis_site/apps/content/tests/test_views.py +++ b/pydis_site/apps/content/tests/test_views.py @@ -387,6 +387,14 @@ class TagViewTests(django.test.TestCase): response.context.get("page") ) + def test_tags_have_no_edit_on_github_link(self): + """Tags should not have the standard edit on GitHub link.""" + # The standard "Edit on GitHub" link should not be displayed on tags + # because they have their own GitHub icon that links there. + Tag.objects.create(name="example", body="Joe William Banks", last_commit=self.commit) + response = self.client.get("/pages/tags/example/") + self.assertNotContains(response, "Edit on GitHub") + def test_tag_root_page(self): """Test the root tag page which lists all tags.""" Tag.objects.create(name="tag-1", last_commit=self.commit) diff --git a/pydis_site/templates/content/base.html b/pydis_site/templates/content/base.html index b04c7efa..bda6d954 100644 --- a/pydis_site/templates/content/base.html +++ b/pydis_site/templates/content/base.html @@ -37,7 +37,7 @@ {% include "content/dropdown.html" %} {% endif %} {# Edit on GitHub for content articles #} - {% if page %} + {% if page and not tag %} <div id="edit-on-github"> <a href="{{ request.path | page_src_url }}"> <i class="fa-solid fa-pencil"></i> |