Add member system fields to ListView (#14069)

* Add member system fields to ListView

* Small fix

* Add sort options for new systemfield for members.

---------

Co-authored-by: Lucas Bach Bisgaard <lom@novicell.dk>
This commit is contained in:
Lucas Bach Bisgaard
2023-04-28 16:37:22 +02:00
committed by GitHub
parent 0765a2ebbb
commit 2aa9ceab1a
6 changed files with 107 additions and 43 deletions

View File

@@ -10,42 +10,26 @@ function includePropsPreValsController($rootScope, $scope, localizationService,
$scope.propertyAliases = [];
$scope.selectedField = null;
$scope.systemFields = [
{ value: "sortOrder" },
{ value: "updateDate" },
{ value: "updater" },
{ value: "createDate" },
{ value: "owner" },
{ value: "published"},
{ value: "contentTypeAlias" },
{ value: "email" },
{ value: "username" }
{ value: "sortOrder", localizedKey: "general_sort" },
{ value: "updateDate", localizedKey: "content_updateDate" },
{ value: "updater", localizedKey: "content_updatedBy" },
{ value: "createDate", localizedKey: "content_createDate" },
{ value: "owner", localizedKey: "content_createBy" },
{ value: "published", localizedKey: "content_isPublished" },
{ value: "contentTypeAlias", localizedKey: "content_documentType" },
{ value: "email", localizedKey: "general_email" },
{ value: "username", localizedKey: "general_username" },
{ value: "failedPasswordAttempts", localizedKey: "user_failedPasswordAttempts" },
{ value: "approved", localizedKey: "user_stateApproved" },
{ value: "lockedOut", localizedKey: "user_stateLockedOut" },
{ value: "lastLockoutDate", localizedKey: "user_lastLockoutDate" },
{ value: "lastLoginDate", localizedKey: "user_lastLogin" },
{ value: "lastPasswordChangeDate", localizedKey: "user_lastPasswordChangeDate" }
];
$scope.getLocalizedKey = function(alias) {
switch (alias) {
case "name":
return "general_name";
case "sortOrder":
return "general_sort";
case "updateDate":
return "content_updateDate";
case "updater":
return "content_updatedBy";
case "createDate":
return "content_createDate";
case "owner":
return "content_createBy";
case "published":
return "content_isPublished";
case "contentTypeAlias":
//NOTE: This will just be 'Document' type even if it's for media/members since this is just a pre-val editor and we don't have a key for 'Content Type Alias'
return "content_documentType";
case "email":
return "general_email";
case "username":
return "general_username";
}
return alias;
$scope.getLocalizedKey = function (alias) {
const translationKey = $scope.systemFields.find(x => x.value === alias)?.localizedKey;
return translationKey !== undefined ? translationKey : alias;
}
$scope.changeField = function () {
@@ -65,16 +49,18 @@ function includePropsPreValsController($rootScope, $scope, localizationService,
e.name = v;
switch (e.value) {
case "published":
case "updater":
e.name += " (Content only)";
break;
case "published":
e.name += " (Content only)";
break;
case "email":
e.name += " (Members only)";
break;
case "username":
case "email":
case "failedPasswordAttempts":
case "approved":
case "lockedOut":
case "lastLockoutDate":
case "lastLoginDate":
case "lastPasswordChangeDate":
e.name += " (Members only)";
break;
}
@@ -174,4 +160,4 @@ function includePropsPreValsController($rootScope, $scope, localizationService,
}
angular.module("umbraco").controller("Umbraco.PrevalueEditors.IncludePropertiesListViewController", includePropsPreValsController);
angular.module("umbraco").controller("Umbraco.PrevalueEditors.IncludePropertiesListViewController", includePropsPreValsController);

View File

@@ -213,7 +213,13 @@ function listViewController($scope, $interpolate, $routeParams, $injector, $time
e.alias === "email" ||
e.alias === "updateDate" ||
e.alias === "createDate" ||
e.alias === "contentTypeAlias";
e.alias === "contentTypeAlias" ||
e.alias === "failedPasswordAttempts" ||
e.alias === "approved" ||
e.alias === "lockedOut" ||
e.alias === "lastLockoutDate" ||
e.alias === "lastLoginDate" ||
e.alias === "lastPasswordChangeDate";
}
if (e.isSystem) {
@@ -815,6 +821,18 @@ function listViewController($scope, $interpolate, $routeParams, $injector, $time
return "general_email";
case "username":
return "general_username";
case "failedPasswordAttempts":
return "user_failedPasswordAttempts";
case "approved":
return "user_stateApproved";
case "lockedOut":
return "user_stateLockedOut";
case "lastLockoutDate":
return "user_lastLockoutDate";
case "lastLoginDate":
return "user_lastLogin";
case "lastPasswordChangeDate":
return "user_lastPasswordChangeDate";
}
return alias;
}

View File

@@ -53,7 +53,13 @@ function sortByPreValsController($rootScope, $scope, localizationService, editor
{ value: "ContentTypeAlias", key: "content_documentType" },
{ value: "Published", key: "content_isPublished" },
{ value: "Email", key: "general_email" },
{ value: "Username", key: "general_username" }
{ value: "Username", key: "general_username" },
{ value: "failedPasswordAttempts", key: "user_failedPasswordAttempts" },
{ value: "approved", key: "user_stateApproved" },
{ value: "lockedOut", key: "user_stateLockedOut" },
{ value: "lastLockoutDate", key: "user_lastLockoutDate" },
{ value: "lastLoginDate", key: "user_lastLogin" },
{ value: "lastPasswordChangeDate", key: "user_lastPasswordChangeDate" }
];
_.each(systemFields, function (e) {
localizationService.localize(e.key).then(function (v) {