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:
@@ -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)
|
||||
|
||||
+4
-2
@@ -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") {
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -334,7 +334,7 @@ namespace Umbraco.Web.Models.Mapping
|
||||
else if (group.StartMediaId == -1)
|
||||
{
|
||||
//create the root node
|
||||
display.MediaStartNode = RootNode();
|
||||
display.MediaStartNode = RootNode("Media Root", "icon-picture");
|
||||
}
|
||||
|
||||
if (group.StartContentId > 0)
|
||||
@@ -345,7 +345,7 @@ namespace Umbraco.Web.Models.Mapping
|
||||
else if (group.StartContentId == -1)
|
||||
{
|
||||
//create the root node
|
||||
display.ContentStartNode = RootNode();
|
||||
display.ContentStartNode = RootNode("Content Root", "icon-document");
|
||||
}
|
||||
|
||||
if (display.Icon.IsNullOrWhiteSpace())
|
||||
@@ -354,13 +354,13 @@ namespace Umbraco.Web.Models.Mapping
|
||||
}
|
||||
}
|
||||
|
||||
private EntityBasic RootNode()
|
||||
private EntityBasic RootNode(string name, string icon)
|
||||
{
|
||||
return new EntityBasic
|
||||
{
|
||||
Name = "ROOT",
|
||||
Name = name,
|
||||
Path = "-1",
|
||||
Icon = "icon-document",
|
||||
Icon = icon,
|
||||
Id = -1,
|
||||
Trashed = false,
|
||||
ParentId = -1
|
||||
|
||||
Reference in New Issue
Block a user