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

style: Simplify application index page #406

Closed
wants to merge 4 commits into from
Closed

style: Simplify application index page #406

wants to merge 4 commits into from

Conversation

MattRenda
Copy link
Contributor

@MattRenda MattRenda commented Apr 5, 2022

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

image

image

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
@MattRenda MattRenda requested a review from a team as a code owner April 5, 2022 23:31
@github-actions github-actions bot added the deployment-dev [auto] Changes that will trigger a deploy if merged to dev label Apr 5, 2022
@machikoyasuda
Copy link
Member

Please create and use CSS classes/styles in styles.css, rather than using inline styles. Aside from that, everything looks good to me.

Copy link
Member

@thekaveman thekaveman left a 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
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.

I had a chance to review this today 😄 and left some comments about viewmodel.Page.

@@ -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")
Copy link
Member

@angela-tran angela-tran Apr 8, 2022

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!

@@ -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")
Copy link
Member

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.

@machikoyasuda machikoyasuda added this to the Login.gov SSO milestone Apr 8, 2022
Adds button label for choose provider

Adds class to button template
Copy link
Member

@thekaveman thekaveman left a 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.

@@ -200,7 +200,10 @@ footer {
width: 100%;
text-align: center !important;
}

.provider {
Copy link
Member

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.

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.

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%;
Copy link
Member

Choose a reason for hiding this comment

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

This is affecting other pages. I think putting width: 100% back and moving width: 49% into your style class should solve it, but please check it.

Comparison of the agency-index page on your branch vs. the dev branch:
image

image

width: 70%;
margin-left: 15%;
margin-right: 15%;
}
Copy link
Member

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())
Copy link
Member

@angela-tran angela-tran Apr 13, 2022

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!

Copy link
Member

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!

@angela-tran
Copy link
Member

Also, I don't see this change: Updates the core.pages.index.content_title text in English and Spanish

The screenshot on #366 shows what the title text should be.

@angela-tran
Copy link
Member

angela-tran commented Apr 14, 2022

@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.

@thekaveman thekaveman removed this from the Login.gov SSO milestone Apr 14, 2022
@angela-tran angela-tran dismissed their stale review April 14, 2022 02:52

Decided we should split this work into smaller parts

Renames provider class as index-agencies-label
@MattRenda MattRenda closed this Apr 14, 2022
@thekaveman thekaveman deleted the task366 branch April 14, 2022 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployment-dev [auto] Changes that will trigger a deploy if merged to dev
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Simplify application index page
4 participants