Skip to content

Commit

Permalink
fix reference issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
FreemanPancake committed Oct 25, 2024
1 parent ffb5ca2 commit 4503fab
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
10 changes: 6 additions & 4 deletions djangocms_references/monkeypatch/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
from djangocms_references.compat import DJANGO_CMS_4_1


def generate_get_references_link(content_grouper):
def generate_get_references_link(content_grouper=None):
def _get_references_link(self, obj, request):
obj_grouper = getattr(obj, content_grouper)
obj_grouper = obj if not content_grouper else getattr(obj, content_grouper)
_obj_grouper_meta = obj_grouper._meta
content_type = ContentType.objects.get(
app_label=_obj_grouper_meta.app_label,
Expand Down Expand Up @@ -48,8 +48,10 @@ def inner(self, *args, **kwargs):
SnippetOriginalAdmin.SnippetAdmin.get_list_actions
)
else:
AliasOriginalAdmin.AliasAdmin._get_references_link = generate_get_references_link('alias')
AliasOriginalAdmin.AliasAdmin._get_references_link = generate_get_references_link()
AliasOriginalAdmin.AliasAdmin.get_actions_list = _get_actions_list(AliasOriginalAdmin.AliasAdmin.get_actions_list)

SnippetOriginalAdmin.SnippetAdmin._get_references_link = generate_get_references_link('snippet_grouper')
SnippetOriginalAdmin.SnippetAdmin.get_actions_list = _get_actions_list(SnippetOriginalAdmin.SnippetAdmin.get_actions_list)
SnippetOriginalAdmin.SnippetAdmin.get_actions_list = _get_actions_list(
SnippetOriginalAdmin.SnippetAdmin.get_actions_list
)
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
{% block extrastyle %}
{{ block.super }}
<link rel="stylesheet" type="text/css" href="{% static "admin/css/changelists.css" %}">
<style>
#changelist-form .results {
width: auto;
}
</style>
{% endblock %}

{% block extrahead %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
{% load static i18n %}
<a class="btn cms-versioning-action-btn cms-form-get-method js-versioning-action" href="{{ url }}" title="{% trans "Show References" %}"><img src="{% static 'djangocms_references/svg/references.svg' %}"></a>
<a class="btn cms-action-btn cms-form-get-method js-action" href="{{ url }}" title="{% trans "Show References" %}">
<img src="{% static 'djangocms_references/svg/references.svg' %}" style="width: 16.8px; height: 16.8px; margin-right: unset;">
</a>
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{% load i18n djangocms_references_tags %}

{% get_versioning_filer_references_url file as references_url %}
<a href="{{ references_url }}"
title="{% blocktrans %}Show references{% endblocktrans %}" class="action-button cms-form-get-method"><span class="fa fa-code-fork"></span></a>

<a href="{{ references_url }}" title="{% blocktrans %}Show references{% endblocktrans %}" class="action-button cms-form-get-method">
<span class="fa fa-code-fork"></span>
</a>

0 comments on commit 4503fab

Please sign in to comment.