Merge branch 'temp8-packages-ui' of https://github.com/umbraco/Umbraco-CMS into temp8-packages-ui

# Conflicts:
#	src/Umbraco.Web.UI.Client/src/views/packages/edit.controller.js
This commit is contained in:
Warren Buckley
2018-12-05 14:29:32 +00:00
2 changed files with 61 additions and 1 deletions

View File

@@ -19,6 +19,9 @@
vm.removeContentItem = removeContentItem;
vm.openContentPicker = openContentPicker;
vm.openFilePicker = openFilePicker;
vm.removeFile = removeFile;
vm.openControlPicker = openControlPicker;
vm.removeControl = removeControl;
function onInit() {
// load package
@@ -98,9 +101,18 @@
section: "settings",
treeAlias: "files",
entityType: "file",
multiPicker: true,
onlyInitialized: false,
submit: function(model) {
console.log(model.selection);
if(model && model.selection) {
vm.package.files = vm.package.files ? vm.package.files : [];
model.selection.forEach(selected => {
vm.package.files.push(selected);
});
}
editorService.close();
},
close: function() {
@@ -110,6 +122,32 @@
editorService.treePicker(filePicker);
}
function removeFile(index) {
vm.package.files.splice(index, 1);
}
function openControlPicker() {
const controlPicker = {
treeAlias: "files",
section:"settings",
entityType: "file",
submit: function(model) {
if(model.selection && model.selection.length > 0) {
vm.package.control = model.selection[0];
}
editorService.close();
},
close: function() {
editorService.close();
}
};
editorService.contentPicker(controlPicker);
}
function removeControl() {
vm.package.control = null;
}
onInit();
}

View File

@@ -202,25 +202,47 @@
<umb-control-group
label="Path to file"
description="Absolute path to file (ie: /bin/umbraco.bin)">
<umb-node-preview
ng-if="vm.package.files"
ng-repeat="file in vm.package.files"
icon="file.icon"
name="file.name"
allow-remove="true"
on-remove="vm.removeFile($index)">
</umb-node-preview>
<a href=""
class="umb-node-preview-add"
ng-click="vm.openFilePicker()"
prevent-default>
<localize key="general_add">Add</localize>
</a>
</umb-control-group>
<umb-control-group
label="Control after installation"
description="Load control after installation (ex: /usercontrols/installer.ascx)">
<umb-node-preview
ng-if="vm.package.control.id"
icon="vm.package.control.icon"
name="vm.package.control.name"
allow-edit="true"
allow-remove="true"
on-edit="vm.openControlPicker()"
on-remove="vm.removeControl()">
</umb-node-preview>
<a href=""
ng-if="!vm.package.control.id"
class="umb-node-preview-add"
ng-click="vm.openFilePicker()"
ng-click="vm.openControlPicker()"
prevent-default>
<localize key="general_add">Add</localize>
</a>
</umb-control-group>
</div>