Feature #18585
closedFeature #18192: CV "top" section
CV shortlink / cuny.is block
0%
Description
This is a ticket for tracking the cv-shortlink block on the new CV editor.
Files
Updated by Boone Gorges over 1 year ago
- File Peek 2023-08-11 10-25.gif Peek 2023-08-11 10-25.gif added
- Status changed from New to Testing Required
A first pass at this feature is ready for testing.
I mostly replicated the behavior of the existing tool. See attached gif. I tried to give some visual indicators of edit mode (the grey background, the fixed-width font) as well as of success/failure (changing the monospace font background color).
The Blocks Everywhere implementation means that the save routines are truly wacky. I have to do a separate AJAX fetch of the cac-cv object in order to get the necessary data available via register_rest_field(). In addition, it's not possible in Gutenberg to hook into the Save routine, so I couldn't set up a separate AJAX request to save the shortlink. Instead, I piggyback on the main post save, and parse the attributes using parse_blocks() in order to get the new shortlink. To enforce consistency in case of failed shortlink creation, I then override the saved attribute with the value from usermeta when the cac-cv post is loaded via REST. It's very messy but I couldn't figure out a better way to work around the limitations of Gutenberg, Blocks Everywhere, and the way that we store and validate the information.
Updated by Boone Gorges about 1 year ago
- Target version changed from 2.2.0 to 2.3.0
Updated by Boone Gorges about 1 year ago
In response to Sara's comment at https://redmine.gc.cuny.edu/issues/17768#note-34:
2. The short URL: Is this URL already established before editing? mine showed up blank but editable as if you could type it in. When I hit publish, this field still did not visually populate with the URL /scannon but when I went back to the account settings and viewed it, it populated that field.
I've changed the behavior so that when creating a new CV, the block will check to see whether the shorturl corresponding to your user nicename is available for use. If so, it will fill it in. If not, nothing will be filled in unless you manually do so. I think this is a decent workflow that will cover most cases.
Updated by Boone Gorges 10 months ago
- Status changed from Testing Required to Resolved