Commit 8456e727 authored by totten's avatar totten

CRM-20600 - Move Angular metadata to civix-style files

This PR moves the metadata about Angular modules out of Civi\Angular\Manager
and into standalone files (`ang/*.ang.php`).  This uses the same structure
as `civix`.  Also, this makes it easier to navigate between the
JS/HTML/CSS/PHP content.

To test that these changes were safe, I ran the following command before and
after this commit:

$ cv ev 'var_dump(Civi::service("angular")->getModules());'

The results were substantively identical.
parent aad66c60
......@@ -59,19 +59,10 @@ class CRM_Case_Info extends CRM_Core_Component_Info {
* @inheritDoc
*/
public function getAngularModules() {
$result = array();
$result['crmCaseType'] = array(
'ext' => 'civicrm',
'js' => array('ang/crmCaseType.js'),
'css' => array('ang/crmCaseType.css'),
'partials' => array('ang/crmCaseType'),
);
global $civicrm_root;
CRM_Core_Resources::singleton()->addSetting(array(
'crmCaseType' => array(
'REL_TYPE_CNAME' => CRM_Case_XMLProcessor::REL_TYPE_CNAME,
),
));
$result = array();
$result['crmCaseType'] = include "$civicrm_root/ang/crmCaseType.ang.php";
return $result;
}
......
......@@ -71,6 +71,7 @@ class CRM_Mailing_Info extends CRM_Core_Component_Info {
) {
return array();
}
global $civicrm_root;
$reportIds = array();
$reportTypes = array('detail', 'opened', 'bounce', 'clicks');
......@@ -81,32 +82,9 @@ class CRM_Mailing_Info extends CRM_Core_Component_Info {
$reportIds[$report] = $result['values'][0]['id'];
}
$result = array();
$result['crmMailing'] = array(
'ext' => 'civicrm',
'js' => array(
'ang/crmMailing.js',
'ang/crmMailing/*.js',
),
'css' => array('ang/crmMailing.css'),
'partials' => array('ang/crmMailing'),
);
$result['crmMailingAB'] = array(
'ext' => 'civicrm',
'js' => array(
'ang/crmMailingAB.js',
'ang/crmMailingAB/*.js',
'ang/crmMailingAB/*/*.js',
),
'css' => array('ang/crmMailingAB.css'),
'partials' => array('ang/crmMailingAB'),
);
$result['crmD3'] = array(
'ext' => 'civicrm',
'js' => array(
'ang/crmD3.js',
'bower_components/d3/d3.min.js',
),
);
$result['crmMailing'] = include "$civicrm_root/ang/crmMailing.ang.php";
$result['crmMailingAB'] = include "$civicrm_root/ang/crmMailingAB.ang.php";
$result['crmD3'] = include "$civicrm_root/ang/crmD3.ang.php";
$config = CRM_Core_Config::singleton();
$session = CRM_Core_Session::singleton();
......
......@@ -58,87 +58,28 @@ class Manager {
public function getModules() {
if ($this->modules === NULL) {
$config = \CRM_Core_Config::singleton();
global $civicrm_root;
$angularModules = array();
$angularModules['angularFileUpload'] = array(
'ext' => 'civicrm',
'js' => array('bower_components/angular-file-upload/angular-file-upload.min.js'),
);
$angularModules['crmApp'] = array(
'ext' => 'civicrm',
'js' => array('ang/crmApp.js'),
);
$angularModules['crmAttachment'] = array(
'ext' => 'civicrm',
'js' => array('ang/crmAttachment.js'),
'css' => array('ang/crmAttachment.css'),
'partials' => array('ang/crmAttachment'),
'settings' => array(
'token' => \CRM_Core_Page_AJAX_Attachment::createToken(),
),
);
$angularModules['crmAutosave'] = array(
'ext' => 'civicrm',
'js' => array('ang/crmAutosave.js'),
);
$angularModules['crmCxn'] = array(
'ext' => 'civicrm',
'js' => array('ang/crmCxn.js', 'ang/crmCxn/*.js'),
'css' => array('ang/crmCxn.css'),
'partials' => array('ang/crmCxn'),
);
//$angularModules['crmExample'] = array(
// 'ext' => 'civicrm',
// 'js' => array('ang/crmExample.js'),
// 'partials' => array('ang/crmExample'),
//);
$angularModules['crmResource'] = array(
'ext' => 'civicrm',
// 'js' => array('js/angular-crmResource/byModule.js'), // One HTTP request per module.
'js' => array('js/angular-crmResource/all.js'), // One HTTP request for all modules.
);
$angularModules['crmUi'] = array(
'ext' => 'civicrm',
'js' => array('ang/crmUi.js'),
'partials' => array('ang/crmUi'),
);
$angularModules['crmUtil'] = array(
'ext' => 'civicrm',
'js' => array('ang/crmUtil.js'),
);
// https://github.com/jwstadler/angular-jquery-dialog-service
$angularModules['dialogService'] = array(
'ext' => 'civicrm',
'js' => array('bower_components/angular-jquery-dialog-service/dialog-service.js'),
);
$angularModules['ngRoute'] = array(
'ext' => 'civicrm',
'js' => array('bower_components/angular-route/angular-route.min.js'),
);
$angularModules['ngSanitize'] = array(
'ext' => 'civicrm',
'js' => array('bower_components/angular-sanitize/angular-sanitize.min.js'),
);
$angularModules['ui.utils'] = array(
'ext' => 'civicrm',
'js' => array('bower_components/angular-ui-utils/ui-utils.min.js'),
);
$angularModules['ui.sortable'] = array(
'ext' => 'civicrm',
'js' => array('bower_components/angular-ui-sortable/sortable.min.js'),
);
$angularModules['unsavedChanges'] = array(
'ext' => 'civicrm',
'js' => array('bower_components/angular-unsavedChanges/dist/unsavedChanges.min.js'),
);
// Note: It would be nice to just glob("$civicrm_root/ang/*.ang.php"), but at time
// of writing CiviMail and CiviCase have special conditionals.
$angularModules['statuspage'] = array(
'ext' => 'civicrm',
'js' => array('ang/crmStatusPage.js', 'ang/crmStatusPage/*.js'),
'css' => array('ang/crmStatusPage.css'),
'partials' => array('ang/crmStatusPage'),
'settings' => array(),
);
$angularModules = array();
$angularModules['angularFileUpload'] = include "$civicrm_root/ang/angularFileUpload.ang.php";
$angularModules['crmApp'] = include "$civicrm_root/ang/crmApp.ang.php";
$angularModules['crmAttachment'] = include "$civicrm_root/ang/crmAttachment.ang.php";
$angularModules['crmAutosave'] = include "$civicrm_root/ang/crmAutosave.ang.php";
$angularModules['crmCxn'] = include "$civicrm_root/ang/crmCxn.ang.php";
// $angularModules['crmExample'] = include "$civicrm_root/ang/crmExample.ang.php";
$angularModules['crmResource'] = include "$civicrm_root/ang/crmResource.ang.php";
$angularModules['crmUi'] = include "$civicrm_root/ang/crmUi.ang.php";
$angularModules['crmUtil'] = include "$civicrm_root/ang/crmUtil.ang.php";
$angularModules['dialogService'] = include "$civicrm_root/ang/dialogService.ang.php";
$angularModules['ngRoute'] = include "$civicrm_root/ang/ngRoute.ang.php";
$angularModules['ngSanitize'] = include "$civicrm_root/ang/ngSanitize.ang.php";
$angularModules['ui.utils'] = include "$civicrm_root/ang/ui.utils.ang.php";
$angularModules['ui.sortable'] = include "$civicrm_root/ang/ui.sortable.ang.php";
$angularModules['unsavedChanges'] = include "$civicrm_root/ang/unsavedChanges.ang.php";
$angularModules['statuspage'] = include "$civicrm_root/ang/crmStatusPage.ang.php";
foreach (\CRM_Core_Component::getEnabledComponents() as $component) {
$angularModules = array_merge($angularModules, $component->getAngularModules());
......
<?php
// This file declares an Angular module which can be autoloaded
// in CiviCRM. See also:
// http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_angularModules
return array(
'ext' => 'civicrm',
'js' => array('bower_components/angular-file-upload/angular-file-upload.min.js'),
);
<?php
// This file declares an Angular module which can be autoloaded
// in CiviCRM. See also:
// http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_angularModules
return array(
'ext' => 'civicrm',
'js' => array('ang/crmApp.js'),
);
<?php
// This file declares an Angular module which can be autoloaded
// in CiviCRM. See also:
// http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_angularModules
return array(
'ext' => 'civicrm',
'js' => array('ang/crmAttachment.js'),
'css' => array('ang/crmAttachment.css'),
'partials' => array('ang/crmAttachment'),
'settings' => array(
'token' => \CRM_Core_Page_AJAX_Attachment::createToken(),
),
);
<?php
// This file declares an Angular module which can be autoloaded
// in CiviCRM. See also:
// http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_angularModules
return array(
'ext' => 'civicrm',
'js' => array('ang/crmAutosave.js'),
);
<?php
// This file declares an Angular module which can be autoloaded
// in CiviCRM. See also:
// http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_angularModules
// ODDITY: This only loads if CiviCase is active.
CRM_Core_Resources::singleton()->addSetting(array(
'crmCaseType' => array(
'REL_TYPE_CNAME' => CRM_Case_XMLProcessor::REL_TYPE_CNAME,
),
));
return array(
'ext' => 'civicrm',
'js' => array('ang/crmCaseType.js'),
'css' => array('ang/crmCaseType.css'),
'partials' => array('ang/crmCaseType'),
);
<?php
// This file declares an Angular module which can be autoloaded
// in CiviCRM. See also:
// http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_angularModules
return array(
'ext' => 'civicrm',
'js' => array('ang/crmCxn.js', 'ang/crmCxn/*.js'),
'css' => array('ang/crmCxn.css'),
'partials' => array('ang/crmCxn'),
);
<?php
// This file declares an Angular module which can be autoloaded
// in CiviCRM. See also:
// http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_angularModules
// ODDITY: Only loads if you have CiviMail permissions.
// ODDITY: Extra resources loaded via CRM_Mailing_Info::getAngularModules.
return array(
'ext' => 'civicrm',
'js' => array(
'ang/crmD3.js',
'bower_components/d3/d3.min.js',
),
);
<?php
// This file declares an Angular module which can be autoloaded
// in CiviCRM. See also:
// http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_angularModules
return array(
'ext' => 'civicrm',
'js' => array('ang/crmExample.js'),
'partials' => array('ang/crmExample'),
);
<?php
// This file declares an Angular module which can be autoloaded
// in CiviCRM. See also:
// http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_angularModules
// ODDITY: Only loads if you have CiviMail permissions.
// ODDITY: Extra resources loaded via CRM_Mailing_Info::getAngularModules.
return array(
'ext' => 'civicrm',
'js' => array(
'ang/crmMailing.js',
'ang/crmMailing/*.js',
),
'css' => array('ang/crmMailing.css'),
'partials' => array('ang/crmMailing'),
);
<?php
// This file declares an Angular module which can be autoloaded
// in CiviCRM. See also:
// http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_angularModules
// ODDITY: Only loads if you have CiviMail permissions.
// ODDITY: Extra resources loaded via CRM_Mailing_Info::getAngularModules.
return array(
'ext' => 'civicrm',
'js' => array(
'ang/crmMailingAB.js',
'ang/crmMailingAB/*.js',
'ang/crmMailingAB/*/*.js',
),
'css' => array('ang/crmMailingAB.css'),
'partials' => array('ang/crmMailingAB'),
);
<?php
// This file declares an Angular module which can be autoloaded
// in CiviCRM. See also:
// http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_angularModules
return array(
'ext' => 'civicrm',
// 'js' => array('js/angular-crmResource/byModule.js'), // One HTTP request per module.
'js' => array('js/angular-crmResource/all.js'), // One HTTP request for all modules.
);
<?php
// This file declares an Angular module which can be autoloaded
// in CiviCRM. See also:
// http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_angularModules
// ODDITY: Angular name 'statuspage' doesn't match the file name 'crmStatusPage'.
return array(
'ext' => 'civicrm',
'js' => array('ang/crmStatusPage.js', 'ang/crmStatusPage/*.js'),
'css' => array('ang/crmStatusPage.css'),
'partials' => array('ang/crmStatusPage'),
'settings' => array(),
);
<?php
// This file declares an Angular module which can be autoloaded
// in CiviCRM. See also:
// http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_angularModules
return array(
'ext' => 'civicrm',
'js' => array('ang/crmUi.js'),
'partials' => array('ang/crmUi'),
);
<?php
// This file declares an Angular module which can be autoloaded
// in CiviCRM. See also:
// http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_angularModules
return array(
'ext' => 'civicrm',
'js' => array('ang/crmUtil.js'),
);
<?php
// This file declares an Angular module which can be autoloaded
// in CiviCRM. See also:
// http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_angularModules
// https://github.com/jwstadler/angular-jquery-dialog-service
return array(
'ext' => 'civicrm',
'js' => array('bower_components/angular-jquery-dialog-service/dialog-service.js'),
);
<?php
// This file declares an Angular module which can be autoloaded
// in CiviCRM. See also:
// http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_angularModules
return array(
'ext' => 'civicrm',
'js' => array('bower_components/angular-route/angular-route.min.js'),
);
<?php
// This file declares an Angular module which can be autoloaded
// in CiviCRM. See also:
// http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_angularModules
return array(
'ext' => 'civicrm',
'js' => array('bower_components/angular-sanitize/angular-sanitize.min.js'),
);
<?php
// This file declares an Angular module which can be autoloaded
// in CiviCRM. See also:
// http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_angularModules
return array(
'ext' => 'civicrm',
'js' => array('bower_components/angular-ui-sortable/sortable.min.js'),
);
<?php
// This file declares an Angular module which can be autoloaded
// in CiviCRM. See also:
// http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_angularModules
return array(
'ext' => 'civicrm',
'js' => array('bower_components/angular-ui-utils/ui-utils.min.js'),
);
<?php
// This file declares an Angular module which can be autoloaded
// in CiviCRM. See also:
// http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_angularModules
return array(
'ext' => 'civicrm',
'js' => array('bower_components/angular-unsavedChanges/dist/unsavedChanges.min.js'),
);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment