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

Add external page link to "Read next" sidebar on ResourcePage #3995

Merged
merged 4 commits into from
Aug 28, 2020

Conversation

johnnyporkchops
Copy link
Contributor

@johnnyporkchops johnnyporkchops commented Aug 21, 2020

Summary (required)

  • Add a RichTextBlock to the related_pages ("Read next") section on ResourcePage templates, allowing editors to add an external link in addition to the existing internal PageChooserBlock.

  • Adjust temp[late logic to accommodate

  • We chose a RichTextBlock to give editors the versatility to add an external link as well as pretty much any other content they might need to add here.

  • The seemingly extraneous looping in the template is necessary because the PageChooserBlock is inside a ListBlock, requiring looping to separate them into <li>s on the front end.. Attempts to simplify template logic by switching from a ListBlock to a singular block in the model would group existing database entries for PageChooser ListBlocks into one <li> on the front end.

  • Resolves Wagtail wish list: In resource page template, allow the "related page" to be an external link #3794

Impacted areas of the application

modified: home/models.py
modified: home/templates/home/resource_page.html

Screenshots

Wagtail admin:

Screen Shot 2020-08-21 at 7 40 42 PM


Rendered page:

Screen Shot 2020-08-21 at 7 37 16 PM

How to test

Content team: This is published on feature space at: https://fec-feature-cms.app.cloud.gov/

Developers:

  • checkout and run feature/3794-external-related-page-ResourcePage
  • Go to an existing ResourcePage with Read next sidebar , add Related pages, and External Pages to the "Related Page" and preview/publish to confirm that both show.
  • Create a new ResourcePage and confirm Related Pages section allows to add both internal and external links in an interspersed order.

Note on migrations: This is an example of a models.py streamfield change that does not require a migration to run properly, but would make a new migration file upon running makemigrations., referncing the added block name for the streamfield (but nothing actually changes in the databae) . Rather than push up a migration file for this, It can wait and will get picked up/added next time someone does a crucial makemigrations/migrate for a more substantial models.py change (i.e: upcoming CommissoinerItem model addition. Reference: wagtail/wagtail#3710


Copy link
Contributor

@dorothyyeager dorothyyeager left a comment

Choose a reason for hiding this comment

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

This is exactly what we needed @johnnyporkchops. Much appreciated! Thanks!

If you want to see the test page I created, it's at https://fec-feature-cms.app.cloud.gov/help-candidates-and-committees/keeping-records/best-efforts-test-page/. Worked great.

Copy link
Contributor

@kathycarothers kathycarothers 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 @johnnyporkchops

@lbeaufort lbeaufort added this to the Sprint 13.3 milestone Aug 28, 2020
@lbeaufort
Copy link
Member

lbeaufort commented Aug 28, 2020

@johnnyporkchops I'm going to go ahead and merge this since we have content team approvals and we have a 13.4 ticket for the content team to test the wagtail upgrade next week.

Can you keep an eye on this please? ⬇️

Note on migrations: This is an example of a models.py streamfield change that does not require a migration to run properly, but would make a new migration file upon running makemigrations., referncing the added block name for the streamfield (but nothing actually changes in the databae) . Rather than push up a migration file for this, It can wait and will get picked up/added next time someone does a crucial makemigrations/migrate for a more substantial models.py change (i.e: upcoming CommissoinerItem model addition. Reference: wagtail/wagtail#3710

Copy link
Member

@lbeaufort lbeaufort left a comment

Choose a reason for hiding this comment

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

I rebased this off the latest develop changes locally to make sure the wagtail upgrade didn't break anything, and the tests pass. Thanks for your work on this @johnnyporkchops!

@lbeaufort lbeaufort merged commit 8823975 into develop Aug 28, 2020
@lbeaufort lbeaufort deleted the feature/3794-external-related-page-ResourcePage branch August 28, 2020 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wagtail wish list: In resource page template, allow the "related page" to be an external link
4 participants