You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unicorn uses components, meaning that encapsulation is done very strongly. This has advantages, if you separate the concerns very much, and reduces spaghetti-code. This works very well for TODO lists and small "applets" that need to add responsiveness in Django. But as Webpages/projects often grow huge, there is need of spreading components all over the place.
I have a generic search field top right, that should be context-aware, depending on what page is loaded. on the "patients" page it should find patients, on the "addressbook" page it should find organizations and persons.
In standard Django templates, I would juts make a search_field block and define an own form element for every page, which is then rendered there in the upper right block. Works.
using unicorn for that, it gets more complicated. I can't just "add" a block to a Unicorn component, and I can't just add a u:click="search" to my snippet in the existing block, as it needs to be part of a Unicorn component to work properly.
So, a way to access other components data would be, reducing the "components" burden a bit, and let Unicorn do a more generic way of calling backend procedures, like e.g. Sockpuppet does it: click->FooReflex#increment. In Unicorn, this could be:
<buttonclass="btn btn-primary" u:click="Search#q">{% trans "search" %}</button>
And it would call the q method of the Search Component.
This must imply that rendering is not done in components, but generic. And Unicorn must determine which Django view is responsible for rendering ATM. Would solve #179 too BTW.
Components could stay as they are in the backend, more or less.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Unicorn uses components, meaning that encapsulation is done very strongly. This has advantages, if you separate the concerns very much, and reduces spaghetti-code. This works very well for TODO lists and small "applets" that need to add responsiveness in Django. But as Webpages/projects often grow huge, there is need of spreading components all over the place.
I have a generic search field top right, that should be context-aware, depending on what page is loaded. on the "patients" page it should find patients, on the "addressbook" page it should find organizations and persons.
In standard Django templates, I would juts make a
search_field
block and define an own form element for every page, which is then rendered there in the upper right block. Works.using unicorn for that, it gets more complicated. I can't just "add" a block to a Unicorn component, and I can't just add a
u:click="search"
to my snippet in the existing block, as it needs to be part of a Unicorn component to work properly.So, a way to access other components data would be, reducing the "components" burden a bit, and let Unicorn do a more generic way of calling backend procedures, like e.g. Sockpuppet does it:
click->FooReflex#increment
. In Unicorn, this could be:And it would call the
q
method of theSearch
Component.This must imply that rendering is not done in components, but generic. And Unicorn must determine which Django view is responsible for rendering ATM. Would solve #179 too BTW.
Components could stay as they are in the backend, more or less.
Beta Was this translation helpful? Give feedback.
All reactions