enables infinite editing for members
This commit is contained in:
committed by
Sebastiaan Janssen
parent
ea0dc9d68f
commit
7ad97de848
@@ -48,23 +48,29 @@
|
||||
|
||||
<umb-editor-footer-content-right>
|
||||
|
||||
<umb-button
|
||||
ng-if="page.listViewPath"
|
||||
type="link"
|
||||
href="#{{page.listViewPath}}"
|
||||
button-style="link"
|
||||
label="Return to list"
|
||||
label-key="buttons_returnToList">
|
||||
</umb-button>
|
||||
<umb-button ng-if="page.listViewPath"
|
||||
type="link"
|
||||
href="#{{page.listViewPath}}"
|
||||
button-style="link"
|
||||
label="Return to list"
|
||||
label-key="buttons_returnToList">
|
||||
</umb-button>
|
||||
|
||||
<umb-button
|
||||
type="submit"
|
||||
label="Save"
|
||||
label-key="buttons_save"
|
||||
button-style="success"
|
||||
shortcut="ctrl+s"
|
||||
state="page.saveButtonState">
|
||||
</umb-button>
|
||||
<umb-button ng-if="model.infiniteMode"
|
||||
type="button"
|
||||
button-style="link"
|
||||
label-key="general_close"
|
||||
shortcut="esc"
|
||||
action="model.close(model)">
|
||||
</umb-button>
|
||||
|
||||
<umb-button type="submit"
|
||||
label="Save"
|
||||
label-key="buttons_save"
|
||||
button-style="success"
|
||||
shortcut="ctrl+s"
|
||||
state="page.saveButtonState">
|
||||
</umb-button>
|
||||
|
||||
</umb-editor-footer-content-right>
|
||||
|
||||
|
||||
@@ -8,6 +8,11 @@
|
||||
*/
|
||||
function MemberEditController($scope, $routeParams, $location, appState, memberResource, entityResource, navigationService, notificationsService, localizationService, serverValidationManager, contentEditingHelper, fileManager, formHelper, editorState, umbRequestHelper, $http) {
|
||||
|
||||
var infiniteMode = $scope.model && $scope.model.infiniteMode;
|
||||
var id = infiniteMode ? $scope.model.id : $routeParams.id;
|
||||
var create = infiniteMode ? $scope.model.create : $routeParams.create;
|
||||
var listName = infiniteMode ? $scope.model.listname : $routeParams.listName;
|
||||
|
||||
//setup scope vars
|
||||
$scope.page = {};
|
||||
$scope.page.loading = true;
|
||||
@@ -20,17 +25,17 @@ function MemberEditController($scope, $routeParams, $location, appState, memberR
|
||||
|
||||
//build a path to sync the tree with
|
||||
function buildTreePath(data) {
|
||||
return $routeParams.listName ? "-1," + $routeParams.listName : "-1";
|
||||
return listName ? "-1," + listName : "-1";
|
||||
}
|
||||
|
||||
if ($routeParams.create) {
|
||||
if (create) {
|
||||
|
||||
//if there is no doc type specified then we are going to assume that
|
||||
// we are not using the umbraco membership provider
|
||||
if ($routeParams.doctype) {
|
||||
if (doctype) {
|
||||
|
||||
//we are creating so get an empty member item
|
||||
memberResource.getScaffold($routeParams.doctype)
|
||||
memberResource.getScaffold(doctype)
|
||||
.then(function(data) {
|
||||
|
||||
$scope.content = data;
|
||||
@@ -66,16 +71,16 @@ function MemberEditController($scope, $routeParams, $location, appState, memberR
|
||||
//The reason this might be an INT is due to the routing used for the member list view
|
||||
//but this is now configured to use the key, so this is just a fail safe
|
||||
|
||||
if ($routeParams.id && $routeParams.id.length < 9) {
|
||||
if (id && id.length < 9) {
|
||||
|
||||
entityResource.getById($routeParams.id, "Member").then(function(entity) {
|
||||
entityResource.getById(id, "Member").then(function(entity) {
|
||||
$location.path("/member/member/edit/" + entity.key);
|
||||
});
|
||||
}
|
||||
else {
|
||||
|
||||
//we are editing so get the content item from the server
|
||||
memberResource.getByKey($routeParams.id)
|
||||
memberResource.getByKey(id)
|
||||
.then(function(data) {
|
||||
|
||||
$scope.content = data;
|
||||
@@ -84,11 +89,12 @@ function MemberEditController($scope, $routeParams, $location, appState, memberR
|
||||
|
||||
editorState.set($scope.content);
|
||||
|
||||
var path = buildTreePath(data);
|
||||
|
||||
//sync the tree (only for ui purposes)
|
||||
navigationService.syncTree({ tree: "member", path: path.split(",") });
|
||||
if (!infiniteMode) {
|
||||
var path = buildTreePath(data);
|
||||
|
||||
//sync the tree (only for ui purposes)
|
||||
navigationService.syncTree({ tree: "member", path: path.split(",") });
|
||||
}
|
||||
//it's the initial load of the editor, we need to get the tree node
|
||||
// from the server so that we can load in the actions menu.
|
||||
umbRequestHelper.resourcePromise(
|
||||
@@ -144,7 +150,7 @@ function MemberEditController($scope, $routeParams, $location, appState, memberR
|
||||
passwordProp.value.reset = !passwordProp.value.oldPassword && passwordProp.config.allowManuallyChangingPassword;
|
||||
}
|
||||
|
||||
memberResource.save($scope.content, $routeParams.create, fileManager.getFiles())
|
||||
memberResource.save($scope.content, create, fileManager.getFiles())
|
||||
.then(function(data) {
|
||||
|
||||
formHelper.resetForm({ scope: $scope });
|
||||
@@ -184,12 +190,12 @@ function MemberEditController($scope, $routeParams, $location, appState, memberR
|
||||
};
|
||||
|
||||
$scope.showBack = function () {
|
||||
return !!$routeParams.listName;
|
||||
return !!listName;
|
||||
}
|
||||
|
||||
/** Callback for when user clicks the back-icon */
|
||||
$scope.onBack = function () {
|
||||
$location.path("/member/member/list/" + $routeParams.listName);
|
||||
$location.path("/member/member/list/" + listName);
|
||||
$location.search("listName", null);
|
||||
if ($routeParams.page) {
|
||||
$location.search("page", $routeParams.page);
|
||||
|
||||
Reference in New Issue
Block a user