}
}
- $loader = new Civi\Angular\AngularLoader();
+ $loader = Civi::service('angularjs.loader');
+ $loader->addModules('crmDashboard');
$loader->setPageName('civicrm/dashboard');
// For each dashlet that requires an angular directive, load the angular module which provides that directive
- $modules = [];
foreach (CRM_Core_BAO_Dashboard::getContactDashlets() as $dashlet) {
if (!empty($dashlet['directive'])) {
foreach ($loader->getAngular()->getModules() as $name => $module) {
if (!empty($module['exports'][$dashlet['directive']])) {
- $modules[] = $name;
+ $loader->addModules($name);
continue;
}
}
}
}
- $loader->setModules($modules);
-
- $loader->load();
return parent::run();
}
$partials = [];
foreach (CRM_Core_BAO_Dashboard::getContactDashlets() as $dashlet) {
if (!empty($dashlet['directive'])) {
- $partials["~/$moduleName/directives/{$dashlet['directive']}.html"] = "<{$dashlet['directive']}></{$dashlet['directive']}>";
+ // FIXME: Wrapping each directive in <div id='bootstrap-theme'> produces invalid html (duplicate ids in the dom)
+ // but it's the only practical way to selectively apply boostrap3 theming to specific dashlets
+ $partials["~/$moduleName/directives/{$dashlet['directive']}.html"] = "<div id='bootstrap-theme'><{$dashlet['directive']}></{$dashlet['directive']}></div>";
}
}
return $partials;