From 0abd4676b76e122628aa8d85add151c01c2eeecb Mon Sep 17 00:00:00 2001 From: eileen Date: Mon, 13 Feb 2017 11:03:03 +1300 Subject: [PATCH] CRM-19490 Use fields.tpl for common code. The preview.tpl should leverage other profile rendering of fields rather than being copy & paste. This allows the date changes to filter through. I have sacrificed the table for this - but we are ditching table somewhat. Arguably we should change the container id to crm-container in order to get a more front-end visual of the fields. --- templates/CRM/UF/Form/Preview.tpl | 101 +----------------------------- 1 file changed, 1 insertion(+), 100 deletions(-) diff --git a/templates/CRM/UF/Form/Preview.tpl b/templates/CRM/UF/Form/Preview.tpl index 6bede7d17b..cc4b5cf7d9 100644 --- a/templates/CRM/UF/Form/Preview.tpl +++ b/templates/CRM/UF/Form/Preview.tpl @@ -40,109 +40,10 @@ {if $help_pre && $action neq 4}
{$help_pre}
{/if} {assign var=zeroField value="Initial Non Existent Fieldset"} {assign var=fieldset value=$zeroField} - {foreach from=$fields item=field key=fieldName} - {if $field.skipDisplay} - {continue} - {/if} - {if $field.groupTitle != $fieldset} - {if $fieldset != $zeroField} - - {if $groupHelpPost} -
{$groupHelpPost}
- {/if} - {if $mode ne 8} - - {/if} - {/if} - {if $mode ne 8} -

{$field.groupTitle}

- {/if} - {assign var=fieldset value=`$field.groupTitle`} - {assign var=groupHelpPost value=`$field.groupHelpPost`} - {if $field.groupHelpPre} -
{$field.groupHelpPre}
- {/if} - - {/if} - {* Show explanatory text for field if not in 'view' mode *} - {if $field.help_pre && $action neq 4 && $field.field_type neq "Formatting"} - - {/if} - {assign var=n value=$field.name} - {if $field.field_type eq "Formatting"} - - {elseif $field.options_per_line } - - - - - {else} - - - - - {/if} - {* Show explanatory text for field if not in 'view' mode *} - {if $field.help_post && $action neq 4} - - {/if} - {/foreach} - + {include file="CRM/UF/Form/Fields.tpl"} {if $addCAPTCHA } {include file='CRM/common/ReCAPTCHA.tpl'} {/if} -
 {$field.help_pre}
{$field.help_pre}
{$form.$n.label} - {assign var="count" value="1"} - {strip} - - - {* sort by fails for option per line. Added a variable to iterate through the element array*} - {assign var="index" value="1"} - {foreach name=outer key=key item=item from=$form.$n} - {if $index < 10} - {assign var="index" value=`$index+1`} - {else} - - {if $count == $field.options_per_line} - - {assign var="count" value="1"} - {else} - {assign var="count" value=`$count+1`} - {/if} - {/if} - {/foreach} -
{$form.$n.$key.html}
- {/strip} -
- {$form.$n.label} - - {if $n eq 'group' && $form.group || ( $n eq 'tag' && $form.tag )} - {include file="CRM/Contact/Form/Edit/TagsAndGroups.tpl" type=$n} - {elseif $n eq 'email_greeting' or $n eq 'postal_greeting' or $n eq 'addressee'} - {include file="CRM/Profile/Form/GreetingType.tpl"} - {elseif ( $n|substr:-5:5 eq '_date' ) or ( $field.name eq 'activity_date_time' ) } - {include file="CRM/common/jcalendar.tpl" elementName=$form.$n.name} - {elseif $n|substr:0:5 eq 'phone'} - {assign var="phone_ext_field" value=$n|replace:'phone':'phone_ext'} - {$form.$n.html} - {if $form.$phone_ext_field.html} -  {$form.$phone_ext_field.html} - {/if} - {else} - {if $n|substr:0:3 eq 'im-'} - {assign var="provider" value=$n|cat:"-provider_id"} - {$form.$provider.html}  - {/if} - {$form.$n.html} - {if $field.is_view eq 0} - {if $field.html_type eq 'Autocomplete-Select'} - {if $field.data_type eq 'ContactReference'} - {include file="CRM/Custom/Form/ContactReference.tpl" element_name = $n} - {/if} - {/if} - {/if} - {/if} -
 {$field.help_post}
{if $field.groupHelpPost}
{$field.groupHelpPost}
{/if} -- 2.25.1