From 2652d11b7a9e73db205e0f6ff645d77e7798e455 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Wed, 3 Feb 2021 18:55:02 -0500 Subject: [PATCH] Afform Gui - Exclude self from list of available blocks when editing a block --- ext/afform/admin/ang/afGuiEditor/afGuiEditor.component.js | 4 ++++ ext/afform/admin/ang/afGuiEditor/afGuiEntity.component.js | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ext/afform/admin/ang/afGuiEditor/afGuiEditor.component.js b/ext/afform/admin/ang/afGuiEditor/afGuiEditor.component.js index 2f4dceff97..393763cede 100644 --- a/ext/afform/admin/ang/afGuiEditor/afGuiEditor.component.js +++ b/ext/afform/admin/ang/afGuiEditor/afGuiEditor.component.js @@ -158,6 +158,10 @@ return $scope.selectedEntityName; }; + this.getAfform = function() { + return $scope.afform; + }; + // Validates that a drag-n-drop action is allowed this.onDrop = function(event, ui) { var sort = ui.item.sortable; diff --git a/ext/afform/admin/ang/afGuiEditor/afGuiEntity.component.js b/ext/afform/admin/ang/afGuiEditor/afGuiEntity.component.js index 830eb98f6d..6c231a5914 100644 --- a/ext/afform/admin/ang/afGuiEditor/afGuiEntity.component.js +++ b/ext/afform/admin/ang/afGuiEditor/afGuiEntity.component.js @@ -83,7 +83,8 @@ $scope.blockTitles.length = 0; _.each(afGui.meta.blocks, function(block, directive) { if ((!search || _.contains(directive, search) || _.contains(block.name.toLowerCase(), search) || _.contains(block.title.toLowerCase(), search)) && - (block.block === '*' || block.block === ctrl.entity.type || (ctrl.entity.type === 'Contact' && block.block === ctrl.entity.data.contact_type)) + (block.block === '*' || block.block === ctrl.entity.type || (ctrl.entity.type === 'Contact' && block.block === ctrl.entity.data.contact_type)) && + block.name !== ctrl.editor.getAfform().name ) { var item = {"#tag": block.join ? "div" : directive}; if (block.join) { -- 2.25.1