Ability to select root node in user group picker so the user group can explicitly allow root access or not.

This commit is contained in:
Shannon
2017-07-17 19:40:45 +10:00
parent e135291980
commit d1d74203ea
5 changed files with 26 additions and 11 deletions

View File

@@ -23,6 +23,10 @@ function mediaTypeHelper(mediaTypeResource, $q) {
getAllowedImagetypes: function (mediaId){
//TODO: This is horribly inneficient - why make one request per type!?
//This should make a call to c# to get exactly what it's looking for instead of returning every single media type and doing
//some filtering on the client side.
//This is also called multiple times when it's not needed! Example, when launching the media picker, this will be called twice
//which means we'll be making at least 6 REST calls to fetch each media type
// Get All allowedTypes
return mediaTypeResource.getAllowedTypes(mediaId)

View File

@@ -9,7 +9,7 @@ angular.module("umbraco").controller("Umbraco.Overlays.TreePickerController",
$scope.section = dialogOptions.section;
$scope.treeAlias = dialogOptions.treeAlias;
$scope.multiPicker = dialogOptions.multiPicker;
$scope.hideHeader = true;
$scope.hideHeader = (typeof dialogOptions.hideHeader) === "boolean" ? dialogOptions.hideHeader : false;
// if you need to load a not initialized tree set this value to false - default is true
$scope.onlyInitialized = dialogOptions.onlyInitialized;
$scope.searchInfo = {
@@ -28,7 +28,9 @@ angular.module("umbraco").controller("Umbraco.Overlays.TreePickerController",
$scope.emptyStateMessage = dialogOptions.emptyStateMessage;
//TODO: I don't think this is used or called anywhere!!
//This is called from ng-init
//it turns out it is called from the angular html : / Have a look at views/common / overlays / contentpicker / contentpicker.html you'll see ng-init.
//this is probably an anti pattern IMO and shouldn't be used
$scope.init = function (contentType) {
if (contentType === "content") {

View File

@@ -16,16 +16,16 @@
<div class="umb-user-group-preview__permission">
<span>
<span class="bold">Content start node:</span>
<span ng-if="contentStartNode">{{ contentStartNode.name }}</span>
<span ng-if="!contentStartNode">Content root</span>
<span ng-if="contentStartNode != -1">{{ contentStartNode.name }}</span>
<span ng-if="contentStartNode == -1">Content root</span>
</span>
</div>
<div class="umb-user-group-preview__permission">
<span>
<span class="bold">Media start node:</span>
<span ng-if="mediaStartNode">{{ mediaStartNode.name }}</span>
<span ng-if="!mediaStartNode">Media root</span>
<span ng-if="mediaStartNode != -1">{{ mediaStartNode.name }}</span>
<span ng-if="mediaStartNode == -1">Media root</span>
</span>
</div>

View File

@@ -105,10 +105,15 @@
title: "Select content start node",
view: "contentpicker",
hideSubmitButton: true,
hideHeader: false,
show: true,
submit: function (model) {
if (model.selection) {
vm.userGroup.contentStartNode = model.selection[0];
if (vm.userGroup.contentStartNode.id === "-1") {
vm.userGroup.contentStartNode.name = "Content Root";
vm.userGroup.contentStartNode.icon = "icon-document";
}
}
vm.contentPicker.show = false;
vm.contentPicker = null;
@@ -132,6 +137,10 @@
submit: function (model) {
if (model.selection) {
vm.userGroup.mediaStartNode = model.selection[0];
if (vm.userGroup.mediaStartNode.id === "-1") {
vm.userGroup.mediaStartNode.name = "Media Root";
vm.userGroup.mediaStartNode.icon = "icon-picture";
}
}
vm.contentPicker.show = false;
vm.contentPicker = null;