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
Merged
Show file tree
Hide file tree
Changes from 8 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: 1 addition & 1 deletion app/assets/stylesheets/index.css
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.

Large diffs are not rendered by default.

8 changes: 2 additions & 6 deletions app/assets/stylesheets/tailwind/components/table.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
table th,
table td {
padding: 0.632em 1.05em 0.4743em 0;
@apply leading-tight text-smaller text-left border-solid border-0 border-b-1 border-gray-300;
@apply leading-tight text-smaller text-left border-solid border-0 border-b-1 border-gray-300 align-baseline;
}
thead th {
@apply font-bold;
Expand Down Expand Up @@ -95,10 +95,6 @@
.settings-table .table-heading {
@apply mb-8;
}

.table-field {
@apply align-top;
}
.table-field-index {
width: 15px;
@apply relative text-smaller leading-tight font-bold;
Expand Down Expand Up @@ -134,7 +130,7 @@
}
.table-field-headings th,
.table-field-headings-visible th {
@apply text-smaller leading-tight font-bold;
@apply text-smaller leading-tight font-bold align-baseline;
}
.dashboard-table .table-field-heading-first,
.dashboard-table .table-field-headings-first,
Expand Down
20 changes: 10 additions & 10 deletions app/main/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,33 +558,33 @@ class SendingDomainForm(StripWhitespaceForm):

class RenameOrganisationForm(StripWhitespaceForm):
name = StringField(
"Organisation name",
_l("Organisation name"),
validators=[DataRequired(message=_l("This cannot be empty"))],
)


class OrganisationOrganisationTypeForm(StripWhitespaceForm):
org_type = OrganisationTypeField("What type of organisation is this?")
org_type = OrganisationTypeField(_l("What type of organisation is this?"))


class OrganisationCrownStatusForm(StripWhitespaceForm):
crown_status = RadioField(
("Is this organisation a crown body?"),
_l("Is this organisation a crown body?"),
choices=[
("crown", "Yes"),
("non-crown", "No"),
("unknown", "Not sure"),
("crown", _l("Yes")),
("non-crown", _l("No")),
("unknown", _l("Not sure")),
],
)


class OrganisationAgreementSignedForm(StripWhitespaceForm):
agreement_signed = RadioField(
("Has this organisation signed the agreement?"),
_l("Has this organisation signed the agreement?"),
choices=[
("yes", "Yes"),
("no", "No"),
("unknown", "No (but we have some service-specific agreements in place)"),
("yes", _l("Yes")),
("no", _l("No")),
("unknown", _l("No (but we have some service-specific agreements in place)")),
],
)

Expand Down
18 changes: 11 additions & 7 deletions app/templates/components/empty-list.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
{% macro empty_list(heading, message, 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" data-testid='empty-list'>
<div class="w-full sm:w-2/3" tabindex="0">
<div class="text-title text-gray-700 mb-6">{{ heading }}</div>
{% 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" data-testid='empty-list'>
<div class="w-full sm:w-2/3 space-y-gutterHalf" tabindex="0">
<div class="text-title text-gray-700">{{ heading }}</div>
{% if message %}
<p class="mb-0 text-base text-gray-800">{{ message }}</p>
{% if link %}
<a class="inline-block mt-6 text-base font-bold" {% if attributes %} {{ attributes }} {% endif %} href="{{ link }}">{{ linkText }}</a>
{% endif %}
{% endif %}
{% if link %}
<a class="inline-block text-base font-bold" {% if attributes %} {{ attributes }} {% endif %} href="{{ link }}">
{{ linkText }}
</a>
{% endif %}
</div>
</div>
{% endmacro %}
9 changes: 5 additions & 4 deletions app/templates/components/table.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% from "components/big-number.html" import big_number %}
{% from "components/empty-list.html" import empty_list %}

{% macro mapping_table(caption='', field_headings=[], field_headings_visible=True, caption_visible=True, equal_length=False, font_size="table-font-xsmall", testid=None) -%}
<section class="scrollable-table" tabindex="0">
Expand Down Expand Up @@ -43,8 +44,8 @@
{% endfor %}
{% if not items %}
{% call row() %}
<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.

</td>
{% endcall %}
{% endif %}
Expand Down Expand Up @@ -87,8 +88,8 @@
</td>
{%- endmacro %}

{% 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

{{ caller() }}
</th>
{%- endmacro %}
Expand Down
30 changes: 20 additions & 10 deletions app/templates/org_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,29 @@
<div class="w-1/4 float-left py-0 px-0 px-gutterHalf box-border">
<nav class="navigation">
<ul>
<li><a
href="{{ url_for('.organisation_dashboard', org_id=current_org.id) }}" {{ org_navigation.is_selected('dashboard') }}>Usage</a>
<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.

</a>
</li>
<li>
<a href="{{ url_for('.manage_org_users', org_id=current_org.id) }}" {{ org_navigation.is_selected('team-members') }}>
{{ _("Team members")}}
</a>
</li>
<li><a
href="{{ url_for('.manage_org_users', org_id=current_org.id) }}" {{ org_navigation.is_selected('team-members') }}>Team
members</a></li>
{% if current_user.platform_admin %}
<li><a
href="{{ url_for('.organisation_settings', org_id=current_org.id) }}" {{ org_navigation.is_selected('settings') }}>Settings</a>
<li>
<a href="{{ url_for('.organisation_settings', org_id=current_org.id) }}" {{ org_navigation.is_selected('settings') }}>
{{ _("Settings") }}
</a>
</li>
<li>
<a href="{{ url_for('.organisation_trial_mode_services', org_id=current_org.id) }}" {{
org_navigation.is_selected('trial-services') }}>
{{ _("Trial services") }}
</a>
</li>
<li><a
href="{{ url_for('.organisation_trial_mode_services', org_id=current_org.id) }}" {{ org_navigation.is_selected('trial-services') }}>Trial
services</a></li>
{% endif %}
</ul>
</nav>
Expand Down
7 changes: 4 additions & 3 deletions app/templates/partials/nav/gc_header_nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -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?

{% if current_user.has_permissions() %}
{{ nav_menu_item(url=url_for('main.live_services', service_id=current_service.id), localised_txt=_('Admin panel'), css_classes='pl-0') }}
{{ nav_menu_item(url=url_for('main.service_dashboard', service_id=current_service.id),localised_txt=_('Dashboard'), is_active=header_navigation.is_selected('dashboard')) }}
Expand All @@ -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?

{% endif %}
{% endif %}

{% endif %}
{% endif %}
<a
Expand Down
7 changes: 4 additions & 3 deletions app/templates/views/organisations/organisation/index.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
{% extends "org_template.html" %}

{% block org_page_title %}
Usage
{{_("Usage")}}
{% endblock %}

{% block org_content %}

<h1 class="heading-medium">
Usage
{{_("Usage")}}
</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!

}}</a>
</li>
{% endfor %}
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@
{% extends "org_template.html" %}

{% block org_page_title %}
GC Notify data sharing and financial agreement
{{ _("GC Notify data sharing and financial agreement") }}
{% endblock %}

{% block org_content %}
{{ page_header(
"GC Notify data sharing and financial agreement",
back_link=url_for('.organisation_settings', org_id=current_org.id)
) }}
<div class="grid-row contain-floats">
<div class="md:w-5/6 float-left py-0 px-0 px-gutterHalf box-border">
{% call form_wrapper() %}
{{ radios(
form.agreement_signed,
option_hints={
'yes': 'Users will be told their organisation has already signed the agreement',
'no': 'Users will be prompted to sign the agreement before they can go live',
'unknown': 'Users won’t be prompted to sign the agreement'
}
{{ page_header(
_("GC Notify data sharing and financial agreement"),
back_link=url_for('.organisation_settings', org_id=current_org.id)
) }}
<div class="grid-row contain-floats">
<div class="md:w-5/6 float-left py-0 px-0 px-gutterHalf box-border">
{% call form_wrapper() %}
{{ radios(
form.agreement_signed,
option_hints={
'yes': _('Users will be told their organisation has already signed the agreement'),
'no': _('Users will be prompted to sign the agreement before they can go live'),
'unknown': _('Users won’t be prompted to sign the agreement')
}
) }}
{{ page_footer(_('Save')) }}
{% endcall %}
</div>
{{ page_footer(_('Save')) }}
{% endcall %}
</div>
{% endblock %}
</div>
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
{% extends "org_template.html" %}

{% block org_page_title %}
Crown organisation
{{ _("Crown organisation") }}
{% endblock %}

{% block org_content %}
{{ page_header(
"Crown organisation",
back_link=url_for('.organisation_settings', org_id=current_org.id)
) }}
<div class="grid-row contain-floats">
<div class="md:w-5/6 float-left py-0 px-0 px-gutterHalf box-border">
{% call form_wrapper() %}
{{ radios(form.crown_status) }}
{{ page_footer(_('Save')) }}
{% endcall %}
</div>
{{ page_header(
_("Crown organisation"),
back_link=url_for('.organisation_settings', org_id=current_org.id)
) }}
<div class="grid-row contain-floats">
<div class="md:w-5/6 float-left py-0 px-0 px-gutterHalf box-border">
{% call form_wrapper() %}
{{ radios(form.crown_status) }}
{{ page_footer(_('Save')) }}
{% endcall %}
</div>
{% endblock %}
</div>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
{% from "components/form.html" import form_wrapper %} {% from
"components/page-footer.html" import page_footer %} {% from
"components/page-header.html" import page_header %} {% from
"components/textbox.html" import textbox %} {% extends "org_template.html" %} {%
block org_page_title %} Edit request to go live notes {% endblock %} {% block
maincolumn_content %} {{ page_header( "Edit request to go live notes",
{% from "components/form.html" import form_wrapper %}
{% from "components/page-footer.html" import page_footer %}
{% from "components/page-header.html" import page_header %}
{% from "components/textbox.html" import textbox %}
{% extends "org_template.html" %}

{% block org_page_title %}
{{ _("Edit request to go live notes") }}
{% endblock %}

{% block maincolumn_content %}
{{ page_header( _("Edit request to go live notes"),
back_link=url_for('.organisation_settings', org_id=current_org.id) ) }}
<div class="grid-row contain-floats">
<div class="md:w-5/6 float-left py-0 px-0 px-gutterHalf box-border">
Expand All @@ -14,4 +20,4 @@
width='w-full', rows=3) }} {{ page_footer(_('Save')) }} {% endcall %}
</div>
</div>
{% endblock %}
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
{% extends "org_template.html" %}

{% block org_page_title %}
Organisation sector
{{ _("Organisation sector") }}
{% endblock %}

{% block org_content %}
{{ page_header(
"Organisation sector",
_("Organisation sector"),
back_link=url_for('.organisation_settings', org_id=current_org.id)
) }}
{% call form_wrapper() %}
Expand Down
Loading
Loading