From 856aaf6a1d3a236b7e831f1c5f0ae83027dec4a0 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Tue, 11 Jun 2024 15:58:26 +0000 Subject: [PATCH] feat: preferredMailSender 1/2 - sortableList property This allows for a new 'sortableList' property type. This property should be a draggable list of items that, when saved, saves order they were arranged in. --- .../responsive/DataObjectUtil/property.tpl | 2 + .../DataObjectUtil/sortableList.tpl | 111 ++++++++++++++++++ code/web/sys/DataObjectUtil.php | 2 + 3 files changed, 115 insertions(+) create mode 100644 code/web/interface/themes/responsive/DataObjectUtil/sortableList.tpl diff --git a/code/web/interface/themes/responsive/DataObjectUtil/property.tpl b/code/web/interface/themes/responsive/DataObjectUtil/property.tpl index 9ff3938f71..7fd26bc4a4 100644 --- a/code/web/interface/themes/responsive/DataObjectUtil/property.tpl +++ b/code/web/interface/themes/responsive/DataObjectUtil/property.tpl @@ -569,6 +569,8 @@ {/if} {/foreach} + {elseif $property.type == 'sortableList'} + {include file="DataObjectUtil/sortableList.tpl"} {/if} diff --git a/code/web/interface/themes/responsive/DataObjectUtil/sortableList.tpl b/code/web/interface/themes/responsive/DataObjectUtil/sortableList.tpl new file mode 100644 index 0000000000..5a9d50fd92 --- /dev/null +++ b/code/web/interface/themes/responsive/DataObjectUtil/sortableList.tpl @@ -0,0 +1,111 @@ +{strip} +
    + {foreach from=$property.values item=propertyName key=propertyValue} +
  1. {$propertyName|escape}
  2. + {/foreach} +
+ + + \ No newline at end of file diff --git a/code/web/sys/DataObjectUtil.php b/code/web/sys/DataObjectUtil.php index 8b907e2b90..7c34222c3f 100644 --- a/code/web/sys/DataObjectUtil.php +++ b/code/web/sys/DataObjectUtil.php @@ -575,6 +575,8 @@ static function processProperty(DataObject $object, $property) { } $object->$propertyName = $values; + } elseif ($property['type'] == 'sortableList') { + $object->setProperty($propertyName, $_REQUEST[$propertyName], $property); } } } \ No newline at end of file