[PATCH conductor] BZ781579: Autoupdate for deployables#show
Tomas Sedovic
tsedovic at redhat.com
Thu Feb 2 13:30:38 UTC 2012
On 02/01/2012 05:27 PM, Scott Seago wrote:
> On 02/01/2012 10:59 AM, Jan Provaznik wrote:
>> On 01/31/2012 04:26 PM, ifarkas at redhat.com wrote:
>>> From: Imre Farkas<ifarkas at redhat.com>
>>>
>>> https://bugzilla.redhat.com/show_bug.cgi?id=781579
>>> ---
>>> src/app/controllers/deployables_controller.rb | 8 ++++++
>>> src/app/views/deployables/show.html.haml | 33 +++++++++++++++++++++++++
>>> src/public/javascripts/backbone/models.js | 10 +++++++
>>> src/public/javascripts/backbone/routers.js | 19 ++++++++++++++
>>> src/public/javascripts/backbone/views.js | 13 +++++++++-
>>> 5 files changed, 82 insertions(+), 1 deletions(-)
>>>
>>>
>>
>> ACK
>>
>> OT note: I'm little bit scared of how much code is duplicated for
>> html/backbone views. Would be great to do deeper investigation how to
>> optimize this (in post 1.0).
>>
>> Jan
> +1 to this.
>
>
> On at least two separate occasions I fixed a bug, only to realize that
> the problem was "un-fixed" on refresh, since the auto-updated tables are
> repopulated via a completely different code path than the original
> population.
>
> Also, the refresh code is organized in such a different way than the
> controller code that it's hard to connect it (mentally) with the related
> controller code to confirm that things are really doing the same thing.
>
> Scott
>
Imre and I discussed this a few weeks back. This is what we came up with:
1) Extract the views that are needed for client-side rendering to
separate partials.
2) Use Mustache[1] for these views (and keep using HAML for everything
else).
3) There is no step 3.
It would be great if we could just use HAML for everything -- including
client-side rendering, but that doesn't seem to be an option.
Switching from HAML completely towards a templating engine that works
both with Rails and JavaScript seems a bit too much as well. We're quite
invested in HAML and whatever works with JavaScript almost by definition
won't allow using Rails' helper methods from within the views.
Mustache is very simple. It supports almost no logic (basic if/else and
looping over object collections, nothing more). You pass it a Ruby hash
or a JavaScript object and it incorporates the values into the markup.
The overhead of learning/using a second templating engine shouldn't be
too big.
It works under JavaScript and Ruby (the rubygem is in Fedora).
If we limit the Mustache templates only to the pieces that need to be
rendered both in the server and in the browser, it won't get too convoluted.
Thomas
[1]: http://mustache.github.com/
More information about the aeolus-devel
mailing list