-
Notifications
You must be signed in to change notification settings - Fork 9
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
Feat: transit agency home dashboard #2313
Conversation
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
This kind of makes me feel like we should have a real |
@angela-tran walked me through the thinking (and docs!) on this setup, thank you 👏 🙌 Makes total sense and please disregard my comment above. |
672fd69
to
7a20fca
Compare
Thanks for the comments @thekaveman and @angela-tran! Quick update on this PR:
|
7a20fca
to
77a684b
Compare
{% endblock branding %} | ||
|
||
{% comment %} {% block coltype %} | ||
colMS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
colMS | |
w-100 |
<div class="col-lg-6"> | ||
<h1>{{ agency.long_name }}</h1> | ||
<h1>In-person enrollment</h1> | ||
<div>Verify transit benefit eligibility using agency criteria and complete a rider's open-loop card enrollment.</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is extremely nit-picky of me:
rider’s
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not at all! Fixed it in 988b5b8
62a2e8f
to
83adb91
Compare
I see Administrator as yellow: My OS and browser are all set to Light mode. The color is coming from here: Where is your black color coming from? I don't see a variable set for I set my Firefox browser to Dark, and I still see a yellow header: @angela-tran @thekaveman What color does the Administrator header show up for you two? And what are your browser / operating system dark/light settings? |
<h1 class="pt-0 pb-3 text-left">{{ agency.long_name }}</h1> | ||
<div class="border border-3 p-3"> | ||
<h2 class="pt-0 pb-2 text-left">In-person enrollment</h2> | ||
<p>Verify transit benefit eligibility using agency criteria and complete a rider's open-loop card enrollment.</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<p>Verify transit benefit eligibility using agency criteria and complete a rider's open-loop card enrollment.</p> | |
<p>Verify transit benefit eligibility using agency criteria and complete a rider’s open-loop card enrollment.</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just this small thing, otherwise this PR LGTM.
There are some questions about how we approach this Header section for example across all the new pages, but I think that kind of refactoring can happen later when we need it. And that for now, this is a good start.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some questions about how we approach this Header section for example across all the new pages, but I think that kind of refactoring can happen later when we need it.
Thanks for noting this; I think this is an important question to answer sooner than later.
@lalver1 and I talked more about his idea from #2313 (comment) when we paired on Friday, and the plan is for him to open a separate PR that extracts out a base template that all the new pages can use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is the full plan: #2246 (comment)
It is the same as what @lalver1 wrote in this PR's description.
Another PR will implement the top right corner "user tools" panel for transit agency staff, and another PR will implement a base html template that will be extended by all templates in the in_person app.
benefits/static/css/styles.css
Outdated
@@ -395,6 +395,7 @@ footer .footer-links li a.footer-link:visited { | |||
outline: 3px solid var(--focus-color) !important; | |||
outline-offset: 2px !important; | |||
box-shadow: none !important; /* override CA State Web Template */ | |||
text-decoration: none; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wanted to leave a comment here for everyone else: This is necessary to override a Django Admin CSS style for buttons. Without this, there would be an underline on the button.
7dd9c01
to
f968a03
Compare
@angela-tran and @machikoyasuda, I was looking at the other in-person eligibility tickets and I'm wondering what you think if I add one minor thing to this PR. I would make a new template called something like |
f968a03
to
51ce1fd
Compare
Thanks for the feedback last week @angela-tran. The tests were failing earlier but now they are all passing so I think this one is ready for a re-review. The key changes are:
|
<img class="lg d-none d-lg-block" src="{% static "img/logo-lg.svg" %}" width="220" height="50" alt="{% translate "California Integrated Travel Project: Benefits logo (large)" context "image alt text" %}" /> | ||
</span> | ||
</div> | ||
<h1 class="p-0 branding-title">Administrator</h1> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<h1 class="p-0 branding-title">Administrator</h1> | |
<h1 class="p-0 m-0 text-white">Administrator</h1> |
Adding m-0
here will vertically center the Administrator text and the logo.
benefits/static/css/admin/styles.css
Outdated
@font-face { | ||
font-family: "Public Sans"; | ||
font-weight: var(--bold-font-weight); | ||
font-style: normal; | ||
/* prettier-ignore */ | ||
src: local("PublicSans"), url("../../fonts/PublicSans-Bold.woff") format("woff"); | ||
/* prettier-ignore */ | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 removed it in 57b8522
benefits/static/css/admin/styles.css
Outdated
:root { | ||
--branding-title-color: #ffffff; | ||
} | ||
.branding-title { | ||
color: var(--branding-title-color); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also just use text-white
utility class from Bootstrap so we don't have to have this one-off style. Documented here: https://getbootstrap.com/docs/5.3/utilities/colors/#colors
a88cc40
to
f759564
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Front-end changes LGTM 👍 👍 This is a great foundation for the rest of the In Person work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left some comments about naming in the tests that you can commit if you agree with them.
And there is one comment that no action is needed on -- I'll create a separate ticket for it.
Nice work 👍 👍
tests/pytest/test_admin.py
Outdated
|
||
|
||
@pytest.fixture | ||
def model_SuperAgencyUser(model_User): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def model_SuperAgencyUser(model_User): | |
def model_StaffGroupUser(model_User): |
tests/pytest/test_admin.py
Outdated
|
||
@pytest.fixture | ||
def model_User(): | ||
return User.objects.create(is_active="1", is_staff="1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is nitpicky, but I think we should just use True
here instead of this roundabout way of setting the boolean.
There's not a specific reason to use "1"
here, right? It's a little distracting because it's not how we normally set these as far as I know.
return User.objects.create(is_active="1", is_staff="1") | |
return User.objects.create(is_active=True, is_staff=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not at all, this makes sense to use True
👍 I was looking at the database and got confused because I saw True
gets stored as 1
, but we are working with the Django model, not the database value and we should use True
for setting the boolean.
tests/pytest/test_admin.py
Outdated
|
||
@pytest.fixture | ||
def model_SuperUser(model_User): | ||
model_User.is_superuser = "1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
model_User.is_superuser = "1" | |
model_User.is_superuser = True |
tests/pytest/test_admin.py
Outdated
def test_admin_override_super_agency_user(app_request, model_SuperAgencyUser): | ||
app_request.user = model_SuperAgencyUser |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def test_admin_override_super_agency_user(app_request, model_SuperAgencyUser): | |
app_request.user = model_SuperAgencyUser | |
def test_admin_override_staff_group_user(app_request, model_StaffGroupUser): | |
app_request.user = model_StaffGroupUser |
9dffa90
9dffa90
to
b5d1114
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
Woohoo! 🔥 🔥 🔥 |
Part of #2246
This PR implements overriding the default admin site so that transit agency staff see a home dashboard upon logging in:
A superuser or Cal-ITP user still sees the default Django admin site.
Another PR will implement the top right corner "user tools" panel for transit agency staff, and another PR will implement a base
html
template that will be extended by all templates in thein_person
app.Steps to test:
bin/reset_db.sh
).env
localhost/admin
and sign in with your email addressCST
groupCST
group to CST transit agency’s “staff_group” (it will ask foraudience
andclient_id
, use dummy values)Cal-ITP
from your user’s chosen groupsCST
group to your user’s chosen groupslocalhost/admin
, verify that the agency home dashboard appears