Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't hardcode platform name on chart/dashboard links #949

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions home/service/details.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ def _get_context(self):
return {
"entity": self.chart_metadata,
"entity_type": _("Chart"),
"platform_name": _(self.chart_metadata.platform.display_name),
"parent_entity": self.parent_entity,
"parent_type": ResultType.DASHBOARD.name.lower(),
"h1_value": self.chart_metadata.name,
Expand All @@ -168,6 +169,7 @@ def _get_context(self):
"entity": self.dashboard_metadata,
"entity_type": "Dashboard",
"h1_value": self.dashboard_metadata.name,
"platform_name": _(self.dashboard_metadata.platform.display_name),
"charts": sorted(
self.children,
key=lambda d: d.entity_ref.display_name,
Expand Down
8 changes: 3 additions & 5 deletions locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -595,8 +595,6 @@ msgstr "first name"
msgid "last name"
msgstr "last name"

#~ msgid "Search metadata catalogue"
#~ msgstr "Search for data"

#~ msgid "Chart details"
#~ msgstr "Chart details"
# Workaround for Justice Data platform not having a readable display name
msgid "justice-data"
msgstr "Justice Data"
4 changes: 1 addition & 3 deletions templates/details_chart.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ <h2 class="govuk-heading-s govuk-!-margin-top-3">
{% translate "Access this data" %}
</h2>
<div class="govuk-body">
<a href="{{entity.external_url}}" class="govuk-link" rel="noreferrer noopener" target="_blank">
{% blocktranslate with display_name=entity.display_name %}{{ display_name }} on Justice Data (opens in new tab){% endblocktranslate %}
</a>
<a href="{{entity.external_url}}" class="govuk-link" rel="noreferrer noopener" target="_blank">{% blocktranslate with display_name=entity.display_name platform_name=platform_name %}"{{ display_name }}" on {{platform_name}}{% endblocktranslate %}</a> {% translate '(opens in new tab)' %}
</div>
</div>
</div>
Expand Down
6 changes: 2 additions & 4 deletions templates/details_dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,10 @@ <h2 class="govuk-heading-m">{% translate "Dashboard content" %}</h2>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h2 class="govuk-heading-s govuk-!-margin-top-3">
URL
{% translate "Access this data" %}
</h2>
<div class="govuk-body">
<a href="{{entity.external_url}}" class="govuk-link" rel="noreferrer noopener" target="_blank">
{% translate "Justice Data (opens in new tab)" %}
</a>
<a href="{{entity.external_url}}" class="govuk-link" rel="noreferrer noopener" target="_blank">{{ platform_name }}</a> {% translate "(opens in new tab)" %}
</div>
</div>
</div>
Expand Down
3 changes: 2 additions & 1 deletion tests/home/service/test_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,15 @@ def test_get_context(self, mock_catalogue):
)
],
),
platform=EntityRef(urn="", display_name=""),
platform=EntityRef(urn="", display_name="justice-data"),
)
mock_catalogue.get_chart_details.return_value = chart_metadata

context = ChartDetailsService("urn").context
expected = {
"entity": chart_metadata,
"entity_type": "Chart",
"platform_name": "Justice Data",
"parent_entity": None,
"parent_type": "dashboard",
"h1_value": "test",
Expand Down