From 4458f26379e61a85a4156cc13e2aa8b9cbb07d16 Mon Sep 17 00:00:00 2001 From: Molkobain Date: Tue, 17 Aug 2021 17:49:22 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B03750=20-=20Behat:=20Add=20metadata=20abo?= =?UTF-8?q?ut=20logs=20label?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CaseLogEntryForm/CaseLogEntryForm.php | 11 +++++++++++ .../caselog-entry-form/layout.html.twig | 1 + .../base/layouts/activity-panel/layout.html.twig | 3 ++- .../activity-panel/tab-toolbar/caselog.html.twig | 6 +++--- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/sources/application/UI/Base/Layout/ActivityPanel/CaseLogEntryForm/CaseLogEntryForm.php b/sources/application/UI/Base/Layout/ActivityPanel/CaseLogEntryForm/CaseLogEntryForm.php index e9071286e..869d4edd9 100644 --- a/sources/application/UI/Base/Layout/ActivityPanel/CaseLogEntryForm/CaseLogEntryForm.php +++ b/sources/application/UI/Base/Layout/ActivityPanel/CaseLogEntryForm/CaseLogEntryForm.php @@ -10,6 +10,7 @@ use Combodo\iTop\Application\UI\Base\Component\Input\RichText\RichText; use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock; use Combodo\iTop\Application\UI\Base\UIBlock; use DBObject; +use MetaModel; /** * Class CaseLogEntryForm @@ -103,6 +104,16 @@ class CaseLogEntryForm extends UIContentBlock return $this->sAttCode; } + /** + * @see static::$sAttCode + * @return string + * @throws \Exception + */ + public function GetAttLabel(): string + { + return MetaModel::GetLabel($this->GetObjectClass(), $this->GetAttCode()); + } + /** * @see $sSubmitMode * diff --git a/templates/base/layouts/activity-panel/caselog-entry-form/layout.html.twig b/templates/base/layouts/activity-panel/caselog-entry-form/layout.html.twig index 938076eab..715e534a7 100644 --- a/templates/base/layouts/activity-panel/caselog-entry-form/layout.html.twig +++ b/templates/base/layouts/activity-panel/caselog-entry-form/layout.html.twig @@ -5,6 +5,7 @@ data-object-class="{{ oUIBlock.GetObjectClass() }}" data-object-id="{{ oUIBlock.GetObjectId() }}" data-attribute-code="{{ oUIBlock.GetAttCode() }}" + data-attribute-label="{{ oUIBlock.GetAttLabel() }}" data-submit-mode="{{ oUIBlock.GetSubmitMode() }}" method="post">
diff --git a/templates/base/layouts/activity-panel/layout.html.twig b/templates/base/layouts/activity-panel/layout.html.twig index 3ab426682..0efff688c 100644 --- a/templates/base/layouts/activity-panel/layout.html.twig +++ b/templates/base/layouts/activity-panel/layout.html.twig @@ -12,6 +12,7 @@ data-role="ibo-activity-panel--tab-toggler" data-tab-type="caselog" data-caselog-attribute-code="{{ sCaseLogAttCode }}" + data-caselog-attribute-label="{{ aCaseLogData.title }}" data-caselog-rank="{{ loop.index }}"> @@ -52,7 +53,7 @@
{% for sCaseLogAttCode, aCaseLogData in oUIBlock.GetCaseLogTabs() %} - {{ include('base/layouts/activity-panel/tab-toolbar/caselog.html.twig', {oUIBlock: oUIBlock, iRank: loop.index, bIsActive: (loop.index == 1), aFilteredCaseLogsAttCodes: [sCaseLogAttCode]}) }} + {{ include('base/layouts/activity-panel/tab-toolbar/caselog.html.twig', {oUIBlock: oUIBlock, iRank: loop.index, bIsActive: (loop.index == 1), sAttCode: sCaseLogAttCode, aData: aCaseLogData, aFilteredCaseLogsAttCodes: [sCaseLogAttCode]}) }} {% endfor %} {{ include('base/layouts/activity-panel/tab-toolbar/activity.html.twig', {oUIBlock: oUIBlock, bIsActive: (oUIBlock.GetCaseLogTabs()|length == 0), bPrefilterStateChanges: true, bPrefilterEdits: true}) }}
diff --git a/templates/base/layouts/activity-panel/tab-toolbar/caselog.html.twig b/templates/base/layouts/activity-panel/tab-toolbar/caselog.html.twig index f219d31e6..afd4cd7b0 100644 --- a/templates/base/layouts/activity-panel/tab-toolbar/caselog.html.twig +++ b/templates/base/layouts/activity-panel/tab-toolbar/caselog.html.twig @@ -4,12 +4,12 @@ {% block bDataTabType %}caselog{% endblock %} -{% block bExtraDataAttributes %}data-caselog-attribute-code="{{ sCaseLogAttCode }}" data-caselog-rank="{{ loop.index }}"{% endblock %} +{% block bExtraDataAttributes %}data-caselog-attribute-code="{{ sAttCode }}"data-caselog-attribute-label="{{ aData.title }}" data-caselog-rank="{{ loop.index }}"{% endblock %} {% block bTabToolbarFirstRow %} - {% if oUIBlock.HasCaseLogTabEntryForm(sCaseLogAttCode) %} + {% if oUIBlock.HasCaseLogTabEntryForm(sAttCode) %}
- {{ render_block(oUIBlock.GetCaseLogTabEntryForm(sCaseLogAttCode), {bInitOpened: oUIBlock.IsEntryFormOpened()}) }} + {{ render_block(oUIBlock.GetCaseLogTabEntryForm(sAttCode), {bInitOpened: oUIBlock.IsEntryFormOpened()}) }}
{% endif %} {% endblock %} \ No newline at end of file