-
Notifications
You must be signed in to change notification settings - Fork 1
Allow editing menu items from Wagtail (#795) #853
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #853 +/- ##
===========================================
+ Coverage 97.43% 97.81% +0.38%
===========================================
Files 236 225 -11
Lines 13475 13070 -405
Branches 79 0 -79
===========================================
- Hits 13129 12785 -344
+ Misses 346 285 -61 🚀 New features to boost your workflow:
|
rlskoeser
left a comment
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.
Looks reasonable to me. Thanks for setting the current values as defaults in the model and migration.
Wonder if it might be useful to have a comment or note in the templates, but probably readable enough.
|
@rlskoeser Working on this, it doesn't quite seem right to configure these Django pages the same way as the Wagtail ones, but maybe I'm wrong. The existing configurable pages are both landing pages and groupings of Wagtail content. Thus, they are configured by editing the
But the two Django pages aren't containers of Wagtail content, and it seems a bit odd to put them in the same place with the content. Snippets does seem like the way to go for those two. Here's what it would be like with snippets now:
But maybe it would be better for users for us to make a new LandingPage subclass instead? I could see it being a bit confusing that it happens in two different places. Ultimately, they'll live side by side in menus:
|
|
@rlskoeser Also: The thing I was talking about in standup is the dropdown in the The one danger in that approach is that they could theoretically be deleted, but it wouldn't be hard to recreate them. I think that would be a danger with |
|
@blms here's where we used the https://github.com/Princeton-CDH/cdh-web/blob/3.5.3/cdhweb/pages/models.py#L191C16-L205C1 It looks like wagtailmenus is still active, seems fine to add that as a dependency so we can use the abstract link page class. |
rlskoeser
left a comment
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.
Documenting the change in approach that we've discussed and decided elsewhere:
- use link pages in wagtail menus to control taglines and menu placement/inclusion/order
- add taglines to landing pages
Additionally, I'm fairly certain you should be able to rely on the context wagtail provides rather than the context processor line you added. If not, it should be added in a wagtail context processor (or whatever the wagtail equivalent is) rather than the settings context.
|
|
||
| {% block header %} | ||
| {% include 'snippets/header.html' with title="books" style="search" %} | ||
| {% include 'snippets/header.html' with title=landing_pages|dict_item:"books"|dict_item:"title" style="search" %} |
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 don't think lookup by title is reliable, can we use slug at least if we have to do a lookup?
mep/context_processors.py
Outdated
| "landing_pages": { | ||
| lp.page: {"title": lp.title, "tagline": lp.tagline} | ||
| for lp in LandingPageSetting.objects.all() | ||
| }, |
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 isn't the right place to pass this in. I'm pretty sure there's a more wagtail-centric way to access snippets and pages - you may already have access to some of this in templates already. If you have trouble finding this quickly, let me know and I'll see if I can find an example in one of other projects.
|
@rlskoeser For migrating to the
Here's how it might look if my thinking is correct: |
Let's limit to the urls since we really only want this to be used for books or members list pages.
I don't remember this level of detail - defer to you. Would be nice if we don't need it, and might be possible to match on the url, but it's fine if slug is easier.
Probably need a title in menus and wagtail interface, so maybe this should be the canonical place for the page title — the default can be used as a fallback in templates if needed. |
|
@rlskoeser Notes:
|
rlskoeser
left a comment
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 all looks great. I'm satisfied with your solution for including the link page in context, and it's fine if we can't prepopulate the link pages as a migration.
If it's possible to create a django fixture file so the two link pages can be easily loaded, that would be helpful so the production site can be updated quickly when the new version goes out. (But only if it's easy)
|
@rlskoeser I was able to create and load a fixture locally, but I have a couple of concerns with it:
Maybe more trouble than it's worth? I think it would take about as long to load fixtures as it would to create the link pages manually. |
|
@blms thanks for investigating, sounds like it isn't worth the trouble. |








Associated Issue(s): #795
Changes in this PR
Notes
Noneshould not have shown up in the templates. (they were failing on things like:work.yearshould be in the template when it'sNone)