Refactor block view specification in the block directive

This commit is contained in:
Kenn Jacobsen
2019-05-20 18:03:21 +02:00
parent 7ce4fbe44c
commit d71b2a07c4
4 changed files with 18 additions and 19 deletions
@@ -1,12 +1,12 @@
angular.module("umbraco.directives").directive('umbBlockEditorBlock', [
function () {
var link = function (scope, el, attr, ctrl) {
scope.view = attr.view;
scope.view = attr.view || "views/propertyeditors/blockeditor/blockeditor.block.default.html";
};
return {
restrict: "E",
templateUrl: "views/propertyeditors/blockeditor/blockeditor.block.html",
template: "<div ng-include='view'></div>",
link: link
};
}
@@ -0,0 +1,13 @@
<div>
<div>
<div style="cursor:pointer" ng-click="vm.editSettings(block)" class="di">
<i class="icon icon-settings"></i>
</div>
<div style="cursor:pointer" ng-click="vm.remove(block)" class="di">
<i class="icon icon-trash"></i>
</div>
</div>
<div style="cursor:pointer" ng-click="vm.editContent(block)">
Eventually a block identifier will go here (e.g. element type icon)
</div>
</div>
@@ -1,16 +0,0 @@
<div class="handle" >
<div ng-if="view" ng-include="view"></div>
<div ng-if="!view">
<div>
<div style="cursor:pointer" ng-click="vm.editSettings(block)" class="di">
<i class="icon icon-settings"></i>
</div>
<div style="cursor:pointer" ng-click="vm.remove(block)" class="di">
<i class="icon icon-trash"></i>
</div>
</div>
<div style="cursor:pointer" ng-click="vm.editContent(block)">
Eventually a block identifier will go here (e.g. element type icon)
</div>
</div>
</div>
@@ -1,7 +1,9 @@
<div ng-controller="Umbraco.PropertyEditors.BlockEditor.DefaultController">
<ul class="unstyled" ui-sortable="sortableOptions" ng-model="blocks">
<li ng-repeat="block in blocks" style="border: 1px solid silver; margin-bottom: 4px; padding: 4px;">
<umb-block-editor-block></umb-block-editor-block>
<div class="handle">
<umb-block-editor-block></umb-block-editor-block>
</div>
</li>
</ul>