My application requires a dashboard with a TODAY section that display different tasks created/defined by/for the user for that day. Each task belongs to a different type (from now on referred to as a module) and each module (along with its' tasks for that day) are grouped in widgets in the TODAY section. Also, there may not be any tasks of whatever module for a given day, so the widget for that particular module shouldn't be rendered.
Something like:
Hello username!
Here are your tasks for today:
Module 1
- Task 1
- Task 2
Module 3
- Task 1
(notice that since there are no tasks for Module 2, it shouldn't be rendered in the dashboard)
I have a couple questions on how to implement this functionality:
- Who should know which tasks to show? Should the controller ask the user service what are the tasks for the current user?
Each module widget will have its own controller that will take care handling user interaction with the model. How do I include the widgets along with their controllers in the condition that there are tasks to show for that particular module? Is this a valid approach?
<div dashboard-widget ng-repeat="module in modules" ng-include="module.template" ng-controller="module.controller" widget-title="module.name"></div>
Each module will also have a view/controller where the user will create tasks ot that particular module. Should the widgets for each module be a concern of the dashboard or of the modules themselves? i.e. Should the dashboard be the one who knows how it will display the data for each module?