From 2eb633745cb60018c397eb6490b6bcb7606fd4bc Mon Sep 17 00:00:00 2001 From: Jaap Jansma <jaap.jansma@civicoop.org> Date: Wed, 20 Nov 2019 14:33:23 +0100 Subject: [PATCH] fixed bug with option lists in for type configuration --- .../Type/CustomOptionListType.php | 4 +-- .../config/crmFormProcessorSpecification.html | 33 ++++++++++++++++--- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/Civi/FormProcessor/Type/CustomOptionListType.php b/Civi/FormProcessor/Type/CustomOptionListType.php index f297dbd..dd4bc82 100644 --- a/Civi/FormProcessor/Type/CustomOptionListType.php +++ b/Civi/FormProcessor/Type/CustomOptionListType.php @@ -29,8 +29,8 @@ */ public function getConfigurationSpecification() { $optionSpeBag = new SpecificationBag(array( - new Specification('value', 'String', E::ts('Value'), true), - new Specification('label', 'String', E::ts('Label'), true), + new Specification('value', 'String', E::ts('Value'), true, null, null, null, null, ''), + new Specification('label', 'String', E::ts('Label'), true,null, null, null, null, ''), )); return new SpecificationBag(array( diff --git a/ang/form_processor/config/crmFormProcessorSpecification.html b/ang/form_processor/config/crmFormProcessorSpecification.html index 8c9304b..d087923 100644 --- a/ang/form_processor/config/crmFormProcessorSpecification.html +++ b/ang/form_processor/config/crmFormProcessorSpecification.html @@ -2,7 +2,32 @@ <div ng-if="!noLabel" class="label"> <label crm-ui-for="specification.name" crm-depth="1" crm-ui-force-required="specification.required">{{specification.title}}</label> </div> - <div ng-attr-class="{{!noLabel ? 'content' : ''}}"> + + <div ng-attr-class="{{!noLabel ? 'content' : ''}}" ng-if="specification.options"> + <select + style="width: 90%;" + crm-ui-select + crm-ui-id="{{specification.name}}" + ui-options="{allowClear: true}" + name="{{specification.name}}" + ng-model="configuration[specification.name]" + ng-required="specification.required" + > + <option ng-repeat="(key,value) in specification.options" value="{{key}}">{{value}}</option> + </select> + </div> + <div ng-attr-class="{{!noLabel ? 'content' : ''}}" ng-if="specification.fk_entity"> + <input + crm-entityref="{entity: specification.fk_entity, select: {allowClear: true, placeholder: specification.title}}" + name="{{specification.name}}" + crm-ui-id="{{specification.name}}" + ng-model="configuration[specification.name]" + ng-required="spec.required" + /> + </div> + + + <div ng-attr-class="{{!noLabel ? 'content' : ''}}" ng-if="!specification.options && !specification.fk_entity"> <input type="text" name="{{specification.name}}" @@ -18,7 +43,7 @@ <div ng-if="!noLabel" class="label"> <label crm-ui-for="specification.name" crm-depth="1" crm-ui-force-required="specification.required">{{specification.title}}</label> </div> - <div ng-attr-class="{{!noLabel ? 'content' : ''}}"> + <div ng-attr-class="{{!noLabel ? 'content' : ''}}"> <select name="{{specification.name}}" ui-jq="select2" @@ -52,11 +77,11 @@ </td> <td> <a crm-icon="fa-trash" class="crm-hover-button" ng-click="removeItem(collection_config)" title="{{ts('Remove')}}">{{ts('Remove')}}</a> - </td> + </td> </tr> </tbody> <button crm-icon="fa-plus" ng-click="addItemToCollection(specification.specification_bag)">{{ts('Add item')}}</button> </table> </div> -<div class="description" ng-if="specification.description" ng-bind-html="specification.description"></div> \ No newline at end of file +<div class="description" ng-if="specification.description" ng-bind-html="specification.description"></div> -- GitLab