Add Member Content App to display membership properties
This commit is contained in:
@@ -269,51 +269,37 @@
|
||||
|
||||
/** formats the display model used to display the member to the model used to save the member */
|
||||
formatMemberPostData: function (displayModel, action) {
|
||||
//this is basically the same as for media but we need to explicitly add the username,email, password to the save model
|
||||
//this is basically the same as for media but we need to explicitly add the username, email, password to the save model
|
||||
|
||||
var saveModel = this.formatMediaPostData(displayModel, action);
|
||||
|
||||
saveModel.key = displayModel.key;
|
||||
|
||||
var genericTab = _.find(displayModel.tabs, function (item) {
|
||||
return item.id === 0;
|
||||
});
|
||||
|
||||
//map the member login, email, password and groups
|
||||
var propLogin = _.find(genericTab.properties, function (item) {
|
||||
return item.alias === "_umb_login";
|
||||
});
|
||||
var propEmail = _.find(genericTab.properties, function (item) {
|
||||
return item.alias === "_umb_email";
|
||||
});
|
||||
var propPass = _.find(genericTab.properties, function (item) {
|
||||
return item.alias === "_umb_password";
|
||||
});
|
||||
var propGroups = _.find(genericTab.properties, function (item) {
|
||||
return item.alias === "_umb_membergroup";
|
||||
});
|
||||
saveModel.email = propEmail.value.trim();
|
||||
saveModel.username = propLogin.value.trim();
|
||||
|
||||
saveModel.password = this.formatChangePasswordModel(propPass.value);
|
||||
|
||||
var selectedGroups = [];
|
||||
for (var n in propGroups.value) {
|
||||
if (propGroups.value[n] === true) {
|
||||
selectedGroups.push(n);
|
||||
// Map membership properties
|
||||
_.each(displayModel.membershipProperties, prop => {
|
||||
switch (prop.alias) {
|
||||
case '_umb_login':
|
||||
saveModel.username = prop.value.trim();
|
||||
break;
|
||||
case '_umb_email':
|
||||
saveModel.email = prop.value.trim();
|
||||
break;
|
||||
case '_umb_password':
|
||||
saveModel.password = this.formatChangePasswordModel(prop.value);
|
||||
break;
|
||||
case '_umb_membergroup':
|
||||
saveModel.memberGroups = _.keys(_.pick(prop.value, value => value === true));
|
||||
break;
|
||||
}
|
||||
}
|
||||
saveModel.memberGroups = selectedGroups;
|
||||
});
|
||||
|
||||
//turn the dictionary into an array of pairs
|
||||
// Map custom member provider properties
|
||||
var memberProviderPropAliases = _.pairs(displayModel.fieldConfig);
|
||||
_.each(displayModel.tabs, function (tab) {
|
||||
_.each(tab.properties, function (prop) {
|
||||
var foundAlias = _.find(memberProviderPropAliases, function (item) {
|
||||
return prop.alias === item[1];
|
||||
});
|
||||
_.each(displayModel.tabs, tab => {
|
||||
_.each(tab.properties, prop => {
|
||||
var foundAlias = _.find(memberProviderPropAliases, item => prop.alias === item[1]);
|
||||
if (foundAlias) {
|
||||
//we know the current property matches an alias, now we need to determine which membership provider property it was for
|
||||
// we know the current property matches an alias, now we need to determine which membership provider property it was for
|
||||
// by looking at the key
|
||||
switch (foundAlias[0]) {
|
||||
case "umbracoMemberLockedOut":
|
||||
@@ -330,8 +316,6 @@
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
return saveModel;
|
||||
},
|
||||
|
||||
|
||||
@@ -1,18 +1,6 @@
|
||||
<div class="umb-package-details">
|
||||
<div class="umb-package-details__main-content">
|
||||
|
||||
<umb-box data-element="node-info-membership" ng-repeat="group in node.tabs| filter: {properties:{view:'readonlyvalue'}} track by group.id">
|
||||
|
||||
<div class="umb-group-panel__header">
|
||||
<div>{{ group.label }}</div>
|
||||
</div>
|
||||
<div class="umb-group-panel__content">
|
||||
<umb-property data-element="property-{{group.alias}}" ng-repeat="property in group.properties | filter: {view:'readonlyvalue'} track by property.alias" property="property">
|
||||
<umb-property-editor model="property"></umb-property-editor>
|
||||
</umb-property>
|
||||
</div>
|
||||
</umb-box>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="umb-package-details__sidebar">
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<div class="umb-package-details">
|
||||
<div class="umb-package-details__main-content">
|
||||
|
||||
<umb-box>
|
||||
<umb-box-header title-key="content_membergroup"></umb-box-header>
|
||||
<umb-box-content class="block-form">
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
vm.activeTabAlias = null;
|
||||
|
||||
vm.setActiveTab = setActiveTab;
|
||||
vm.hideSystemProperties = hideSystemProperties;
|
||||
|
||||
$scope.$watchCollection('content.tabs', (newValue) => {
|
||||
|
||||
@@ -33,15 +32,6 @@
|
||||
vm.tabs.forEach(tab => tab.active = false);
|
||||
tab.active = true;
|
||||
}
|
||||
|
||||
function hideSystemProperties (property) {
|
||||
// hide some specific, known properties by alias
|
||||
if (property.alias === "_umb_id" || property.alias === "_umb_doctype") {
|
||||
return false;
|
||||
}
|
||||
// hide all label properties with the alias prefix "umbracoMember" (e.g. "umbracoMemberFailedPasswordAttempts")
|
||||
return property.view !== "readonlyvalue" || property.alias.startsWith('umbracoMember') === false;
|
||||
}
|
||||
}
|
||||
|
||||
angular.module("umbraco").controller("Umbraco.Editors.Member.Apps.ContentController", MemberAppContentController);
|
||||
|
||||
@@ -6,38 +6,21 @@
|
||||
|
||||
<umb-box ng-repeat="tab in vm.tabs track by tab.key" ng-show="tab.alias === vm.activeTabAlias && tab.properties.length > 0">
|
||||
<umb-box-content data-element="tab-content-{{tab.alias}}">
|
||||
<umb-property
|
||||
data-element="property-{{property.alias}}"
|
||||
ng-repeat="property in tab.properties track by property.alias"
|
||||
property="property">
|
||||
|
||||
<umb-property-editor model="property"></umb-property-editor>
|
||||
|
||||
<umb-property data-element="property-{{property.alias}}" ng-repeat="property in tab.properties track by property.alias" property="property">
|
||||
<umb-property-editor model="property"></umb-property-editor>
|
||||
</umb-property>
|
||||
</umb-box-content>
|
||||
</umb-box>
|
||||
|
||||
<div
|
||||
class="umb-group-panel"
|
||||
data-element="group-{{group.alias}}"
|
||||
ng-repeat="group in content.tabs"
|
||||
ng-if="group.type === 0"
|
||||
ng-show="group.parentAlias === vm.activeTabAlias || vm.tabs.length === 0">
|
||||
|
||||
<div class="umb-group-panel" data-element="group-{{group.alias}}" ng-repeat="group in content.tabs" ng-if="group.type === 0" ng-show="group.parentAlias === vm.activeTabAlias || vm.tabs.length === 0">
|
||||
<div class="umb-group-panel__header">
|
||||
<div>{{ group.label }}</div>
|
||||
</div>
|
||||
|
||||
<div class="umb-group-panel__content" data-element="tab-content-{{group.type === 0 ? group.parentAlias : group.alias}}">
|
||||
<umb-property
|
||||
data-element="property-{{group.alias}}"
|
||||
ng-repeat="property in group.properties | filter:vm.hideSystemProperties track by property.alias"
|
||||
property="property">
|
||||
|
||||
<umb-property data-element="property-{{group.alias}}" ng-repeat="property in group.properties track by property.alias" property="property">
|
||||
<umb-property-editor model="property"></umb-property-editor>
|
||||
</umb-property>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<umb-box data-element="node-membership" class="form-horizontal">
|
||||
<umb-box-content>
|
||||
<umb-property ng-repeat="property in content.membershipProperties track by property.alias" property="property">
|
||||
<umb-property-editor model="property"></umb-property-editor>
|
||||
</umb-property>
|
||||
</umb-box-content>
|
||||
</umb-box>
|
||||
Reference in New Issue
Block a user