2 +--------------------------------------------------------------------+
3 | Copyright CiviCRM LLC. All rights reserved. |
5 | This work is published under the GNU AGPLv3 license with some |
6 | permitted exceptions and without any warranty. For full license |
7 | and copyright information, see https://civicrm.org/licensing |
8 +--------------------------------------------------------------------+
11 {* template for a single row *}
13 <tr class="string-override-row {if $soInstance % 2}odd{else}even{/if}-row" data-row="{$soInstance}"
14 xmlns="http://www.w3.org/1999/html">
15 <td>{$form.enabled.$soInstance.html}</td>
16 <td>{$form.old.$soInstance.html}</td>
17 <td>{$form.new.$soInstance.html}</td>
18 <td>{$form.cb.$soInstance.html}</td>
22 {* this template is used for adding/editing string overrides *}
24 {ts}Use <strong>Word Replacements</strong> to change all occurrences of a word or phrase in CiviCRM screens (e.g. replace all occurrences of 'Contribution' with 'Donation').{/ts} {help id="id-word_replace"}
26 <div class="crm-form crm-form-block crm-string_override-form-block">
27 <div class="crm-submit-buttons">
28 {include file="CRM/common/formButtons.tpl" location='top'}
30 <table class="form-layout-compressed">
33 <table class="string-override-table row-highlight">
35 <tr class="columnheader">
36 <th>{ts}Enabled{/ts}</th>
37 <th>{ts}Original{/ts}</th>
38 <th>{ts}Replacement{/ts}</th>
39 <th>{ts}Exact Match{/ts}</th>
43 {section name="numStrings" start=1 step=1 loop=$numStrings+1}
44 {include file="CRM/Admin/Form/WordReplacements.tpl" soInstance=$smarty.section.numStrings.index}
48 <a class="action-item crm-hover-button buildStringOverrideRow" href="#"><i class="crm-i fa-plus-circle" aria-hidden="true"></i> {ts}Add row{/ts}</a>
52 <div class="crm-submit-buttons">
53 {include file="CRM/common/formButtons.tpl" location='bottom'}
58 <script type="text/javascript">
61 {if $stringOverrideInstances}
62 {* Rebuild necessary rows in case of form error *}
63 {foreach from=$stringOverrideInstances key="index" item="instance"}
64 buildStringOverrideRow( {$instance} );
69 function buildStringOverrideRow( curInstance ) {
73 // Don't fetch if already present
74 if ($('tr.string-override-row[data-row=' + curInstance + ']').length) {
77 newRowNum = curInstance;
79 newRowNum = 1 + $('tr.string-override-row:last').data('row');
82 var dataUrl = {/literal}"{crmURL q='snippet=4' h=0}"{literal};
83 dataUrl += "&instance="+newRowNum;
88 success: function(html) {
89 $('.string-override-table tbody').append(html);
90 $('tr.string-override-row:last').trigger('crmLoad');
95 $('.buildStringOverrideRow').click(function(e) {
96 buildStringOverrideRow(false);
100 // Auto-check new items
101 $('.string-override-table').on('keyup', 'textarea', function() {
102 if (!$(this).data('crm-initial-value')) {
103 var otherValue = $(this).closest('tr').find('textarea').not(this).val();
104 if ($(this).val() && otherValue) {
105 $(this).closest('tr').find('input[type=checkbox]').first().prop('checked', true);