Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

vm.$onDestroy = onDestroy;
vm.$onInit = onInit;
vm.$onChanges = onChanges;

function initDropDown() {
keyboardService.bind("esc", vm.close);
Expand Down Expand Up @@ -72,6 +73,25 @@
vm.labels.closeText = values[1];
});
}

function onChanges(simpleChanges) {
if (simpleChanges.actions) {

let actions = simpleChanges.actions.currentValue || [];

Utilities.forEach(actions, action => {

if (action.labelKey) {
localizationService.localize(action.labelKey, (action.labelTokens || []), action.label).then(data => {
action.label = data;
});

action.useLegacyIcon = action.useLegacyIcon === false ? false : true;
action.icon = (action.useLegacyIcon ? 'icon-' : '') + action.icon;
Comment thread
nathanwoulfe marked this conversation as resolved.
}
});
}
}
}

var umbPropertyActionsComponent = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<ul class="umb-contextmenu">
<li ng-repeat="action in vm.actions" role="menuitem" class="umb-contextmenu-item" ng-class="{'-opens-dialog': action.opensDialog}">
<button type="button" class="btn-reset umb-outline" ng-click="vm.executeAction(action)" ng-disabled="action.isDisabled === true">
<umb-icon icon="icon-{{action.icon}}" class="icon"></umb-icon>
<span class="menu-label"><localize key="{{::action.labelKey}}" tokens="action.labelTokens"></localize></span>
<umb-icon icon="{{action.icon}}" class="icon"></umb-icon>
<span class="menu-label">{{::action.label}}</span>
</button>
</li>
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@

var unsubscribe = [];
var modelObject;

// Property actions:
var copyAllBlocksAction = null;
var deleteAllBlocksAction = null;
let copyAllBlocksAction = null;
let deleteAllBlocksAction = null;

var inlineEditing = false;
var liveEditing = true;
Expand Down Expand Up @@ -112,21 +112,23 @@
} else if(vm.umbElementEditorContent && vm.umbElementEditorContent.getScope) {
scopeOfExistence = vm.umbElementEditorContent.getScope();
}

copyAllBlocksAction = {
labelKey: "clipboard_labelForCopyAllEntries",
labelTokens: [vm.model.label],
icon: "documents",
icon: "icon-documents",
method: requestCopyAllBlocks,
isDisabled: true
isDisabled: true,
useLegacyIcon: false
};

deleteAllBlocksAction = {
labelKey: 'clipboard_labelForRemoveAllEntries',
labelKey: "clipboard_labelForRemoveAllEntries",
labelTokens: [],
icon: 'trash',
icon: "icon-trash",
method: requestDeleteAllBlocks,
isDisabled: true
isDisabled: true,
useLegacyIcon: false
};

var propertyActions = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,13 @@ function contentPickerController($scope, $q, $routeParams, $location, entityReso
}
};

