Ticket #873 (new Feature Request)
dm4-webactivator: Extend WebActivatorPlugin about additional TemplateResolver Implementations
Reported by: | Malte | Owned by: | |
---|---|---|---|
Priority: | Major | Milestone: | Release 4.8 |
Component: | DeepaMehta Standard Distribution | Version: | 4.7 |
Keywords: | Cc: | jri, dgf, JuergeN | |
Complexity: | 3 | Area: | |
Module: |
Description
Idea:
- Thymelaef Templates can reside (and get processed) not only when packaged within an OSGi bundle but, for example, when being located in any given filerepo.
Goals:
- Let a plugins resource method return a "Viewable" (=a Thymeleaf Template which is preprocessed by the Thymelaef Template engine) which is provided by another plugin
- Allow the use of "th:fragments" (something like partials) within thymeleaf templates. At best, such HTML Partials can reside in the file-repo of the user
- Enable the usage of thymeleaf templates (Viewables) in a save/refresh manner.
Background:
- This would make the development of server side HTML templates more efficient
- Solved, this would provide the framework to share HTML Templates across plugins
- Ultimately, this could enable a plugin developer to create a pool of HTML templates, allowing users to assemble complex "Webpages" with DM4. Such a pool would then ofer users re-usable "HTML Fragments" like for example, a "Youtube Fragment" or a "Mapping Fragment" which they could embed (and parmetrize) in their "Webpage" Topic.
See also:
In the webpages module, which captures the root resource "/" of a dm4-installation, the "dm4-kiezatlas-website" plugins hooks in to provide the HTML frontpage for it. As of the current state, such HTML can be just provided by the means of "plugin.getResourceAsStream()" (instead of "view()", and thus lacks all the properties of a HTML template.
More details:
On how to specify many TemplateResolver? for the Thymeleaf Template Engine (with a specific order) i found this resource:
http://www.thymeleaf.org/doc/tutorials/2.1/usingthymeleaf.html#template-resolvers
Change History
comment:2 Changed 9 years ago by Malte
Hey, that is great to hear!
I thought about this for a while now and i think the most flexible solution for point nr.1 would be if plugins could register a new location (an absolute path) where their templates reside.
This would also be a foundation for working with partials provided by other plugins.
The save/refresh manner is very very desirable but would (from my understanding) can just work if these templates reside outside of a bundle. Which would pose challenges for plugin developers to distribute their templates upon installation, e.g. into a specific path of a filerepo.
Thank you for pointing to these interesting use cases!
I would like to help on that soon.