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 support for previewing blog posts in list view #6245

Merged
merged 2 commits into from
Jun 18, 2024

Conversation

chosak
Copy link
Member

@chosak chosak commented Jan 29, 2021

This change prototypes using Wagtail's page preview modes to allow for previewing of blog posts in their list view, i.e. how they show up on the blog page.

How to test this PR

Run a local server and edit a blog page. Note that the Preview button is now a dropdown, and you can either preview as normal or preview the post in its "post preview" mode.

Screenshots

image

Screenshots (OLD)

image

image

Notes and todos

This can't be merged right now because the use of Django template caching here means that previewing changes either won't work as expected or will incorrectly cache draft data. A solution to this might involve checking request.is_preview and somehow skipping the {% cache %} tag or (preferably) removing the need for that caching altogether.

This is no longer an issue after #8450.

Checklist

  • PR has an informative and human-readable title
  • Changes are limited to a single goal (no scope creep)
  • Code follows the standards laid out in the CFPB development guidelines
  • Future todos are captured in comments and/or tickets

@Scotchester
Copy link
Contributor

@willbarton This might be a side task we can pick up after addressing the post preview cache in our performance epic.

@chosak
Copy link
Member Author

chosak commented Jan 2, 2024

This can't be merged right now because the use of Django template caching here means that previewing changes either won't work as expected or will incorrectly cache draft data. A solution to this might involve checking request.is_preview and somehow skipping the {% cache %} tag or (preferably) removing the need for that caching altogether.

Wagtail 5.2 introduces a new {% wagtailcache %} template tag that we may be able to adopt to get past this blocker, once we upgrade to that version.

@anselmbradford
Copy link
Member

Wagtail 5.2 introduces a new {% wagtailcache %} template tag that we may be able to adopt to get past this blocker, once we upgrade to that version.

Now that we're on Wagtail 6, is this unblocked?

@chosak
Copy link
Member Author

chosak commented May 10, 2024

@anselmbradford I was actually looking at this again recently. I have some local changes I can try to push up to this PR. It turns out this wasn't blocked by Wagtail 6 after all, since we're using Jinja for this cache tag, not the Django template language, so we can't use Wagtail's {% wagtailcache %} anyway.

@chosak chosak force-pushed the feature/list-view-preview branch from 9844513 to 7f8687a Compare June 18, 2024 18:23
@chosak chosak removed the hold label Jun 18, 2024
@chosak chosak requested a review from willbarton June 18, 2024 18:25
@chosak chosak marked this pull request as ready for review June 18, 2024 18:25
To test, create or edit a BlogPage and look at the sidebar preview.
@chosak chosak force-pushed the feature/list-view-preview branch from 7f8687a to b035d44 Compare June 18, 2024 18:25
@chosak
Copy link
Member Author

chosak commented Jun 18, 2024

@csebianlander @willbarton this is now unblocked; I've updated the screenshot above. Note the "Preview mode" at the bottom of the preview sidebar. This PR has been around since 2021; is there still interest in this feature?

@csebianlander
Copy link
Contributor

If it can now be added without too much trouble, it'd be a great feature to add!

@chosak
Copy link
Member Author

chosak commented Jun 18, 2024

@csebianlander all it takes is your approval of this PR! 😄

@chosak chosak added this pull request to the merge queue Jun 18, 2024
Merged via the queue into main with commit 628c227 Jun 18, 2024
12 checks passed
@chosak chosak deleted the feature/list-view-preview branch June 18, 2024 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants