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

Admin missing translations and tiny improvements. #2023

Merged
merged 16 commits into from
Jan 9, 2025

Conversation

amazingphilippe
Copy link
Contributor

Summary | Résumé

This addresses cds-snc/notification-planning#998

  • Adds or calls translation keys where missing
  • Adds translations where missing
  • Some style tweaks on the live service table to improve readability.

Test instructions | Instructions pour tester la modification

Sequential steps (1., 2., 3., ...) that describe how to test this change. This
will help a developer test things out without too much detective work. Also,
include any environmental setup steps that aren't in the normal README steps
and/or any time-based elements that this requires.


Étapes consécutives (1., 2., 3., …) qui décrivent la façon de tester la
modification. Elles aideront les développeurs à faire des tests sans avoir à
jouer au détective. Veuillez aussi inclure toutes les étapes de configuration
de l’environnement qui ne font pas partie des étapes normales dans le fichier
README et tout élément temporel requis.

Copy link

<p class="mb-0 text-base text-gray-800">{{ message }}</p>
{% macro empty_list(heading, message=None, img="emptyFlower", link=None, linkText="", attributes="") %}
<div
class="flex items-center border-dashed border-1 border-gray-400 p-8 sm:bg-{{img}} sm:bg-right bg-empty-state min-h-emptyState"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've only added a min-height. The rest is auto formatting.

<td class="table-empty-message p-6" colspan="10">
{{ empty_message }}
<td class="table-empty-message h-10" colspan="10">
{{ empty_list(heading=empty_message) }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use the empty component!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you move this change into its own PR? Along with the change to the empty_list component.

{% macro row_heading(cell_width=None) -%}
<th class="table-field {{ cell_width if cell_width}}" scope="row">
{% macro row_heading(cell_width=None, rowspan="1") -%}
<th class="table-field {{ cell_width if cell_width}}" scope="row" rowspan="{{ rowspan }}">
Copy link
Contributor Author

@amazingphilippe amazingphilippe Dec 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This lets us create <th> that span many rows, like we have on the admin panel for each service usage. Defaults to 1

<li>
<a href="{{ url_for('.organisation_dashboard', org_id=current_org.id) }}" {{ org_navigation.is_selected('dashboard')
}}>
{{ _("Usage") }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks worse than it is, I simply added the _() calls and reformated the html.

@@ -103,7 +103,7 @@
{{ nav_menu_item(url=url_for('main.contact', service_id=current_service.id),localised_txt=_('Contact us'), is_active=header_navigation.is_selected('contact')) }}
{% endif %}
{% else %} {# current_user.platform_admin #}
{% if not platform_admin_view_ind %}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes the empty main navigation in platform admin. ✨ No more layout shift ✨ 🎉

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you move this change into its own PR? So we can make this PR just translation changes?

@@ -113,9 +113,10 @@
{{ nav_menu_item(url=url_for('main.service_settings', service_id=current_service.id),localised_txt=_('Settings'), is_active=header_navigation.is_selected('settings')) }}
{% else %} {# not current_user.has_permissions, i.e. services not in context #}
{{ nav_menu_item(url=url_for('main.choose_account'),localised_txt=_('Your services'),css_classes='pl-0',id_key='choose_account', is_active=header_navigation.is_selected('choose_account')) }}
{{ nav_menu_item(url=url_for('main.live_services', service_id=current_service.id),localised_txt=_('Admin panel')) }}
{{ nav_menu_item(url=url_for('main.live_services', service_id=current_service.id),localised_txt=_('Admin panel'),
is_active=header_navigation) }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just adding the aria-current

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I log in, I now see the blue underline under 2 menu items which seems wrong:
Screenshot 2025-01-08 at 3 18 59 PM

Could you move this change out of this PR so we can make this one just translations?

</h1>
<ul>
{% for service in current_org.live_services %}
<li class="browse-list-item">
<a href="{{ url_for('main.usage', service_id=service.id) }}" class="browse-list-link">{{ service['name'] }}</a>
<a href="{{ url_for('main.service_dashboard', service_id=service.id) }}" class="browse-list-link">{{ service['name']
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found out that there is not sid/usage page. Staging and prod fall back to dashboard somehow, so I've changed it to actually be the dashboard. (And fixed the tests)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense to me!

Copy link
Contributor

@smcmurtry smcmurtry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't noticed any issues with the translations you've added - they look great!

Could you split this PR into a few different ones so that we can merge it in piece by piece?

@@ -103,7 +103,7 @@
{{ nav_menu_item(url=url_for('main.contact', service_id=current_service.id),localised_txt=_('Contact us'), is_active=header_navigation.is_selected('contact')) }}
{% endif %}
{% else %} {# current_user.platform_admin #}
{% if not platform_admin_view_ind %}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you move this change into its own PR? So we can make this PR just translation changes?

<td class="table-empty-message p-6" colspan="10">
{{ empty_message }}
<td class="table-empty-message h-10" colspan="10">
{{ empty_list(heading=empty_message) }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you move this change into its own PR? Along with the change to the empty_list component.

@@ -113,9 +113,10 @@
{{ nav_menu_item(url=url_for('main.service_settings', service_id=current_service.id),localised_txt=_('Settings'), is_active=header_navigation.is_selected('settings')) }}
{% else %} {# not current_user.has_permissions, i.e. services not in context #}
{{ nav_menu_item(url=url_for('main.choose_account'),localised_txt=_('Your services'),css_classes='pl-0',id_key='choose_account', is_active=header_navigation.is_selected('choose_account')) }}
{{ nav_menu_item(url=url_for('main.live_services', service_id=current_service.id),localised_txt=_('Admin panel')) }}
{{ nav_menu_item(url=url_for('main.live_services', service_id=current_service.id),localised_txt=_('Admin panel'),
is_active=header_navigation) }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I log in, I now see the blue underline under 2 menu items which seems wrong:
Screenshot 2025-01-08 at 3 18 59 PM

Could you move this change out of this PR so we can make this one just translations?

Copy link
Contributor

@smcmurtry smcmurtry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great @amazingphilippe! I think I looked at all the pages you touched and they all look good. I noticed a couple minor things that were missing translations but let's deal with those in a different PR.

</h1>
<ul>
{% for service in current_org.live_services %}
<li class="browse-list-item">
<a href="{{ url_for('main.usage', service_id=service.id) }}" class="browse-list-link">{{ service['name'] }}</a>
<a href="{{ url_for('main.service_dashboard', service_id=service.id) }}" class="browse-list-link">{{ service['name']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense to me!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did this file change? was this left over form the other changes that you removed from this PR? if so lets revert changes to this file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably due to the rebuild after I reverted the changes.

@amazingphilippe amazingphilippe merged commit 87fe6e0 into main Jan 9, 2025
11 checks passed
@amazingphilippe amazingphilippe deleted the debt/admin-org-missing-translations branch January 9, 2025 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants