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: Update admin page titles #2410

Merged
merged 9 commits into from
Sep 30, 2024
Merged

Conversation

machikoyasuda
Copy link
Member

closes #2381

What this PR does

@machikoyasuda machikoyasuda requested a review from a team as a code owner September 26, 2024 16:01
@github-actions github-actions bot added front-end HTML/CSS/JavaScript and Django templates back-end Django views, sessions, middleware, models, migrations etc. deployment-dev [auto] Changes that will trigger a deploy if merged to dev labels Sep 26, 2024
Copy link

github-actions bot commented Sep 26, 2024

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  benefits
  admin.py
  benefits/in_person
  views.py
Project Total  

This report was generated by python-coverage-comment-action

Comment on lines -7 to -10
{% block title %}
Log in | Cal-ITP Benefits Administrator
{% endblock title %}

Copy link
Member Author

Choose a reason for hiding this comment

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

This is not necessary here, because the {% extends "admin/login.html" %} default Django login page's title uses Log in | site_title.

Comment on lines 4 to 6
{% block title %}
Logged out | Cal-ITP Benefits Administrator
Logged out | {{ site_title }}
{% endblock title %}
Copy link
Member Author

Choose a reason for hiding this comment

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

This logged_out page extends from agency-base, and not the default Django admin log out template, so it's necessary to explicitly spell out Logged out

Copy link
Member

Choose a reason for hiding this comment

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

(can defer this suggestion)

Since we're now setting site_title, etc. on BenefitsAdminSite, I wonder if it'd make sense to make use of the title logic in base_site.html:

{% block title %}{% if subtitle %}{{ subtitle }} | {% endif %}{{ title }} | {{ site_title|default:_('Django site admin') }}{% endblock %}

The idea is we would make agency-base.html extend base_site.html instead of base.html. We'd then set subtitle and title in the context dict, which better aligns with how the default Django admin app configures its page titles, e.g. login.

The way you've implemented setting page titles in this PR works, and I know we're trying to finish this out soon, so maybe we defer using this approach for the future, if ever.

@machikoyasuda machikoyasuda self-assigned this Sep 26, 2024
@lalver1
Copy link
Member

lalver1 commented Sep 27, 2024

This looks good! I like how the titles are organized now 👍
While testing I did notice that server_error.html and success.html, for example, did not have the title set. So I'm wondering, would we want to add title to the context for the views: reenrollment_error, retry, system_error, server_error, success. I think this would set the title for these pages since they already inherit from error-base.html or agency-base.html.

Copy link
Member

@angela-tran angela-tran left a comment

Choose a reason for hiding this comment

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

1 requested change about success / error page titles. The other 2 comments are just notes

Comment on lines +11 to +13
site_title = "Cal-ITP Benefits Administrator"
site_header = "Administrator"
index_title = "Dashboard"
Copy link
Member

Choose a reason for hiding this comment

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

Just wanted to note here: @lalver1 and I had thought about setting these back when he was working on #2313; we chose not to because we didn't want to affect the superuser view.

However, now that we have the spec from product for the page titles and can see more places that need this copy, I think it makes sense to go ahead and set/use these attributes.

So the note here is that the superuser view will now use this copy as well, and I think that is perfectly fine. (We'll probably make the superuser UI and transit agency staff UI look more similar at some point anyways.)

dev-benefits this branch
image image

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for documenting this!

Comment on lines 4 to 6
{% block title %}
Logged out | Cal-ITP Benefits Administrator
Logged out | {{ site_title }}
{% endblock title %}
Copy link
Member

Choose a reason for hiding this comment

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

(can defer this suggestion)

Since we're now setting site_title, etc. on BenefitsAdminSite, I wonder if it'd make sense to make use of the title logic in base_site.html:

{% block title %}{% if subtitle %}{{ subtitle }} | {% endif %}{{ title }} | {{ site_title|default:_('Django site admin') }}{% endblock %}

The idea is we would make agency-base.html extend base_site.html instead of base.html. We'd then set subtitle and title in the context dict, which better aligns with how the default Django admin app configures its page titles, e.g. login.

The way you've implemented setting page titles in this PR works, and I know we're trying to finish this out soon, so maybe we defer using this approach for the future, if ever.

benefits/in_person/views.py Show resolved Hide resolved
@machikoyasuda
Copy link
Member Author

@angela-tran @lalver1 Thanks for the review.
I added code, test updates to cover all those pages I forgot (sys error, server error, re-enrollment error, retry). And I tested them!

I wanted to do the simplest fix for now, as it's the last day of the sprint. But we could make a ticket in the future to refactor like @angela-tran suggested above at a later time.

Copy link
Member

@angela-tran angela-tran left a comment

Choose a reason for hiding this comment

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

This looks great - thank you @machikoyasuda !

@machikoyasuda machikoyasuda merged commit 4545e70 into main Sep 30, 2024
15 checks passed
@machikoyasuda machikoyasuda deleted the feat/2381-admin-page-titles branch September 30, 2024 23:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
back-end Django views, sessions, middleware, models, migrations etc. deployment-dev [auto] Changes that will trigger a deploy if merged to dev front-end HTML/CSS/JavaScript and Django templates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Admin: Update all Admin app view titles
3 participants