-
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
style: Simplify application index page #406
Conversation
Updates the core.pages.index.content_title text in English and Spanish Removes all paragraph content from the viewmodel in core:index Updates the two buttons side-by-side
Please create and use CSS classes/styles in |
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.
Left a similar comment on @machikoyasuda's review, but restating again:
I think the better approach here is to create a new template (.html
file) specifically for the homepage, so you can override the rendering of buttons there - rather than adding a new attribute to the viewmodels
for only this one page. It will also let you get the classes in (see Machiko's comments) specifically for these side-by-side homepage buttons.
See e.g. how the help.html
template {% extends "core/page.html" %}
, then uses the {% block %}
definitions from page.html
to place content or override content in certain areas.
Then in the view you can specify which template file to use.
Adds index.html which extends page.html Moves inline styling to styles.css
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 had a chance to review this today 😄 and left some comments about viewmodel.Page
.
benefits/core/viewmodels.py
Outdated
@@ -122,6 +123,7 @@ def __init__(self, **kwargs): | |||
self.noimage = kwargs.get("noimage", False) | |||
self.icon = kwargs.get("icon") | |||
self.content_title = kwargs.get("content_title") | |||
self.choose_provider = kwargs.get("choose_provider") |
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.
thought: This field is really specific to the index page. It seems like the only time we would ever create a viewmodels.Page
with choose_provider
set to something is the one time in views.index()
, whereas with the other fields, they are more generic and apply to multiple pages.
my suggestion here: Let's remove this field and go back to setting the first button's label to get the "Choose your transit provider" text. I see that you defined a new style class to get the right spacing, and that might be why you added this field (to have more flexibility). Instead, I think you could add some code to includes/button.html
so that you can provide a class to the <label>
if needed. Then in index.html
, you would provide button_label_class="provider"
(or something like that) similar to the way you provided the button to button.html
. (See example code at https://docs.djangoproject.com/en/4.0/ref/templates/builtins/#include)
Let me know if you have any questions or thoughts!
benefits/core/views.py
Outdated
@@ -30,6 +30,11 @@ def _index_url(): | |||
return reverse("core:index") | |||
|
|||
|
|||
def _index_choose_provider(): | |||
"""Helper returns the content title for the common index page.""" | |||
return _("core.pages.index.chooseprovider") |
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.
As a part of my earlier comment/suggestion, let's remove this function.
Adds button label for choose provider Adds class to button template
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.
One minor change to the class for the label, to be more descriptive.
In general, please also be mindful of what files/changes are included in your commits. The latest commit included a change to the file tests/cypress/package-lock.json
... we have a long standing issue with this file constantly getting changed/updated and you didn't do anything wrong to cause the change in that file.
But it also wasn't part of what you were working, so the file shouldn't have been included in the commit. Not a big deal this time but please keep it in mind.
benefits/static/css/styles.css
Outdated
@@ -200,7 +200,10 @@ footer { | |||
width: 100%; | |||
text-align: center !important; | |||
} | |||
|
|||
.provider { |
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 class doesn't say enough about what this is or why we have this style.
I'd like it to be a little more descriptive like .index-agencies-label
or similar.
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.
Thanks for addressing the viewmodels.Page
field @MattRenda.
While re-reading your changes, I noticed a few other issues and left comments below. I think it would be super helpful to us reviewers if you could break up your changes into more atomic commits. With smaller commits that each have their own specific message, it is easier to understand the intent behind your changes.
@@ -177,7 +177,7 @@ footer { | |||
font-weight: 500; | |||
margin-bottom: 1rem; | |||
padding: 1rem; | |||
width: 100%; | |||
width: 49%; |
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.
width: 70%; | ||
margin-left: 15%; | ||
margin-right: 15%; | ||
} |
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.
Are you sure these are ok to remove? i.e. is it possible there were other pages that should have these styles?
@@ -12,7 +12,7 @@ | |||
|
|||
def PageTemplateResponse(request, page_vm): | |||
"""Helper returns a TemplateResponse using the common page template.""" | |||
return TemplateResponse(request, "core/page.html", page_vm.context_dict()) | |||
return TemplateResponse(request, "core/index.html", page_vm.context_dict()) |
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.
PageTemplateResponse
is used in many places, so you are potentially changing a lot more than you should for the effect you are trying to get (to make the index
function use the core/index.html
template).
The return statement of index
is what you should be changing. Feel free to ask me any questions if you feel unsure on this!
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 didn't notice this, thanks for catching!
Also, I don't see this change: The screenshot on #366 shows what the title text should be. |
@machikoyasuda offered the perspective that the scope of #366 might be too large for one PR. She worked on breaking it up into smaller tickets.
|
Decided we should split this work into smaller parts
Renames provider class as index-agencies-label
Resolves #366
Updates the core.pages.index.content_title text in English and Spanish
Removes all paragraph content from the viewmodel in core:index
Updates the two buttons side-by-side
Screenshots