var removeAllEntriesAction = {
labelKey: 'clipboard_labelForRemoveAllEntries',
let removeAllEntriesAction = {
labelKey: "clipboard_labelForRemoveAllEntries",
labelTokens: [],
icon: 'trash',
icon: "icon-trash",
method: removeAllEntries,
isDisabled: true
isDisabled: true,
useLegacyIcon: false
};

if ($scope.model.config) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
angular.module('umbraco').controller("Umbraco.PropertyEditors.MediaPickerController",
function ($scope, entityResource, mediaHelper, $timeout, userService, localizationService, editorService, overlayService, clipboardService) {

var vm = this;
const vm = this;

vm.labels = {};
vm.labels.deletedItem = "";
Expand Down Expand Up @@ -341,20 +341,22 @@ angular.module('umbraco').controller("Umbraco.PropertyEditors.MediaPickerControl
});
}

var copyAllEntriesAction = {
labelKey: 'clipboard_labelForCopyAllEntries',
let copyAllEntriesAction = {
labelKey: "clipboard_labelForCopyAllEntries",
labelTokens: ['Media'],
icon: "documents",
icon: "icon-documents",
method: copyAllEntries,
isDisabled: true
isDisabled: true,
useLegacyIcon: false
}

var removeAllEntriesAction = {
labelKey: 'clipboard_labelForRemoveAllEntries',
let removeAllEntriesAction = {
labelKey: "clipboard_labelForRemoveAllEntries",
labelTokens: [],
icon: 'trash',
icon: "icon-trash",
method: removeAllEntries,
isDisabled: true
isDisabled: true,
useLegacyIcon: false
};

if (multiPicker === true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
var unsubscribe = [];

// Property actions:
var copyAllMediasAction = null;
var removeAllMediasAction = null;
let copyAllMediasAction = null;
let removeAllMediasAction = null;

var vm = this;

Expand Down Expand Up @@ -69,17 +69,19 @@
copyAllMediasAction = {
labelKey: "clipboard_labelForCopyAllEntries",
labelTokens: [vm.model.label],
icon: "documents",
icon: "icon-documents",
method: requestCopyAllMedias,
isDisabled: true
isDisabled: true,
useLegacyIcon: false
};

removeAllMediasAction = {
labelKey: 'clipboard_labelForRemoveAllEntries',
labelKey: "clipboard_labelForRemoveAllEntries",
labelTokens: [],
icon: 'trash',
icon: "icon-trash",
method: requestRemoveAllMedia,
isDisabled: true
isDisabled: true,
useLegacyIcon: false
};

var propertyActions = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//with a specified callback, this callback will receive an object with a selection on it
function memberGroupPicker($scope, editorService, memberGroupResource, localizationService, overlayService){

var vm = this;
const vm = this;

vm.openMemberGroupPicker = openMemberGroupPicker;
vm.remove = remove;
Expand All @@ -13,12 +13,13 @@ function memberGroupPicker($scope, editorService, memberGroupResource, localizat
return str.replace(rgxtrim, '');
}

var removeAllEntriesAction = {
labelKey: 'clipboard_labelForRemoveAllEntries',
let removeAllEntriesAction = {
labelKey: "clipboard_labelForRemoveAllEntries",
labelTokens: [],
icon: 'trash',
icon: "icon-trash",
method: removeAllEntries,
isDisabled: true
isDisabled: true,
useLegacyIcon: false
};

$scope.renderModel = [];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,34 @@
function multiUrlPickerController($scope, localizationService, entityResource, iconHelper, editorService) {
function multiUrlPickerController($scope, localizationService, entityResource, iconHelper, editorService, overlayService) {

var vm = {
labels: {
general_recycleBin: ""
}
};

let removeAllEntriesAction = {
labelKey: "clipboard_labelForRemoveAllEntries",
labelTokens: [],
icon: "icon-trash",
method: removeAllEntries,
isDisabled: true,
useLegacyIcon: false
};

$scope.renderModel = [];

if ($scope.preview) {
return;
}

if ($scope.model.config && parseInt($scope.model.config.maxNumber) !== 1 && $scope.umbProperty) {
var propertyActions = [
removeAllEntriesAction
];

$scope.umbProperty.setPropertyActions(propertyActions);
}

if (!Array.isArray($scope.model.value)) {
$scope.model.value = [];
}
Expand Down Expand Up @@ -58,17 +75,26 @@ function multiUrlPickerController($scope, localizationService, entityResource, i
$scope.multiUrlPickerForm.maxCount.$setValidity("maxCount", true);
}
$scope.sortableOptions.disabled = $scope.renderModel.length === 1;

removeAllEntriesAction.isDisabled = $scope.renderModel.length === 0;

//Update value
$scope.model.value = $scope.renderModel;
}
);

$scope.remove = function ($index) {
$scope.renderModel.splice($index, 1);

setDirty();
};

$scope.clear = function ($index) {
$scope.renderModel = [];

setDirty();
};

$scope.openLinkPicker = function (link, $index) {
var target = link ? {
name: link.name,
Expand Down Expand Up @@ -143,6 +169,22 @@ function multiUrlPickerController($scope, localizationService, entityResource, i
}
}

function removeAllEntries() {
localizationService.localizeMany(["content_nestedContentDeleteAllItems", "general_delete"]).then(function (data) {
overlayService.confirmDelete({
title: data[1],
content: data[0],
close: function () {
overlayService.close();
},
submit: function () {
$scope.clear();
overlayService.close();
}
});
});
}

function init() {

localizationService.localizeMany(["general_recycleBin"])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(function () {
(function () {
'use strict';

/**
Expand Down Expand Up @@ -67,7 +67,8 @@

function NestedContentController($scope, $interpolate, $filter, serverValidationManager, contentResource, localizationService, iconHelper, clipboardService, eventsService, overlayService) {

var vm = this;
const vm = this;

var model = $scope.$parent.$parent.model;

var contentTypeAliases = [];
Expand Down Expand Up @@ -135,17 +136,27 @@
});
}

var copyAllEntriesAction = {
labelKey: 'clipboard_labelForCopyAllEntries',
let copyAllEntriesAction = {
labelKey: "clipboard_labelForCopyAllEntries",
labelTokens: [model.label],
icon: 'documents',
icon: "icon-documents",
method: copyAllEntries,
isDisabled: true
}
isDisabled: true,
useLegacyIcon: false
};

let removeAllEntriesAction = {
labelKey: "clipboard_labelForRemoveAllEntries",
labelTokens: [],
icon: "icon-trash",
method: removeAllEntries,
isDisabled: true,
useLegacyIcon: false
};

function removeAllEntries() {

var removeAllEntries = function () {
localizationService.localizeMany(["content_nestedContentDeleteAllItems", "general_delete"]).then(function (data) {
localizationService.localizeMany(["content_nestedContentDeleteAllItems", "general_delete"]).then(data => {
overlayService.confirmDelete({
title: data[1],
content: data[0],
Expand All @@ -161,22 +172,12 @@
});
});
}

var removeAllEntriesAction = {
labelKey: 'clipboard_labelForRemoveAllEntries',
labelTokens: [],
icon: 'trash',
method: removeAllEntries,
isDisabled: true
};


// helper to force the current form into the dirty state
function setDirty() {

if (vm.umbProperty) {
vm.umbProperty.setDirty();
}

};

function addNode(alias) {
Expand Down Expand Up @@ -729,8 +730,6 @@
removeAllEntriesAction.isDisabled = copyAllEntriesAction.isDisabled;
}



var propertyActions = [
copyAllEntriesAction,
removeAllEntriesAction
Expand Down