Add tooltips to flatdrawing create/edit forms - #137
Merged
Conversation
xmedr
commented
Jul 14, 2026
Collaborator
Author
There was a problem hiding this comment.
The pattern here is:
- create a related
static/js/tooltips/<modelname>.jsscript for the model - add an obj with the keys being each field's label as defined by crispyforms' generated field ids (i.e.
div_id_*), and values being an html string with the help text - add tooltip button and modal html strings to the DOM for each label on the page
- add the resulting script to the model's form template
| "Cross ref map number": ` | ||
| <p>Do not complete for new document additions. This field is a holdover from the paper indexing of historical projects used to indicate multiple locations. Note that the area and section values need to be null for any revisions to the indexing to be saved.</p> | ||
| `, | ||
| "Hash": undefined, |
Collaborator
Author
There was a problem hiding this comment.
The connected issue notes that CCFP isn't sure what the hash field is. I've kept it undefined for now and figure we can come back to add to it if/when we get some more info.
xmedr
marked this pull request as ready for review
July 14, 2026 16:17
antidipyramid
approved these changes
Jul 15, 2026
antidipyramid
left a comment
Collaborator
There was a problem hiding this comment.
Works great. Two small things:
- I think it'd be good to add some extra line breaks in the tooltips with large blocks of text.
- For links, a formatted link would be nice e.g. Interactive map of Sections
Collaborator
Author
|
Ah great point! I've got those changes in there now. Will merge after tests pass. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This pr establishes a pattern for adding tooltips to document create/edit forms, starting with
FlatDrawings. The forms are all handled bydjango-crispy-formsso we're adding tooltips and modals using JS after the form has been rendered.Demo
Notes
My other thought was to have some kind of custom editable db solution, but it feels like this isn't something they're going to change very often so I went with this approach. I'm always open to suggestions if this isn't the case though!
Testing Instructions