Skip to content

Commit

Permalink
Merge pull request #1504 from laws-africa/fix-help
Browse files Browse the repository at this point in the history
Admin help topic context
  • Loading branch information
actlikewill authored Sep 4, 2023
2 parents a7338cd + 4eb894d commit 04b587e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion peachjam/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class BaseAdmin(admin.ModelAdmin):

def changelist_view(self, request, extra_context=None):
resp = super().changelist_view(request, extra_context)
if hasattr(self, "help_topic"):
if hasattr(resp, "context_data") and hasattr(self, "help_topic"):
resp.context_data["help_topic"] = self.help_topic
return resp

Expand Down
4 changes: 2 additions & 2 deletions peachjam/templates/admin/change_form.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{% extends "admin/change_form.html" %}
{% load i18n %}
{% block extra_actions %}
{% if PEACHJAM_SETTINGS.help_link and adminform.model_admin.help_topic %}
{% if PEACHJAM_SETTINGS.editor_help_link and adminform.model_admin.help_topic %}
<a target="_blank"
href="{{ PEACHJAM_SETTINGS.help_link }}{{ adminform.model_admin.help_topic }}"
href="{{ PEACHJAM_SETTINGS.editor_help_link }}{{ adminform.model_admin.help_topic }}"
class="btn btn-block btn-info">{% trans 'Help' %}</a>
{% endif %}
{% endblock %}
4 changes: 2 additions & 2 deletions peachjam/templates/admin/change_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
{% load i18n %}
{% block object-tools-items %}
{{ block.super }}
{% if PEACHJAM_SETTINGS.help_link and help_topic %}
{% if PEACHJAM_SETTINGS.editor_help_link and help_topic %}
<a class="btn btn-info"
target="_blank"
href="{{ PEACHJAM_SETTINGS.help_link }}{{ help_topic }}">
href="{{ PEACHJAM_SETTINGS.editor_help_link }}{{ help_topic }}">
<i class="fa fa-question-circle"></i>
{% trans 'Help' %}
</a>
Expand Down

0 comments on commit 04b587e

Please sign in to comment.