From eee24dde7e4d1ab9ec38a4001956b2dd7d666cef Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Tue, 18 May 2021 13:37:43 -0400 Subject: [PATCH] Afform - Add 'Placement' colum to admin screen --- ext/afform/admin/ang/afAdmin.js | 2 +- .../admin/ang/afAdmin/afAdminList.controller.js | 8 ++++++++ ext/afform/admin/ang/afAdmin/afAdminList.html | 14 +++++++------- ext/afform/core/Civi/Api4/Afform.php | 4 ++++ 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/ext/afform/admin/ang/afAdmin.js b/ext/afform/admin/ang/afAdmin.js index a298306d32..50f1715be4 100644 --- a/ext/afform/admin/ang/afAdmin.js +++ b/ext/afform/admin/ang/afAdmin.js @@ -11,7 +11,7 @@ // Load data for lists afforms: function(crmApi4) { return crmApi4('Afform', 'get', { - select: ['name', 'title', 'type', 'is_public', 'server_route', 'has_local', 'has_base'], + select: ['name', 'title', 'type', 'server_route', 'has_local', 'has_base', 'is_dashlet', 'contact_summary:label'], orderBy: {title: 'ASC'} }); } diff --git a/ext/afform/admin/ang/afAdmin/afAdminList.controller.js b/ext/afform/admin/ang/afAdmin/afAdminList.controller.js index f966af1746..d0b123bcef 100644 --- a/ext/afform/admin/ang/afAdmin/afAdminList.controller.js +++ b/ext/afform/admin/ang/afAdmin/afAdminList.controller.js @@ -22,6 +22,14 @@ this.afforms = _.transform(afforms, function(afforms, afform) { afform.type = afform.type || 'system'; + // Aggregate a couple fields for the "Placement" column + afform.placement = []; + if (afform.is_dashlet) { + afform.placement.push(ts('Dashboard')); + } + if (afform['contact_summary:label']) { + afform.placement.push(afform['contact_summary:label']); + } afforms[afform.type] = afforms[afform.type] || []; afforms[afform.type].push(afform); }, {}); diff --git a/ext/afform/admin/ang/afAdmin/afAdminList.html b/ext/afform/admin/ang/afAdmin/afAdminList.html index 276e4d0538..b8a1cca650 100644 --- a/ext/afform/admin/ang/afAdmin/afAdminList.html +++ b/ext/afform/admin/ang/afAdmin/afAdminList.html @@ -40,25 +40,25 @@ {{:: ts('Title') }} {{:: ts('Name') }} {{:: ts('Page') }} - {{:: ts('Style') }} + {{:: ts('Placement') }} - {{afform.title}} + {{ afform.title }} - {{afform.name}} + {{ afform.name }} - {{afform.server_route}} + {{ afform.server_route }} - {{afform.is_public ? ts('Frontend') : ts('Backend')}} + {{ afform.placement.join(', ') }} - {{ ts('Edit') }} - {{ ts('Clone') }} + {{:: ts('Edit') }} + {{:: ts('Clone') }} {{ afform.has_base ? ts('Revert') : ts('Delete') }} diff --git a/ext/afform/core/Civi/Api4/Afform.php b/ext/afform/core/Civi/Api4/Afform.php index 7c63c31e51..d498937353 100644 --- a/ext/afform/core/Civi/Api4/Afform.php +++ b/ext/afform/core/Civi/Api4/Afform.php @@ -161,6 +161,10 @@ class Afform extends Generic\AbstractEntity { [ 'name' => 'contact_summary', 'data_type' => 'String', + 'options' => [ + 'block' => ts('Contact Summary Block'), + 'tab' => ts('Contact Summary Tab'), + ], ], [ 'name' => 'repeat', -- 2.25.1