Show open button for media and member in MNTP (#8476)
This commit is contained in:
committed by
GitHub
parent
add1a99cc4
commit
81346f8fb3
@@ -44,6 +44,10 @@
|
||||
color: @black;
|
||||
}
|
||||
|
||||
.umb-minilistview {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Animations */
|
||||
.umb-mini-list-view.ng-animate {
|
||||
transition: 120ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all;
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
action="close()"
|
||||
button-style="link"
|
||||
label-key="general_close"
|
||||
shortcut="esc"
|
||||
type="button">
|
||||
</umb-button>
|
||||
|
||||
|
||||
+56
-12
@@ -3,16 +3,19 @@
|
||||
* The controller that is used for a couple different Property Editors: Multi Node Tree Picker, Content Picker,
|
||||
* since this is used by MNTP and it supports content, media and members, there is code to deal with all 3 of those types
|
||||
* @param {any} $scope
|
||||
* @param {any} $q
|
||||
* @param {any} $routeParams
|
||||
* @param {any} $location
|
||||
* @param {any} entityResource
|
||||
* @param {any} editorState
|
||||
* @param {any} iconHelper
|
||||
* @param {any} $routeParams
|
||||
* @param {any} angularHelper
|
||||
* @param {any} navigationService
|
||||
* @param {any} $location
|
||||
* @param {any} localizationService
|
||||
* @param {any} editorService
|
||||
* @param {any} userService
|
||||
*/
|
||||
function contentPickerController($scope, entityResource, editorState, iconHelper, $routeParams, angularHelper, navigationService, $location, localizationService, editorService, $q) {
|
||||
function contentPickerController($scope, $q, $routeParams, $location, entityResource, editorState, iconHelper, angularHelper, navigationService, localizationService, editorService, userService) {
|
||||
|
||||
var vm = {
|
||||
labels: {
|
||||
@@ -139,7 +142,8 @@ function contentPickerController($scope, entityResource, editorState, iconHelper
|
||||
: $scope.model.config.startNode.type === "media"
|
||||
? "Media"
|
||||
: "Document";
|
||||
$scope.allowOpenButton = entityType === "Document";
|
||||
|
||||
$scope.allowOpenButton = false;
|
||||
$scope.allowEditButton = entityType === "Document";
|
||||
$scope.allowRemoveButton = true;
|
||||
|
||||
@@ -303,16 +307,24 @@ function contentPickerController($scope, entityResource, editorState, iconHelper
|
||||
$scope.model.value = null;
|
||||
};
|
||||
|
||||
$scope.openContentEditor = function (node) {
|
||||
var contentEditor = {
|
||||
id: node.id,
|
||||
$scope.openEditor = function (item) {
|
||||
var editor = {
|
||||
id: entityType === "Member" ? item.key : item.id,
|
||||
submit: function (model) {
|
||||
|
||||
var node = entityType === "Member" ? model.memberNode :
|
||||
entityType === "Media" ? model.mediaNode :
|
||||
model.contentNode;
|
||||
|
||||
// update the node
|
||||
node.name = model.contentNode.name;
|
||||
node.published = model.contentNode.hasPublishedVersion;
|
||||
item.name = node.name;
|
||||
|
||||
if (entityType !== "Member") {
|
||||
entityResource.getUrl(model.contentNode.id, entityType).then(function (data) {
|
||||
node.url = data;
|
||||
if (entityType === "Document") {
|
||||
item.published = node.hasPublishedVersion;
|
||||
}
|
||||
entityResource.getUrl(node.id, entityType).then(function (data) {
|
||||
item.url = data;
|
||||
});
|
||||
}
|
||||
editorService.close();
|
||||
@@ -321,7 +333,18 @@ function contentPickerController($scope, entityResource, editorState, iconHelper
|
||||
editorService.close();
|
||||
}
|
||||
};
|
||||
editorService.contentEditor(contentEditor);
|
||||
|
||||
switch (entityType) {
|
||||
case "Document":
|
||||
editorService.contentEditor(editor);
|
||||
break;
|
||||
case "Media":
|
||||
editorService.mediaEditor(editor);
|
||||
break;
|
||||
case "Member":
|
||||
editorService.memberEditor(editor);
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
//when the scope is destroyed we need to unsubscribe
|
||||
@@ -466,6 +489,7 @@ function contentPickerController($scope, entityResource, editorState, iconHelper
|
||||
"icon": item.icon,
|
||||
"path": item.path,
|
||||
"url": item.url,
|
||||
"key": item.key,
|
||||
"trashed": item.trashed,
|
||||
"published": (item.metaData && item.metaData.IsPublished === false && entityType === "Document") ? false : true
|
||||
// only content supports published/unpublished content so we set everything else to published so the UI looks correct
|
||||
@@ -484,6 +508,26 @@ function contentPickerController($scope, entityResource, editorState, iconHelper
|
||||
}
|
||||
|
||||
function init() {
|
||||
|
||||
userService.getCurrentUser().then(function (user) {
|
||||
switch (entityType) {
|
||||
case "Document":
|
||||
var hasAccessToContent = user.allowedSections.indexOf("content") !== -1;
|
||||
$scope.allowOpenButton = hasAccessToContent;
|
||||
break;
|
||||
case "Media":
|
||||
var hasAccessToMedia = user.allowedSections.indexOf("media") !== -1;
|
||||
$scope.allowOpenButton = hasAccessToMedia;
|
||||
break;
|
||||
case "Member":
|
||||
var hasAccessToMember = user.allowedSections.indexOf("member") !== -1;
|
||||
$scope.allowOpenButton = hasAccessToMember;
|
||||
break;
|
||||
|
||||
default:
|
||||
}
|
||||
});
|
||||
|
||||
localizationService.localizeMany(["general_recycleBin", "general_add"])
|
||||
.then(function(data) {
|
||||
vm.labels.general_recycleBin = data[0];
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
allow-remove="allowRemoveButton"
|
||||
allow-open="model.config.showOpenButton && allowOpenButton && !dialogEditor"
|
||||
on-remove="remove($index)"
|
||||
on-open="openContentEditor(node)">
|
||||
on-open="openEditor(node)">
|
||||
</umb-node-preview>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user