From 7585cf5beb46010c1214d78845ea4d805370ee03 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Tue, 29 Sep 2020 11:53:30 -0400 Subject: [PATCH] dev/core#1818 Upgrade AngularJS from 1.5.11 to 1.8 https://lab.civicrm.org/dev/core/-/issues/1818 The biggest breaking change between 1.5 and 1.8 was the default hashPrefix. See https://github.com/angular/angular.js/blob/master/CHANGELOG.md#location-due-to-1 Our solution is to force crmApp to use the previous default. This ensures that existing modules which rely on crmApp for routing (which is nearly all of them) will be unaffected. New modules like Afform which use their own routing should use the new default recommended by Angular. --- ang/crmApp.js | 6 ++++++ composer.json | 8 ++++---- composer.lock | 2 +- ext/afform/docs/quickstart.md | 2 +- ext/afform/gui/ang/afGuiList.aff.html | 4 ++-- ext/afform/html/ang/afHtmlEditor.aff.html | 2 +- ext/afform/html/ang/afHtmlList.aff.html | 2 +- js/angular-crmResource/all.js | 7 +++---- 8 files changed, 19 insertions(+), 14 deletions(-) diff --git a/ang/crmApp.js b/ang/crmApp.js index c7bb81e29b..e3baceb971 100644 --- a/ang/crmApp.js +++ b/ang/crmApp.js @@ -3,6 +3,12 @@ // crmApp should not provide any significant services, and no other // modules should depend on it. var crmApp = angular.module('crmApp', CRM.angular.modules); + + // dev/core#1818 use angular 1.5 default of # instead of 1.6+ default of #! + crmApp.config(['$locationProvider', function($locationProvider) { + $locationProvider.hashPrefix(""); + }]); + crmApp.config(['$routeProvider', function($routeProvider) { diff --git a/composer.json b/composer.json index 8d2b9c1e6e..00a283c7e2 100644 --- a/composer.json +++ b/composer.json @@ -125,7 +125,7 @@ "path": "bower_components/{$id}" }, "angular": { - "url": "https://github.com/angular/bower-angular/archive/v1.5.11.zip" + "url": "https://github.com/angular/bower-angular/archive/v1.8.0.zip" }, "angular-bootstrap": { "url": "https://github.com/angular-ui/bootstrap-bower/archive/2.5.0.zip" @@ -138,13 +138,13 @@ "url": "https://github.com/totten/angular-jquery-dialog-service/archive/v0.8.0-civicrm-1.0.zip" }, "angular-mocks": { - "url": "https://github.com/angular/bower-angular-mocks/archive/v1.5.11.zip" + "url": "https://github.com/angular/bower-angular-mocks/archive/v1.8.0.zip" }, "angular-route": { - "url": "https://github.com/angular/bower-angular-route/archive/v1.5.11.zip" + "url": "https://github.com/angular/bower-angular-route/archive/v1.8.0.zip" }, "angular-sanitize": { - "url": "https://github.com/angular/bower-angular-sanitize/archive/v1.5.11.zip" + "url": "https://github.com/angular/bower-angular-sanitize/archive/v1.8.0.zip" }, "angular-ui-sortable": { "url": "https://github.com/angular-ui/ui-sortable/archive/v0.19.0.zip" diff --git a/composer.lock b/composer.lock index ba2584e724..14ceae4a82 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "197ce47c1897c60cbc5ce809f3d5cf14", + "content-hash": "1c717ea7ca80e806702967261c621e3a", "packages": [ { "name": "adrienrn/php-mimetyper", diff --git a/ext/afform/docs/quickstart.md b/ext/afform/docs/quickstart.md index 53000a16d6..37917d7724 100644 --- a/ext/afform/docs/quickstart.md +++ b/ext/afform/docs/quickstart.md @@ -31,7 +31,7 @@ from a local Drupal 7 site: ``` $ cv url "civicrm/hello-world" "http://dmaster.localhost/civicrm/hello-world" -$ cv url "civicrm/hello-world/#/?name=world" +$ cv url "civicrm/hello-world/#!/?name=world" "http://dmaster.localhost/civicrm/hello-world/#/?name=world" ``` diff --git a/ext/afform/gui/ang/afGuiList.aff.html b/ext/afform/gui/ang/afGuiList.aff.html index 763ca8547f..4fe9b37a13 100644 --- a/ext/afform/gui/ang/afGuiList.aff.html +++ b/ext/afform/gui/ang/afGuiList.aff.html @@ -1,4 +1,4 @@ - + {{ ts('New Form') }}
- {{availForm.name}} + {{availForm.name}} {{availForm.title}} diff --git a/ext/afform/html/ang/afHtmlEditor.aff.html b/ext/afform/html/ang/afHtmlEditor.aff.html index 7d474d44e5..0cbca87fd2 100644 --- a/ext/afform/html/ang/afHtmlEditor.aff.html +++ b/ext/afform/html/ang/afHtmlEditor.aff.html @@ -8,7 +8,7 @@
- {{ts('Back')}} + {{ts('Back')}} | {{ts('Save')}} diff --git a/ext/afform/html/ang/afHtmlList.aff.html b/ext/afform/html/ang/afHtmlList.aff.html index 4f70a552bc..ad66cc5790 100644 --- a/ext/afform/html/ang/afHtmlList.aff.html +++ b/ext/afform/html/ang/afHtmlList.aff.html @@ -19,7 +19,7 @@ - {{availForm.name}} + {{availForm.name}} {{availForm.title}} diff --git a/js/angular-crmResource/all.js b/js/angular-crmResource/all.js index e8eca721b5..356a582407 100644 --- a/js/angular-crmResource/all.js +++ b/js/angular-crmResource/all.js @@ -34,9 +34,9 @@ var moduleUrl = CRM.angular.bundleUrl; $http.get(moduleUrl) - .success(function httpSuccess(data) { + .then(function httpSuccess(response) { templates = []; - angular.forEach(data, function(module) { + angular.forEach(response.data, function(module) { if (module.partials) { angular.extend(templates, module.partials); } @@ -45,8 +45,7 @@ } }); notify(); - }) - .error(function httpError() { + }, function httpError() { templates = []; notify(); }); -- 2.25.1