Remove usages of angular.forEach in help drawer, content and infinite editors (#8544)

This commit is contained in:
Kenn Jacobsen
2020-07-31 17:48:45 +02:00
committed by GitHub
parent 08f177bfd8
commit 34ea86a8cb
7 changed files with 22 additions and 24 deletions

View File

@@ -157,8 +157,8 @@
}
function openTourGroup(tourAlias) {
angular.forEach(vm.tours, function (group) {
angular.forEach(group, function (tour) {
vm.tours.forEach(function (group) {
group.tours.forEach(function (tour) {
if (tour.alias === tourAlias) {
group.open = true;
}
@@ -168,9 +168,9 @@
function getTourGroupCompletedPercentage() {
// Finding out, how many tours are completed for the progress circle
angular.forEach(vm.tours, function(group){
vm.tours.forEach(function(group){
var completedTours = 0;
angular.forEach(group.tours, function(tour){
group.tours.forEach(function(tour){
if(tour.completed) {
completedTours++;
}

View File

@@ -202,7 +202,7 @@
var match = false;
// find and show if a match from the list has been chosen
angular.forEach(vm.validationTypes, function (validationType, index) {
vm.validationTypes.forEach(function (validationType, index) {
if ($scope.model.property.validation.pattern === validationType.pattern) {
vm.selectedValidationType = vm.validationTypes[index];
vm.showValidationPattern = true;
@@ -212,7 +212,7 @@
// if there is no match - choose the custom validation option.
if (!match) {
angular.forEach(vm.validationTypes, function (validationType) {
vm.validationTypes.forEach(function (validationType) {
if (validationType.key === "custom") {
vm.selectedValidationType = validationType;
vm.showValidationPattern = true;

View File

@@ -47,8 +47,8 @@
}
function preSelect(selection) {
angular.forEach(selection, function(selected){
angular.forEach(vm.sections, function(section){
selection.forEach(function(selected){
vm.sections.forEach(function(section){
if(selected.alias === section.alias) {
section.selected = true;
}
@@ -65,7 +65,7 @@
} else {
angular.forEach($scope.model.selection, function(selectedSection, index){
$scope.model.selection.forEach(function(selectedSection, index){
if(selectedSection.alias === section.alias) {
section.selected = false;
$scope.model.selection.splice(index, 1);
@@ -77,7 +77,7 @@
}
function setSectionIcon(sections) {
angular.forEach(sections, function(section) {
sections.forEach(function(section) {
section.icon = "icon-section";
});
}

View File

@@ -460,8 +460,7 @@ angular.module("umbraco").controller("Umbraco.Editors.TreePickerController",
? _.filter(nodes, $scope.model.filter)
: _.where(nodes, $scope.model.filter);
angular.forEach(filtered,
function (value, key) {
filtered.forEach(function (value) {
value.filtered = true;
if ($scope.model.filterCssClass) {
if (!value.cssClasses) {
@@ -474,8 +473,7 @@ angular.module("umbraco").controller("Umbraco.Editors.TreePickerController",
}
else {
var a = $scope.model.filter.toLowerCase().replace(/\s/g, '').split(',');
angular.forEach(nodes,
function (value, key) {
nodes.forEach(function (value) {
var found = a.indexOf(value.metaData.contentType.toLowerCase()) >= 0;

View File

@@ -46,9 +46,9 @@
function preSelect(selection) {
angular.forEach(selection, function(selected){
angular.forEach(vm.userGroups, function(userGroup){
selection.forEach(function (selected) {
vm.userGroups.forEach(function(userGroup){
if(selected.id === userGroup.id) {
userGroup.selected = true;
}
@@ -66,7 +66,7 @@
} else {
angular.forEach($scope.model.selection, function(selectedUserGroup, index){
$scope.model.selection.forEach(function(selectedUserGroup, index){
if(selectedUserGroup.id === userGroup.id) {
userGroup.selected = false;
$scope.model.selection.splice(index, 1);

View File

@@ -31,7 +31,7 @@
vm.saveError = false;
vm.saveSuccces = false;
var selectedString = [];
angular.forEach(notifyOptions, function (option) {
notifyOptions.forEach(function (option) {
if (option.checked === true && option.notifyCode) {
selectedString.push(option.notifyCode);
}

View File

@@ -39,7 +39,7 @@
//reset this
vm.selectedUserGroups = [];
vm.availableUserGroups = userGroups;
angular.forEach(vm.availableUserGroups, function (group) {
vm.availableUserGroups.forEach(function (group) {
if (group.permissions) {
//if there's explicit permissions assigned than it's selected
assignGroupPermissions(group);
@@ -70,8 +70,8 @@
group.allowedPermissions = [];
// get list of checked permissions
angular.forEach(group.permissions, function (permissionGroup) {
angular.forEach(permissionGroup, function (permission) {
Object.values(group.permissions).forEach(function (permissionGroup) {
permissionGroup.forEach(function (permission) {
if (permission.checked) {
//the `allowedPermissions` is what will get sent up to the server for saving
group.allowedPermissions.push(permission);
@@ -117,9 +117,9 @@
}
function formatSaveModel(permissionsSave, groupCollection) {
angular.forEach(groupCollection, function (g) {
groupCollection.forEach(function (g) {
permissionsSave[g.id] = [];
angular.forEach(g.allowedPermissions, function (p) {
g.allowedPermissions.forEach(function (p) {
permissionsSave[g.id].push(p.permissionCode);
});
});