Skip to content

Commit

Permalink
Remove usages of angular.forEach in help drawer, content and infinite…
Browse files Browse the repository at this point in the history
… editors (#8544)
  • Loading branch information
Kenn Jacobsen authored Jul 31, 2020
1 parent 08f177b commit 34ea86a
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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++;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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);
Expand All @@ -77,7 +77,7 @@
}

function setSectionIcon(sections) {
angular.forEach(sections, function(section) {
sections.forEach(function(section) {
section.icon = "icon-section";
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
});
});
Expand Down

0 comments on commit 34ea86a

Please sign in to comment.