Building a modular application

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Building a modular application

ZeetaartPurf
I'm evaluating using thymeleaf for the front-end of an open source database driven application, which is extended/localized by many institutions.
Thymeleaf would replace the current interface, but there's one requirement I couldn't find a solution for.

We want the ability to separate features on a single page, to minimize overrides for localizations. A page can contain multiple "features" at once. An easy comparison is a blog which contains on a single page the current article, a list of recent articles, a list of related articles, …. All of these are separate features (or content blocks)
We want each of these content blocks to be separate from each other, and the current best solution I found was to use a template for each content block, and one template which combines all of these.
This implies adding a feature requires overriding the template and the Controller.

Are there other methods supported in Thymeleaf (e.g. having two methods support the same RequestMapping, and combining the results)?
Reply | Threaded
Open this post in threaded view
|

Re: Building a modular application

Zemi
Administrator
Hello,

a good discussion on how to reuse Thymeleaf code is at
  http://www.thymeleaf.org/doc/articles/layouts.html

Maybe it is not exactly what you are looking for but it could give you some ideas.

Regards,
   Zemi

Reply | Threaded
Open this post in threaded view
|

Re: Building a modular application

ZeetaartPurf
Hi,

Thanks for the quick response.

I did read this page before, and it's indeed not exactly what I was looking for. I already assumed my suggestion wouldn't work since Spring doesn't support this behavior directly either.
What you're suggesting is indeed the next best solution for modular design and code reuse.

I have one more question: the documentation contains example applications, but they are of course all very simple and lightweight.
It would be nice to review a sample application for a larger application, containing many features. Would you recommend verifying the GitHub code for one of applications on http://www.thymeleaf.org/whoisusingthymeleaf.html (e.g. Broadleaf)
Reply | Threaded
Open this post in threaded view
|

Re: Building a modular application

ZeetaartPurf
Hi,

I have another question on this aspect.

It's also important to support multiple themes. This would imply we want to offer multiple themes, and the changes in layout vary from CSS changes to HTML structural changes.

I read it's possible to make the CSS files being included dependent on spring configuration, which is a good start. But changes to the HTML structure most likely require overrides to the applicable templates. Even with the includes being used, this probably implies quite some templates have to be duplicated and adjusted slightly.

Do you have some best practices on this aspect?