{*
+--------------------------------------------------------------------+
- | CiviCRM version 4.4 |
+ | CiviCRM version 4.5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013 |
+ | Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
<table class="form-layout-compressed">
{if $form.attachFile_1}
{if $context EQ 'pcpCampaign'}
- <div class="description">{ts}You can upload a picture or image to include on your page. Your file should be in .jpg, .gif, or .png format. Recommended image size is 250 x 250 pixels. Maximum size is 360 x 360 pixels.{/ts}</div>
+ <div class="description">{ts}You can upload a picture or image to include on your page. Your file should be in .jpg, .gif, or .png format. Recommended image size is 250 x 250 pixels. Images over 360 pixels wide will be automatically resized to fit.{/ts}</div>
{/if}
<tr>
<td class="label">{$form.attachFile_1.label}</td>
- <td>{$form.attachFile_1.html} {$form.attachDesc_1.html}<a href="#" class="crm-hover-button" title="{ts}Clear{/ts}" onclick="clearAttachment( '#attachFile_1', '#attachDesc_1' ); return false;"><span class="icon close-icon"></span></a><br />
- <span class="description">{ts}Browse to the <strong>file</strong> you want to upload.{/ts}{if $maxAttachments GT 1} {ts 1=$maxAttachments}You can have a maximum of %1 attachment(s).{/ts}{/if} {ts 1=$config->maxFileSize}Each file must be less than %1M in size. You can also add a short description.{/ts}</span>
+ <td>{$form.attachFile_1.html} {$form.attachDesc_1.html}<a href="#" class="crm-hover-button crm-clear-attachment" style="visibility: hidden;" title="{ts}Clear{/ts}"><span class="icon close-icon"></span></a>
+ <div class="description">{ts}Browse to the <strong>file</strong> you want to upload.{/ts}{if $maxAttachments GT 1} {ts 1=$maxAttachments}You can have a maximum of %1 attachment(s).{/ts}{/if} {ts 1=$config->maxFileSize}Each file must be less than %1M in size. You can also add a short description.{/ts}</div>
</td>
</tr>
{if $form.tag_1.html}
<tr>
- <td></td>
- <td><label>{$form.tag_1.label}</label> <div class="crm-select-container crm-attachment-tags">{$form.tag_1.html}</div></td>
+ <td class="label">{$form.tag_1.label}</td>
+ <td><div class="crm-select-container crm-attachment-tags">{$form.tag_1.html}</div></td>
</tr>
{/if}
- {if $tagsetInfo_attachment}
- <tr><td></td><td>{include file="CRM/common/Tag.tpl" tagsetType='attachment' tagsetNumber=1 }</td></tr>
+ {if $tagsetInfo.file}
+ <tr>{include file="CRM/common/Tagset.tpl" tagsetType='file' tableLayout=true tagsetElementName="file_taglist_1"}</tr>
{/if}
{section name=attachLoop start=2 loop=$numAttachments+1}
{assign var=index value=$smarty.section.attachLoop.index}
<tr class="attachment-fieldset"><td colspan="2"></td></tr>
<tr>
<td class="label">{$form.attachFile_1.label}</td>
- <td>{$form.$attachName.html} {$form.$attachDesc.html}<a href="#" class="crm-hover-button" title="{ts}Clear{/ts}" onclick="clearAttachment( '#{$attachName}' ); return false;"><span class="icon close-icon"></span></a></td>
+ <td>{$form.$attachName.html} {$form.$attachDesc.html}<a href="#" class="crm-hover-button crm-clear-attachment" style="visibility: hidden;" title="{ts}Clear{/ts}"><span class="icon close-icon"></span></a></td>
</tr>
<tr>
- <td></td>
- <td><label>{$form.$tagElement.label}</label> <div class="crm-select-container crm-attachment-tags">{$form.$tagElement.html}</div></td>
+ <td class="label">{$form.$tagElement.label}</td>
+ <td><div class="crm-select-container crm-attachment-tags">{$form.$tagElement.html}</div></td>
</tr>
- {if $tagsetInfo_attachment}
- <tr><td></td><td>{include file="CRM/common/Tag.tpl" tagsetType='attachment' tagsetNumber=$index}</td></tr>
+ {if $tagsetInfo.file}
+ <tr>{include file="CRM/common/Tagset.tpl" tagsetType='file' tableLayout=true tagsetElementName="file_taglist_$index"}</tr>
{/if}
{/section}
</div>
</div><!-- /.crm-accordion-body -->
</div><!-- /.crm-accordion-wrapper -->
- {if !$noexpand}
{literal}
<script type="text/javascript">
- cj(function() {
- cj().crmAccordions();
- });
- </script>
- {/literal}
- {/if}
- {literal}
- <script type="text/javascript">
- function clearAttachment( element, desc ) {
- cj(element).val('');
- cj(desc).val('');
- }
+ CRM.$(function($) {
+ var $form = $("form.{/literal}{$form.formClass}{literal}");
+ $form
+ .on('click', '.crm-clear-attachment', function(e) {
+ e.preventDefault();
+ $(this).css('visibility', 'hidden').closest('td').find(':input').val('');
+ })
+ .on('change', '#attachments :input', function() {
+ $(this).closest('td').find('.crm-clear-attachment').css('visibility', 'visible');
+ });
+ });
</script>
{/literal}
{/if} {* edit/add if*}