-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stubs for the classes for widget based on a model #22
Comments
Since the widgets are simply ViewComponents, you have a couple of options:
Once I have the data access class (IApprovalService), I can populate it as necessary. Your BaseWidget could inject everything you need for descendant widgets.
I hope this helps. |
side note, wanted to share, but didn't want to do a PR for something incomplete, below is an approach I was taking to make it reusable for all the developers here, to allow the user to select a table and bind this as a widget
then in the controller
is there a better way to do this generically on any table, since you are the architect here :) |
If your data is generic enough, I would encapsulate it more at the ViewComponent level. In your ViewComponent (Widget?), I would pass the data into the ViewComponent's "Default.cshtml" View. I like to do things declaratively as opposed to writing code to create a UI (like the HTMLTable) If I need to make a UI change, I like to make it without re-compiling. ;-)
In the Default.cshtml, add the Model.
And then create your table using HTML. I was told a while ago that ViewComponents are like "mini-controllers." Yes, you can pass things into them, but it makes more sense to contain everything in each ViewComponent. So your Controller can be whittled down to a View instead of passing data. Your Controller's View will have your markup and a ViewComponent widget:
I hope this helps and thank you so much for the support. The references I've been using for building ViewComponents for Tuxboard:
|
Amazing man, its been a learning curve generally by playing around with your framework, so a big 🤟 thanks. Maybe just me, but I get confused by which to use, I was going to write a small collection and push a PR on a few items, tables, charts, graphs to your |
Awesome! Glad to hear it's coming together for you. For permissions, I use Microsoft Identity to identify user types coming into the system and what widgets they can add/see/use onto a dashboard. I've even adapted a similar strategy for any type of menu system using Microsoft Identity; What menu items can you show/hide based on a user's role. If you look at the HomeController.cs for the "kitchen sink" demo, you'll see a Hope this helps. :-) |
Hello, this is a fav. lib of mine, I am trying to create an auto generate function that creates the classes for the widgets and the dashboard, can you share what are the classes I should be generating.
Or would it be better to have a base class with all the classes and relationships and derive from it?
The text was updated successfully, but these errors were encountered: