Any ideas for Label Templates? (AngularJS expression replacement) #16704
Replies: 11 comments 12 replies
-
I didn't want to pollute the initial question with my own suggestions. For Contentment, I need to figure out a way to do the Data List's Templated List UI editor, where currently an AngularJS template (markup) can be entered (in the backoffice) and used to render list items. From my current exploration of existing Lit-compatible libraries, I found one called Stampino - it looks very promising. Under the hood it uses a library (by the same developer) called jexpr, which could be used to handle label templates for Block List, et al. |
Beta Was this translation helpful? Give feedback.
-
I am just throwing some very early-stage ideas into the pile here. I would like the templating language to be extendable by packages, and easily reusable by others. It would be cool if a package could add a new function through the extension registry. With all functions in the registry, we could build some good DX/UX on top of it with a suggestion dropdown, inline documentation, etc. With a bit of inspiration from Sheets, Excel, and Mustache a template could look something like this:
Manifest: {
"type": "templateFunction",
//...moreManifestProps
} |
Beta Was this translation helpful? Give feedback.
-
could it be just markdown? That makes all the simple things out of the box, and it falls back to html, which would allow you to use your own webcomponent if you need more advanced stuff... When I talked this over with Niels a little way back, I think we identified the biggest problem would be how to use that for attributes or something that needs to be a string and cant be an element... i dont know what the solution to that is |
Beta Was this translation helpful? Give feedback.
-
Regardless of what we choose to ship by default in the Backoffice, an idea I would like to put forward is to let packages register a template rendering engine of their own meaning, that if an Umbraco developer would like to use another parsing library, they could register it themselves. The registration would have to declare some kind of start character sequence, i.e. Example registration: {
"type": "labelRenderer",
"js": "./my-mustache-js-integration.js",
"startSequence": "{{",
"endSequence": "}}"
} |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
I can see that we already have the "Marked" library (mark-down parser) as a dependency. Maybe we should see how far this can get us in the first run? |
Beta Was this translation helpful? Give feedback.
-
I use Label Templates a lot in BlockLists, Listviews and BlockGrids as well as in Contentment — if I could make a wish here, it'd be for there to be easily-accessible documentation for these, right where we use them, e.g. like the way you can get a list of the supported placeholders for an XPath in the MultiNode Tree Picker. Right where you need it. I'm sure we all have our little Post-Its with “Get name of media item in BlockGrid inside a BlockList” etc... this info would be very nice to have in one single place, but more importantly it would be nice to have access to the most important bits, right where we need it. |
Beta Was this translation helpful? Give feedback.
-
What grey state said .. auto numbering and name generation from the block list item typically using things form this marvellous list The only other editions would be help on things like images (image names/alt) |
Beta Was this translation helpful? Give feedback.
-
I like Mustache as a (default) option. Mustache is well-used enough to be trustworthy - I'd be wary of any more niche libraries. I like the idea of being able to register custom Mustache functions. I also like the idea of being able to register different string parsers as suggested by @iOvergaard Another option would be to stay even more native and use the JS template literals syntax. However, this would require the use of the dreaded |
Beta Was this translation helpful? Give feedback.
-
Is there something implemented in V14 yet ? |
Beta Was this translation helpful? Give feedback.
-
Starting off with an initial question... do we have any ideas what the replacement for AngularJS expressions used within the backoffice? e.g. Block List label templates, a la
"{{ propertyName | ncNodeName }}"
Should we be looking for a library to support the existing structure? e.g. Mustache-esque syntax with piped filter functions.
or could we consider a more generalized template syntax for use across different components of the backoffice? (for things we haven't considered yet.)
Any thoughts, ideas, brainstorming?
Beta Was this translation helpful? Give feedback.
All reactions