-----------------
On dashboard load
-----------------
Route: /#/home
Controller: HomeController
|
V
TemplateService.getTemplates()
|
V
DataStoreSrvc.add(template) * n times
|
V
FilteredData.templates = TemplateTimelineService.getItemsByDate(DataStore.templates)
|
V
ProcessTimelineServiceervice.processTimelines(FilteredData.templates)
|
V
$scope.timelineItems = DataStoreSrvc.getPosts()
-----------------
On Date change
-----------------
Get new templates and assign only the templates applicable for given date, to FilteredData.templates. Since $scope.timelineItems holds the reference of FilteredData.templates, the timeline is auto updated with new data.
TemplateService.getTemplates()
|
V
DataStoreSrvc.updateAll()
---------------------
On sort order change
---------------------
Assign only the templates applicable for given date, sorted based on new sort order, to FilteredData.templates. Since $scope.timelineItems holds the reference of FilteredData.templates, the timeline is auto updated with new data.
TimelineService.setSortOrder();
|
V
DataStoreSrvc.updateAll()