Replies: 4 comments
-
I think it's a neat idea, but I'm weary of tying too close to any frontend styles since that isn't really something I have a ton of experience in. Maybe there are additions to unicorn to enable the generic widgets, though? Or even patterns that I could document? |
Beta Was this translation helpful? Give feedback.
-
I think it's not a good idea to tie Unicorn to any frontend, that was not my intention here. Just asking for your opinion whether this is a BadIdea™ altogether ;-) Just because if I start to create some Bootstrap widgets, I would pack them in a different package than my main one, and release them separatedly, something like unicorn-bootstrap-widgets. Yes, and I think some additions are needed. Or more understanding of Unicorn internals from my side:
{% unicorn 'button_checkbox' model='Person' field='has_access_to_foo' %}
|
Beta Was this translation helpful? Give feedback.
-
@nerdoc Did you ever end up creating any components? I am wondering similar things. |
Beta Was this translation helpful? Give feedback.
-
I'm sorry, I ended up with HTMX, and gave up Unicorn for my project (even if it is a great library). |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Adam,
one of the drawbacks in unicorn, sockpuppet, htmx and other similar frameworks always have been, compared to Vue etc, that there exist widget libraries for the bigger Js frontend frameworks.
I recently created a simple "widget" that is basically a bootstrap5 button style radio group, a switch, but with three instead of two states:
True
,False
andNone
, with its graphical representation as template.This works great, but I then had to write some custom code to plug it into Django's model system. For simple input types (like
input type="text"
) this is easy by adding theunicorn:model="foo"
attribute. But for more complex widgets this is not so simple, as it e.g. needs to be bound to a field of a model, e.g.Person.has_access_to_foo
.What if ther would exist a generic bas component system that accepted those models, and they could be used like:
That would be really cool.
I just think about creating DRY code - and reusable components. Maybe it is a lunatic idea - Just tell me your thoughts.n
Do you think that a "library" of Unicorn components would make sense, like Material for Bootstrap, Vuetify, Vue Material, Svelte Material?
Beta Was this translation helpful? Give feedback.
All reactions