From bfd9c358322d0c6b1021441a810357a6ae84b412 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Mon, 3 Jun 2019 11:50:03 -0400 Subject: [PATCH] Improve formatting for settings checkboxes --- CRM/Admin/Form/Setting/Search.php | 12 +-- CRM/Admin/Form/SettingTrait.php | 3 +- css/civicrm.css | 37 +++++++++ settings/Core.setting.php | 10 +-- settings/Search.setting.php | 9 +-- .../CRM/Admin/Form/Preferences/Display.tpl | 12 ++- .../CRM/Admin/Form/Setting/Component.tpl | 6 +- templates/CRM/Admin/Form/Setting/Search.tpl | 78 +------------------ .../CRM/Admin/Form/Setting/SettingForm.tpl | 12 ++- 9 files changed, 68 insertions(+), 111 deletions(-) diff --git a/CRM/Admin/Form/Setting/Search.php b/CRM/Admin/Form/Setting/Search.php index 95cab96824..d8e5b6ee4f 100644 --- a/CRM/Admin/Form/Setting/Search.php +++ b/CRM/Admin/Form/Setting/Search.php @@ -38,19 +38,19 @@ class CRM_Admin_Form_Setting_Search extends CRM_Admin_Form_Setting { protected $_settings = [ - 'contact_reference_options' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, - 'contact_autocomplete_options' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, - 'search_autocomplete_count' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, - 'enable_innodb_fts' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, 'includeWildCardInName' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, 'includeEmailInName' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, + 'searchPrimaryDetailsOnly' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, 'includeNickNameInName' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, 'includeAlphabeticalPager' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, 'includeOrderByClause' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, - 'smartGroupCacheTimeout' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, 'defaultSearchProfileID' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, - 'searchPrimaryDetailsOnly' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, + 'smartGroupCacheTimeout' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, 'quicksearch_options' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, + 'contact_autocomplete_options' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, + 'contact_reference_options' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, + 'search_autocomplete_count' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, + 'enable_innodb_fts' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, ]; /** diff --git a/CRM/Admin/Form/SettingTrait.php b/CRM/Admin/Form/SettingTrait.php index d1e2398f04..a211b33f9e 100644 --- a/CRM/Admin/Form/SettingTrait.php +++ b/CRM/Admin/Form/SettingTrait.php @@ -213,11 +213,12 @@ trait CRM_Admin_Form_SettingTrait { foreach ($options as $key => $val) { $newOptions[$key] = $val; } + $settingMetaData[$setting]['wrapper_element'] = ['']; $this->addCheckBox($setting, $props['title'], $newOptions, NULL, NULL, NULL, NULL, - ['  ', '  ', '
'] + '
  • ' ); } elseif ($add == 'addChainSelect') { diff --git a/css/civicrm.css b/css/civicrm.css index de957adb3b..3be9444c58 100644 --- a/css/civicrm.css +++ b/css/civicrm.css @@ -3229,6 +3229,43 @@ span.crm-select-item-color { width: 93%; } +/* Checkbox gropus */ +.crm-container ul.crm-checkbox-list { + list-style: none; + margin: 0; + padding: 0; + background-color: white; + border: 1px solid #a5a5a5; + width: 300px; + max-height: 300px; + overflow-y: auto; +} +.crm-container ul.crm-checkbox-list li { + position: relative; + margin: 0; + padding: 0; +} +.crm-container ul.crm-checkbox-list li input { + position: absolute; + left: 5px; + top: 4px; +} +.crm-container ul.crm-checkbox-list li label { + display: block; + padding: 2px 0 2px 22px; + margin: 0; + word-break: break-all; +} +.crm-container ul.crm-checkbox-list li:nth-child(even) label { + background-color: #FAFAFA; +} +.crm-container ul.crm-checkbox-list li input:checked + label { + background-color: #FFFFCC; +} +.crm-container ul.crm-checkbox-list li:nth-child(even) input:checked + label { + background-color: #fffdb2 +} + /* classes related to batch entry operation */ .crm-container span.batch-edit, .crm-container span.batch-valid, diff --git a/settings/Core.setting.php b/settings/Core.setting.php index b362dc84f0..bc33c339bf 100644 --- a/settings/Core.setting.php +++ b/settings/Core.setting.php @@ -40,7 +40,6 @@ return [ 'group' => 'core', 'name' => 'contact_view_options', 'type' => 'String', - 'quick_form_type' => 'CheckBoxes', 'html_type' => 'checkboxes', 'pseudoconstant' => [ 'optionGroupName' => 'contact_view_options', @@ -289,7 +288,6 @@ return [ 'group' => 'core', 'name' => 'contact_autocomplete_options', 'type' => 'String', - 'quick_form_type' => 'CheckBoxes', 'html_type' => 'checkboxes', 'pseudoconstant' => [ 'callback' => 'CRM_Admin_Form_Setting_Search::getContactAutocompleteOptions', @@ -308,7 +306,6 @@ return [ 'group' => 'core', 'name' => 'contact_reference_options', 'type' => 'String', - 'quick_form_type' => 'CheckBoxes', 'html_type' => 'checkboxes', 'pseudoconstant' => [ 'callback' => 'CRM_Admin_Form_Setting_Search::getContactReferenceOptions', @@ -732,12 +729,7 @@ return [ 'group' => 'core', 'name' => 'enable_components', 'type' => 'Array', - 'quick_form_type' => 'Select', - 'html_type' => 'Select', - 'html_attributes' => [ - 'multiple' => 1, - 'class' => 'crm-select2', - ], + 'html_type' => 'checkboxes', 'default' => NULL, 'add' => '4.4', 'title' => ts('Enable Components'), diff --git a/settings/Search.setting.php b/settings/Search.setting.php index 043fe559bd..48f8943e16 100644 --- a/settings/Search.setting.php +++ b/settings/Search.setting.php @@ -42,11 +42,7 @@ return [ 'name' => 'search_autocomplete_count', 'type' => 'Integer', 'quick_form_type' => 'Element', - 'html_type' => 'text', - 'html_attributes' => [ - 'size' => 2, - 'maxlength' => 2, - ], + 'html_type' => 'number', 'default' => 10, 'add' => '4.3', 'title' => 'Autocomplete Results', @@ -167,7 +163,7 @@ return [ 'name' => 'smartGroupCacheTimeout', 'type' => 'Integer', 'quick_form_type' => 'Element', - 'html_type' => 'text', + 'html_type' => 'number', 'default' => 5, 'add' => '4.6', 'title' => 'Smart group cache timeout', @@ -238,7 +234,6 @@ return [ 'name' => 'quicksearch_options', 'type' => 'string', 'serialize' => CRM_Core_DAO::SERIALIZE_SEPARATOR_BOOKEND, - 'quick_form_type' => 'CheckBoxes', 'html_type' => 'checkboxes', 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::quicksearchOptions', diff --git a/templates/CRM/Admin/Form/Preferences/Display.tpl b/templates/CRM/Admin/Form/Preferences/Display.tpl index 1c2a61ea45..9a7cb227aa 100644 --- a/templates/CRM/Admin/Form/Preferences/Display.tpl +++ b/templates/CRM/Admin/Form/Preferences/Display.tpl @@ -29,7 +29,7 @@ - + @@ -105,7 +105,7 @@ - + @@ -164,7 +164,12 @@ - + @@ -261,7 +266,6 @@ if (!invoicing) { $('#user_dashboard_options_' + invoicesKey).attr("disabled", true); } - $("#invoice_help").insertAfter("label[for='user_dashboard_options_" + invoicesKey + "']"); $("#contactEditBlocks, #contactEditOptions").sortable({ placeholder: 'ui-state-highlight', diff --git a/templates/CRM/Admin/Form/Setting/Component.tpl b/templates/CRM/Admin/Form/Setting/Component.tpl index df7b17737a..16ab4e2a99 100644 --- a/templates/CRM/Admin/Form/Setting/Component.tpl +++ b/templates/CRM/Admin/Form/Setting/Component.tpl @@ -24,11 +24,9 @@ +--------------------------------------------------------------------+ *}
    - {ts}CiviCRM includes several optional components which give you more tools to connect with and engage your constituents.{/ts}{help id="components"} + {ts}CiviCRM includes several optional components which give you more tools to connect with and engage your constituents.{/ts}{help id="components"}
    -
    {include file="CRM/common/formButtons.tpl" location="top"}
    -{$form.enable_components.html} -
    {include file="CRM/common/formButtons.tpl" location="bottom"}
    + {include file='CRM/Admin/Form/Setting/SettingForm.tpl'}
    diff --git a/templates/CRM/Admin/Form/Setting/Search.tpl b/templates/CRM/Admin/Form/Setting/Search.tpl index 8a6b905bcb..95a8c3665e 100644 --- a/templates/CRM/Admin/Form/Setting/Search.tpl +++ b/templates/CRM/Admin/Form/Setting/Search.tpl @@ -24,81 +24,5 @@ +--------------------------------------------------------------------+ *}
    -
    {include file="CRM/common/formButtons.tpl" location="top"}
    -
    {$form.contact_view_options.label}{$form.contact_view_options.html}
    • {$form.contact_view_options.html}
     
    {$form.advanced_search_options.label}{$form.advanced_search_options.html}
    • {$form.advanced_search_options.html}
     
    {$form.user_dashboard_options.label}{$form.user_dashboard_options.html} {help id="id-invoices_id"} +
    • + {$form.user_dashboard_options.html} + {help id="id-invoices_id"} +
    +
     
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    {$form.includeWildCardInName.label}{$form.includeWildCardInName.html}
    - {ts}If enabled, wildcards are automatically added to the beginning AND end of the search term when users search for contacts by Name. EXAMPLE: Searching for 'ada' will return any contact whose name includes those letters - e.g. 'Adams, Janet', 'Nadal, Jorge', etc. If disabled, a wildcard is added to the end of the search term only. EXAMPLE: Searching for 'ada' will return any contact whose last name begins with those letters - e.g. 'Adams, Janet' but NOT 'Nadal, Jorge'. Disabling this feature will speed up search significantly for larger databases, but users must manually enter wildcards ('%' or '_') to the beginning of the search term if they want to find all records which contain those letters. EXAMPLE: '%ada' will return 'Nadal, Jorge'.{/ts} -
    {$form.includeEmailInName.label}{$form.includeEmailInName.html}
    - {ts}If enabled, email addresses are automatically included when users search by Name. Disabling this feature will speed up search significantly for larger databases, but users will need to use the Email search fields (from Advanced Search, Search Builder, or Profiles) to find contacts by email address.{/ts}
    {$form.searchPrimaryDetailsOnly.label}{$form.searchPrimaryDetailsOnly.html}
    - {ts}If enabled, only primary details (eg contact's primary email, phone, etc) will be included in Basic and Advanced Search results. Disabling this feature will allow users to match contacts using any email, phone etc detail.{/ts} -
    {$form.includeNickNameInName.label}{$form.includeNickNameInName.html}
    - {ts}If enabled, nicknames are automatically included when users search by Name.{/ts}
    {$form.includeAlphabeticalPager.label}{$form.includeAlphabeticalPager.html}
    - {ts}If disabled, the alphabetical pager will not be displayed on the search screens. This will improve response time on search results on large datasets.{/ts}
    {$form.includeOrderByClause.label}{$form.includeOrderByClause.html}
    - {ts}If disabled, the search results will not be ordered. This will improve response time on search results on large datasets significantly.{/ts}
    {$form.defaultSearchProfileID.label}{$form.defaultSearchProfileID.html}
    - {ts}If set, this will be the default profile used for contact search. This is experimental functionality.{/ts}
    {$form.smartGroupCacheTimeout.label}{$form.smartGroupCacheTimeout.html}
    - {ts}The number of minutes to cache smart group contacts. We strongly recommend that this value be greater than zero, since a value of zero means no caching at all. If your contact data changes frequently, you should set this value to at least 5 minutes.{/ts}
    {$form.quicksearch_options.label} - {$form.quicksearch_options.html} -

    {$setting_descriptions.quicksearch_options}

    -
    {$form.contact_autocomplete_options.label}{$form.contact_autocomplete_options.html}
    - {ts}Selected fields will be displayed in back-office autocomplete dropdown search results (Quick Search, etc.). Contact Name is always included.{/ts}
    {$form.contact_reference_options.label}{$form.contact_reference_options.html}
    - {ts}Selected fields will be displayed in autocomplete dropdown search results for 'Contact Reference' custom fields. Contact Name is always included. NOTE: You must assign 'access contact reference fields' permission to the anonymous role if you want to use custom contact reference fields in profiles on public pages. For most situations, you should use the 'Limit List to Group' setting when configuring a contact reference field which will be used in public forms to prevent exposing your entire contact list.{/ts}
    {$form.search_autocomplete_count.label}{$form.search_autocomplete_count.html}
    - {ts}The maximum number of contacts to show at a time when typing in an autocomplete field.{/ts}
    {$form.enable_innodb_fts.label}{$form.enable_innodb_fts.html}
    -

    {$enable_innodb_fts_description}

    -
    -
    {include file="CRM/common/formButtons.tpl" location="bottom"}
    - + {include file='CRM/Admin/Form/Setting/SettingForm.tpl'} diff --git a/templates/CRM/Admin/Form/Setting/SettingForm.tpl b/templates/CRM/Admin/Form/Setting/SettingForm.tpl index e4257f7500..6c5b891fa6 100644 --- a/templates/CRM/Admin/Form/Setting/SettingForm.tpl +++ b/templates/CRM/Admin/Form/Setting/SettingForm.tpl @@ -27,10 +27,16 @@ {foreach from=$settings_fields key="setting_name" item="setting_detail"} - +
    {$form.$setting_name.label}{$form.$setting_name.html}
    - +
    {$form.$setting_name.label} + {if !empty($setting_detail.wrapper_element)} + {$setting_detail.wrapper_element.0}{$form.$setting_name.html}{$setting_detail.wrapper_element.1} + {else} + {$form.$setting_name.html} + {/if} +
    {ts}{$setting_detail.description}{/ts} - +
    {if $setting_detail.help_text} {assign var='tplhelp_id' value = $setting_name|cat:'-id'|replace:'_':'-'}{help id="$tplhelp_id"} {/if} -- 2.25.1