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

Create pattern for editing content that appears across a set of detail pages #1177

Open
hancush opened this issue Dec 2, 2024 · 6 comments · May be fixed by #1185
Open

Create pattern for editing content that appears across a set of detail pages #1177

hancush opened this issue Dec 2, 2024 · 6 comments · May be fixed by #1185
Assignees

Comments

@hancush
Copy link
Collaborator

hancush commented Dec 2, 2024

E.g., public comment instructions on event detail pages

N.b., the CMS will not enable customizing information about particular events / board reports - that information should be entered into Legistar.

@hancush
Copy link
Collaborator Author

hancush commented Dec 3, 2024

Connects #1168

@xmedr
Copy link
Collaborator

xmedr commented Dec 4, 2024

Let's try to see if we can include custom "blocks" in the rich text editor based on the event itself, like the ecomment url. This link might help: https://docs.wagtail.org/en/latest/advanced_topics/customization/page_editing_interface.html#rich-text-html

@hancush
Copy link
Collaborator Author

hancush commented Dec 4, 2024

In our jam session, @xmedr and I contemplated a model to contain editable text that varies based on when it is and when the event takes place.

# model

class EventBlurb
	CONDITION_CHOICES = future, upcoming, ongoing, concluded
	
	condition = arrayfield(charfield(choices))  # this is always OR (AND is not possible)
	blurb = textfield

# template

    for blurb in event blurb
	for condition in condition
	    if condition
		blurb

@hancush
Copy link
Collaborator Author

hancush commented Dec 4, 2024

@xmedr
Copy link
Collaborator

xmedr commented Dec 10, 2024

@hancush Thanks for that link! Through that I've found that I should be extending the draftail editor to include a new block. And this almost works. I can create a new link type and give it an aria-label, target, and href. And I was hoping that I could default the href to {{event.ecomment_url}}, save that to the model, and have that render, however this is not the case. The href itself shows up as that template variable.

Do you have any ideas on making django render template variables from the database? If not, the alternative could be to have some JS on event detail pages that attaches to these ecomment links if they exist, and either changes the href, or just takes care of opening the right link itself.

The rendered link:
image

The editor with a new ecomment button:
image

@hancush
Copy link
Collaborator Author

hancush commented Dec 10, 2024

@xmedr Hm, let's pair on this one. Want to grab a time?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging a pull request may close this issue.

2 participants