Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Daniel B Christensen 15 posts 115 karma points
    Aug 09, 2017 @ 11:13
    Daniel B Christensen
    0

    Custom Property Editor no unsaved changes

    Hi, I have created a custom property editor and included it on a document type.

    All in all the property editor works as intended. However for some reason when I have modified the value of the property editor and not saved the changes, I don't get the unsaved changes warning when I try to move to another content node.

    Below is the controller used for the property editor.

    angular.module("umbraco").controller("ModulePermissionsController", ["$scope", "dialogService",
    function ($scope, dialogService) {
        "use strict";
    
        $scope.model.value = $scope.model.value || [];
    
        $scope.remove = function (index) {
            if (confirm("Are you sure you want to delete the permissions for " + $scope.model.value[index].RoleGroupDisplayName)) {
                $scope.model.value.splice(index, 1);
            }
        }
    
        $scope.editModulePermissions = function (index) {
            dialogService.open({
                template: "/App_Plugins/BackOffice/PropertyEditors/ModulePermissions/Modals/AddModulePermissions.html",
                show: true,
                dialogData: angular.copy($scope.model.value[index]),
                callback: function (e) {
                    // set model
                    $scope.model.value[index] = e;
                    // close dialog
                    dialogService.close();
                }
            });
        }
    
        $scope.selectModulePermissions = function () {
            dialogService.open({
                template: "/App_Plugins/BackOffice/PropertyEditors/ModulePermissions/Modals/AddModulePermissions.html",
                show: true,
                dialogData: null,
                callback: function (e) {
                    // set model
                    $scope.model.value = $scope.model.value.concat(e);
                    // close dialog
                    dialogService.close();
                }
            });
        }
    }
    

    ]);

Please Sign in or register to post replies

Write your reply to:

Draft