Skip to content

Commit

Permalink
Merge pull request civicrm#18635 from colemanw/angular-1.8
Browse files Browse the repository at this point in the history
dev/core#1818 Upgrade AngularJS from 1.5.11 to 1.8
  • Loading branch information
seamuslee001 authored Oct 2, 2020
2 parents 729e12b + df00c64 commit 63bb878
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 64 deletions.
6 changes: 6 additions & 0 deletions ang/crmApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ext/afform/docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
```

Expand Down
4 changes: 2 additions & 2 deletions ext/afform/gui/ang/afGuiList.aff.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<a href="#/?name=0" class="btn btn-default">
<a href="#!/?name=0" class="btn btn-default">
<i class="crm-i fa-plus"></i> {{ ts('New Form') }}
</a>
<div
Expand All @@ -22,7 +22,7 @@
<tbody>
<tr ng-repeat="availForm in listCtrl.result">
<td>
<a ng-href="#/?name={{availForm.name}}">{{availForm.name}}</a>
<a ng-href="#!/?name={{availForm.name}}">{{availForm.name}}</a>
</td>
<td>{{availForm.title}}</td>
<td>
Expand Down
2 changes: 1 addition & 1 deletion ext/afform/html/ang/afHtmlEditor.aff.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div crm-ui-debug="resultForm"></div>

<div>
<a ng-href="#/">{{ts('Back')}}</a>
<a ng-href="#!/">{{ts('Back')}}</a>
|
<a af-api4-action="['Afform', 'update', {layoutFormat: 'html', where: [['name', '=', resultForm.name]], values:resultForm}]">{{ts('Save')}}</a>
<span ng-if="resultForm.server_route">
Expand Down
2 changes: 1 addition & 1 deletion ext/afform/html/ang/afHtmlList.aff.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<tbody>
<tr ng-repeat="availForm in listCtrl.result">
<td>
<a ng-href="#/?name={{availForm.name}}">{{availForm.name}}</a>
<a ng-href="#!/?name={{availForm.name}}">{{availForm.name}}</a>
</td>
<td>{{availForm.title}}</td>
<td>
Expand Down
7 changes: 3 additions & 4 deletions js/angular-crmResource/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -45,8 +45,7 @@
}
});
notify();
})
.error(function httpError() {
}, function httpError() {
templates = [];
notify();
});
Expand Down
50 changes: 0 additions & 50 deletions tests/karma/unit/crmCaseTypeSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -726,34 +726,6 @@ describe('crmCaseType', function() {
});
});

describe('crmAddName', function () {
var element;

beforeEach(function() {
scope = $rootScope.$new();
scope.activityTypeOptions = [1, 2, 3];
element = '<span crm-add-name crm-options="activityTypeOptions"></span>';

spyOn(CRM.$.fn, 'crmSelect2').and.callThrough();

element = $compile(element)(scope);
scope.$digest();
});

describe('when initialized', function () {
var returnValue;

beforeEach (function () {
var dataFunction = CRM.$.fn.crmSelect2.calls.argsFor(0)[0].data;
returnValue = dataFunction();
});

it('updates the UI with updated value of scope variable', function () {
expect(returnValue).toEqual({ results: scope.activityTypeOptions });
});
});
});

describe('crmEditableTabTitle', function () {
var element, titleLabel, penIcon, saveButton, cancelButton;

Expand Down Expand Up @@ -1016,28 +988,6 @@ describe('crmCaseType', function() {
});
});

describe('when the case type cannot be delted', function() {
var error = { error_message: 'Error Message' };

beforeEach(function() {
var errorHandler;

crmApiSpy.and.returnValue($q.reject(error));
scope.caseTypes[caseType.id] = caseType;

spyOn(CRM, 'alert');
scope.deleteCaseType(caseType);
scope.$digest();

errorHandler = crmApiSpy.calls.mostRecent().args[3].error;
errorHandler(error);
});

it('displays the error message', function() {
expect(CRM.alert).toHaveBeenCalledWith(error.error_message, 'Error', 'error');
});
});

describe('revertCaseType', function() {
var caseType = {
id: _.uniqueId(),
Expand Down

0 comments on commit 63bb878

Please sign in to comment.