somawater/deckhand — pull request #27 by elvanja (2014-03-27 09:44:59+00:00)
Title: Stand alone list 2 way data binding

Changelog:
* broadcasting event when card item is refreshed
* refreshing item in list when the above event is triggered
* restructured directive due to specs not running with added $on event

This is an **ugly hack** for issue with 2 way data binding of item and item list. First noticed with Boolean fields, but was actually broken for all in-line editing. E.g. updating item's name should update the name in item list and vice versa.

After digging around a bit, found that:
* changes from item list were propagated to card list on the left and to the cards themselves
* changes from cards propagated to card list on the left, but not to card list sometimes
* card list within a single card (nested table) was updating nicely in all cases
* the only issue was with stand alone lists, e.g. as invoked from main menu

I could not find any issues with definition of ```dhTable``` directive in ```views/deckhand/templates/index_card.html.haml```. I also had trouble detecting patent scopes for the directive in all cases, so finally decided to solve the issue with broadcasting an event when an item is refreshed. It works nicely, but I suppose it's a bit of an ugly hack. If anyone has a better solution, I am all ears!

Also, I tried adding spec for this 2 way data binding issue, but could not repeat the issue there. The spec remains there, but I suppose it adds no real value.