Skip to content

Commit

Permalink
Improve formatting for settings checkboxes
Browse files Browse the repository at this point in the history
  • Loading branch information
colemanw committed Jun 4, 2019
1 parent 9684d2f commit bfd9c35
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 111 deletions.
12 changes: 6 additions & 6 deletions CRM/Admin/Form/Setting/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
];

/**
Expand Down
3 changes: 2 additions & 1 deletion CRM/Admin/Form/SettingTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,12 @@ protected function addFieldsDefinedInSettingsMetadata() {
foreach ($options as $key => $val) {
$newOptions[$key] = $val;
}
$settingMetaData[$setting]['wrapper_element'] = ['<ul class="crm-checkbox-list"><li>', '</li></ul>'];
$this->addCheckBox($setting,
$props['title'],
$newOptions,
NULL, NULL, NULL, NULL,
['&nbsp;&nbsp;', '&nbsp;&nbsp;', '<br/>']
'</li><li>'
);
}
elseif ($add == 'addChainSelect') {
Expand Down
37 changes: 37 additions & 0 deletions css/civicrm.css
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 1 addition & 9 deletions settings/Core.setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
'group' => 'core',
'name' => 'contact_view_options',
'type' => 'String',
'quick_form_type' => 'CheckBoxes',
'html_type' => 'checkboxes',
'pseudoconstant' => [
'optionGroupName' => 'contact_view_options',
Expand Down Expand Up @@ -289,7 +288,6 @@
'group' => 'core',
'name' => 'contact_autocomplete_options',
'type' => 'String',
'quick_form_type' => 'CheckBoxes',
'html_type' => 'checkboxes',
'pseudoconstant' => [
'callback' => 'CRM_Admin_Form_Setting_Search::getContactAutocompleteOptions',
Expand All @@ -308,7 +306,6 @@
'group' => 'core',
'name' => 'contact_reference_options',
'type' => 'String',
'quick_form_type' => 'CheckBoxes',
'html_type' => 'checkboxes',
'pseudoconstant' => [
'callback' => 'CRM_Admin_Form_Setting_Search::getContactReferenceOptions',
Expand Down Expand Up @@ -732,12 +729,7 @@
'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'),
Expand Down
9 changes: 2 additions & 7 deletions settings/Search.setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,7 @@
'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',
Expand Down Expand Up @@ -167,7 +163,7 @@
'name' => 'smartGroupCacheTimeout',
'type' => 'Integer',
'quick_form_type' => 'Element',
'html_type' => 'text',
'html_type' => 'number',
'default' => 5,
'add' => '4.6',
'title' => 'Smart group cache timeout',
Expand Down Expand Up @@ -238,7 +234,6 @@
'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',
Expand Down
12 changes: 8 additions & 4 deletions templates/CRM/Admin/Form/Preferences/Display.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<table class="form-layout">
<tr class="crm-preferences-display-form-block-contact_view_options">
<td class="label">{$form.contact_view_options.label}</td>
<td>{$form.contact_view_options.html}</td>
<td><ul class="crm-checkbox-list"><li>{$form.contact_view_options.html}</li></ul></td>
</tr>
<tr class="crm-preferences-display-form-block-description">
<td>&nbsp;</td>
Expand Down Expand Up @@ -105,7 +105,7 @@
</tr>
<tr class="crm-preferences-display-form-block-advanced_search_options">
<td class="label">{$form.advanced_search_options.label}</td>
<td>{$form.advanced_search_options.html}</td>
<td><ul class="crm-checkbox-list"><li>{$form.advanced_search_options.html}</li></ul></td>
</tr>
<tr class="crm-preferences-display-form-block-description">
<td>&nbsp;</td>
Expand Down Expand Up @@ -164,7 +164,12 @@

<tr class="crm-preferences-display-form-block-user_dashboard_options">
<td class="label">{$form.user_dashboard_options.label}</td>
<td>{$form.user_dashboard_options.html}<span id="invoice_help"> {help id="id-invoices_id"}</span></td>
<td>
<ul class="crm-checkbox-list"><li>
{$form.user_dashboard_options.html}
<span style="position: absolute; right: 5px; bottom: 3px;"> {help id="id-invoices_id"}</span>
</li></ul>
</td>
</tr>
<tr class="crm-preferences-display-form-block-description">
<td>&nbsp;</td>
Expand Down Expand Up @@ -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',
Expand Down
6 changes: 2 additions & 4 deletions templates/CRM/Admin/Form/Setting/Component.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@
+--------------------------------------------------------------------+
*}
<div class="help">
{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"}
</div>
<div class="crm-block crm-form-block crm-component-form-block">
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
{$form.enable_components.html}
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
{include file='CRM/Admin/Form/Setting/SettingForm.tpl'}
</div>
<div class="spacer"></div>
78 changes: 1 addition & 77 deletions templates/CRM/Admin/Form/Setting/Search.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,81 +24,5 @@
+--------------------------------------------------------------------+
*}
<div class="crm-block crm-form-block crm-search-setting-form-block">
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
<table class="form-layout">
<tr class="crm-search-setting-form-block-includeWildCardInName">
<td class="label">{$form.includeWildCardInName.label}</td>
<td>{$form.includeWildCardInName.html}<br />
<span class="description">{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}</span>
</td>
</tr>
<tr class="crm-search-setting-form-block-includeEmailInName">
<td class="label">{$form.includeEmailInName.label}</td>
<td>{$form.includeEmailInName.html}<br />
<span class="description">{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}</span></td>
</tr>
<tr class="crm-search-setting-form-block-searchPrimaryDetailsOnly">
<td class="label">{$form.searchPrimaryDetailsOnly.label}</td>
<td>{$form.searchPrimaryDetailsOnly.html}<br />
<span class="description">{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}</span>
</td>
</tr>
<tr class="crm-search-setting-form-block-includeNickNameInName">
<td class="label">{$form.includeNickNameInName.label}</td>
<td>{$form.includeNickNameInName.html}<br />
<span class="description">{ts}If enabled, nicknames are automatically included when users search by Name.{/ts}</span></td>
</tr>
<tr class="crm-search-setting-form-block-includeAlphabeticalPager">
<td class="label">{$form.includeAlphabeticalPager.label}</td>
<td>{$form.includeAlphabeticalPager.html}<br />
<span class="description">{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}</span></td>
</tr>
<tr class="crm-search-setting-form-block-includeOrderByClause">
<td class="label">{$form.includeOrderByClause.label}</td>
<td>{$form.includeOrderByClause.html}<br />
<span class="description">{ts}If disabled, the search results will not be ordered. This will improve response time on search results on large datasets significantly.{/ts}</span></td>
</tr>
<tr class="crm-search-setting-form-block-defaultSearchProfileID">
<td class="label">{$form.defaultSearchProfileID.label}</td>
<td>{$form.defaultSearchProfileID.html}<br />
<span class="description">{ts}If set, this will be the default profile used for contact search. This is experimental functionality.{/ts}</span></td>
</tr>
<tr class="crm-search-setting-form-block-smartGroupCacheTimeout">
<td class="label">{$form.smartGroupCacheTimeout.label}</td>
<td>{$form.smartGroupCacheTimeout.html}<br />
<span class="description">{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}</span></td>
</tr>
<tr class="crm-search-setting-form-block-quicksearch_options">
<td class="label">{$form.quicksearch_options.label}</td>
<td>
{$form.quicksearch_options.html}
<p class="description">{$setting_descriptions.quicksearch_options}</p>
</td>
</tr>
<tr class="crm-search-setting-form-block-autocompleteContactSearch">
<td class="label">{$form.contact_autocomplete_options.label}</td>
<td>{$form.contact_autocomplete_options.html}<br/>
<span class="description">{ts}Selected fields will be displayed in back-office autocomplete dropdown search results (Quick Search, etc.). Contact Name is always included.{/ts}</span></td>
</tr>
<tr class="crm-search-setting-form-block-autocompleteContactReference">
<td class="label">{$form.contact_reference_options.label}</td>
<td>{$form.contact_reference_options.html}<br/>
<span class="description">{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}</span></td>
</tr>
<tr class="crm-search-setting-form-block-search_autocomplete_count">
<td class="label">{$form.search_autocomplete_count.label}</td>
<td>{$form.search_autocomplete_count.html}<br />
<span class="description">{ts}The maximum number of contacts to show at a time when typing in an autocomplete field.{/ts}</span></td>
</tr>
<tr class="crm-miscellaneous-form-block-enable_innodb_fts">
<td class="label">{$form.enable_innodb_fts.label}</td>
<td>{$form.enable_innodb_fts.html}<br />
<p class="description">{$enable_innodb_fts_description}</p>
</td>
</tr>


</table>
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>

{include file='CRM/Admin/Form/Setting/SettingForm.tpl'}
</div>
12 changes: 9 additions & 3 deletions templates/CRM/Admin/Form/Setting/SettingForm.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,16 @@
<table class="form-layout-compressed">
{foreach from=$settings_fields key="setting_name" item="setting_detail"}
<tr class="crm-mail-form-block-{$setting_name}">
<td class="label">{$form.$setting_name.label}</td><td>{$form.$setting_name.html}<br />
<span class="description">
<td class="label">{$form.$setting_name.label}</td>
<td>
{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}
<div class="description">
{ts}{$setting_detail.description}{/ts}
</span>
</div>
{if $setting_detail.help_text}
{assign var='tplhelp_id' value = $setting_name|cat:'-id'|replace:'_':'-'}{help id="$tplhelp_id"}
{/if}
Expand Down

0 comments on commit bfd9c35

Please sign in to comment.