templates and controllers
Thomas De Schampheleire
patrickdepinguin at gmail.com
Fri Feb 13 15:34:21 EST 2015
On February 13, 2015 4:21:30 PM CET, Mads Kiilerich <mads at kiilerich.com> wrote:
>On 02/13/2015 04:11 PM, Thomas De Schampheleire wrote:
>> Hi,
>
>Hi - I owe you a system overview. it is on my todo list! ;-)
Looking forward to it :)
>
>> I have a question about how one should handle the split between
>> controllers and templates. Let's take one particular example: the
>> difference between the list of pull requests of a particular
>> repository (/pull-request) and the list of 'my pull requests'.
>>
>> For 'all pull requests' of a repo, the actual data is rendered from
>> the controller and placed in a variable c.pullrequest_data, which is
>> expanded from the template. The data is loaded statically (no AJAX)
>> and paged at the controller side.
>>
>> For 'my pull requests', the actual data is fetched dynamically, via
>> AJAX, and no paging is performed.
>>
>> Since I want to line up these two lists of very similar data (at a
>> minimum the way it is displayed), I would like to know what you
>> consider the best approach wrt this template/controller split.
>
>It relates to what has been discussed recently: Whether we should use
>server side templating (which is indexable by bots and easy on the
>browser (but might require more bandwidth and have higher latency)) or
>if we want a more rich javascript browser app that fetches data from
>'web services' and do the 'templating' client side.
>
>You can argue both ways. I think it is a bit overkill to do 'my pull
>requests' dynamically. But in the places where lists can grow long, we
>should have 'infinite scroll' where data is loaded as you scroll down
>in
>the list.
Thanks. Then I will line up both implementations and handle it statically
for now. When the final word on the framework is said we can rework it.
For this static implementation, where one template file 'includes' the other, there are also two variants used:
- render the included template from the controller, store it in a variable that is passed in the controller context, and display the variable from the main template.
- or let the main template include the other template directly from mako code.
What are the benefits of either approach? What is preferred?
Thanks,
Thomas
More information about the kallithea-general
mailing list