From 9091c2a1b72e924a5d6af7bb8e6f707592bdf556 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Tue, 5 Aug 2014 16:53:58 +0100 Subject: [PATCH] CRM-15061 - Add js to show Any/All selector only when needed --- .../CRM/Custom/Form/MultiValueSearch.js.tpl | 39 +++++++++++++++++++ templates/CRM/Custom/Form/Search.tpl | 6 ++- templates/CRM/Profile/Form/Search.tpl | 7 +++- 3 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 templates/CRM/Custom/Form/MultiValueSearch.js.tpl diff --git a/templates/CRM/Custom/Form/MultiValueSearch.js.tpl b/templates/CRM/Custom/Form/MultiValueSearch.js.tpl new file mode 100644 index 0000000000..a0c7de709d --- /dev/null +++ b/templates/CRM/Custom/Form/MultiValueSearch.js.tpl @@ -0,0 +1,39 @@ +{* + +--------------------------------------------------------------------+ + | CiviCRM version 4.5 | + +--------------------------------------------------------------------+ + | Copyright CiviCRM LLC (c) 2004-2014 | + +--------------------------------------------------------------------+ + | This file is a part of CiviCRM. | + | | + | CiviCRM is free software; you can copy, modify, and distribute it | + | under the terms of the GNU Affero General Public License | + | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | + | | + | CiviCRM is distributed in the hope that it will be useful, but | + | WITHOUT ANY WARRANTY; without even the implied warranty of | + | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | + | See the GNU Affero General Public License for more details. | + | | + | You should have received a copy of the GNU Affero General Public | + | License and the CiviCRM Licensing Exception along | + | with this program; if not, contact CiviCRM LLC | + | at info[AT]civicrm[DOT]org. If you have questions about the | + | GNU Affero General Public License or the licensing of CiviCRM, | + | see the CiviCRM license FAQ at http://civicrm.org/licensing | + +--------------------------------------------------------------------+ +*} +{literal} + +{/literal} diff --git a/templates/CRM/Custom/Form/Search.tpl b/templates/CRM/Custom/Form/Search.tpl index 7d524d69bf..792e6af02c 100644 --- a/templates/CRM/Custom/Form/Search.tpl +++ b/templates/CRM/Custom/Form/Search.tpl @@ -58,7 +58,8 @@ {include file="CRM/common/jcalendar.tpl" elementName=$element_name} {/if} {if !empty($form.$operator_name)} - {$form.$operator_name.html} + {$form.$operator_name.html} + {assign var="add_multivalue_js" value=true} {/if} {/if} {if $element.html_type eq 'Autocomplete-Select'} @@ -74,5 +75,8 @@ {/foreach} + {if !empty($add_multivalue_js)} + {include file="CRM/Custom/Form/MultiValueSearch.js.tpl"} + {/if} {/if} diff --git a/templates/CRM/Profile/Form/Search.tpl b/templates/CRM/Profile/Form/Search.tpl index 948e697655..9cb83280cb 100644 --- a/templates/CRM/Profile/Form/Search.tpl +++ b/templates/CRM/Profile/Form/Search.tpl @@ -89,7 +89,8 @@ {include file="CRM/Custom/Form/ContactReference.tpl" element_name = $n} {/if} {if !empty($form.$operator_name)} - {$form.$operator_name.html} + {$form.$operator_name.html} + {assign var="add_multivalue_js" value=true} {/if} {/if} @@ -128,3 +129,7 @@ }); {/literal} + +{if !empty($add_multivalue_js)} + {include file="CRM/Custom/Form/MultiValueSearch.js.tpl"} +{/if} -- 2.25.1