Dear all,
I am trying to understand which is the best way to render a fragment (which can be inside an other fragment and so on).
Lets take a very simple example in which I render a list of comments, and by clicking the 'more' button, few other are loaded with ajax.
So far I found a couple of working solutions:
1 approach:
-- layout.html has an include directive
-- wrapper.html extends layout.html and include comment.html
-- comment.html, renders comments.
When the controller receives an ajax call sets response.view to comment.html otherwise wrapper.html
2. approach:
- layout.html, same as before, it has the include directive
- empty.html, it has only the include directive
- comment.html. it has {{extend 'layout.html' if not request.ajax else 'empty.html'}}
The first approach is difficult to maintain, the example is very simple, the chain can be arbitrary long. The second one doesn't compile, and empty.html is very ugly. I am wondering if could be possible to have extend and include more flexible and easier.
Paolo