django-unicorn icon indicating copy to clipboard operation
django-unicorn copied to clipboard

Router pattern

Open lorddaedra opened this issue 3 years ago • 4 comments

How to implement something like that https://router.vuejs.org/guide/#html in most optimal way?..

For example, I have some admin panel, something like Django Admin.

I have some main sections (like Django admin apps), categories (like models in Django admin) and final pages with grids, buttons, related with forms etc.

I need be able to add/remove new components without original page reloading.

For example, I have sections in top menu and categories in left menu.

In this case after user select topmenu item, he/she will get new left menu and new page content. If he/she select left menu item - same topmenu, without reloading but new page content (right side).

May be we can create some kind of recommended unified way to do that things?..

lorddaedra avatar Apr 17 '21 09:04 lorddaedra

Where I would start is with one main component that has boolean fields that hide/show the components and click events on the sections/categories which either set a flag or call a component method if needed. It might also make sense to use child components for the sidebar or top menu if you want to keep those concerns separated.

Feel free to make a branch with some code if you get stuck implementing!

adamghill avatar Apr 18 '21 20:04 adamghill

This functionality would be fantastic.

jonnyhoff avatar Nov 29 '21 21:11 jonnyhoff

@adamghill , Could you explain a little bit more please? I'd love to implement this. btw... keep up the great work.

jonnyhoff avatar Nov 29 '21 22:11 jonnyhoff

@adamghill The problem with your approach is that the url will not be handled. I know that this is not a replacement for full featured SPA frameworks with a routing system but it would be nice to have some sort of routing handler for django unicorn components. Maybe using direct views.

marcelombc avatar Sep 05 '22 06:09 marcelombc