Plumbing for editing settings

This commit is contained in:
Kenn Jacobsen
2019-05-20 08:29:08 +02:00
parent b064566f9e
commit acd329381c
4 changed files with 89 additions and 2 deletions
@@ -12,6 +12,7 @@
vm.add = add;
vm.editContent = editContent;
vm.editSettings = editSettings;
vm.remove = remove;
// it would be awesome if we could load all scaffolds in one go... however we need to have an eye out for performance,
@@ -95,6 +96,23 @@
editorService.open(options);
}
function editSettings(block) {
var options = {
settings: block.settings,
title: "TODO: Edit settings title here",
view: "views/propertyeditors/blockeditor/blockeditor.editsettings.html",
size: "medium",
submit: function(model) {
console.log("TODO: something with block settings", model)
editorService.close();
},
close: function() {
editorService.close();
}
};
editorService.open(options);
}
function remove(block) {
if (confirm("TODO: Are you sure?")) {
$scope.model.value.splice($scope.model.value.indexOf(block), 1);
@@ -0,0 +1,24 @@
function BlockEditorEditSettingsController($scope) {
var vm = this;
vm.submit = submit;
vm.close = close;
function init() {
}
function submit() {
if($scope.model.submit) {
$scope.model.submit($scope.model);
}
}
function close() {
if($scope.model.close) {
$scope.model.close();
}
}
init();
}
angular.module("umbraco").controller("Umbraco.PropertyEditors.BlockEditor.EditSettingsController", BlockEditorEditSettingsController);
@@ -0,0 +1,42 @@
<div ng-controller="Umbraco.PropertyEditors.BlockEditor.EditSettingsController as vm">
<umb-editor-view>
<umb-editor-header name="model.title"
name-locked="true"
hide-alias="true"
hide-icon="true"
hide-description="true">
</umb-editor-header>
<umb-editor-container>
<umb-load-indicator ng-if="vm.loading" />
<div ng-if="!loading">
<umb-box>
<umb-box-content>
<ng-form name="editBlockForm" val-form-manager>
<h3>Here be settings editing</h3>
</ng-form>
</umb-box-content>
</umb-box>
</div>
</umb-editor-container>
<umb-editor-footer>
<umb-editor-footer-content-right>
<umb-button type="button"
button-style="link"
label-key="general_cancel"
shortcut="esc"
action="vm.close()">
</umb-button>
<umb-button type="button"
button-style="success"
label-key="general_ok"
action="vm.submit()">
</umb-button>
</umb-editor-footer-content-right>
</umb-editor-footer>
</umb-editor-view>
</div>
@@ -9,12 +9,15 @@
<div style="cursor:pointer" ng-click="vm.editContent(block)" class="di">
TODO: block identifier, e.g. icon
</div>
<div style="cursor:pointer" ng-click="vm.remove(block)" class="di">
<i class="icon icon-trash"></i>
<div style="cursor:pointer" ng-click="vm.editSettings(block)" class="di">
<i class="icon icon-settings"></i>
</div>
<div style="cursor:move" class="di handle">
<i class="icon icon-navigation"></i>
</div>
<div style="cursor:pointer" ng-click="vm.remove(block)" class="di">
<i class="icon icon-trash"></i>
</div>
</div>
</div>