[17483] | 1 | {combine_css path=$CONTACT_FORM_PATH|@cat:"admin/template/style.css"} |
---|
| 2 | |
---|
| 3 | {footer_script}{literal} |
---|
| 4 | jQuery(document).on('change', '.delete', function() { |
---|
| 5 | if ($(this).is(':checked')) { |
---|
| 6 | $(this).parents('tr').addClass('delete'); |
---|
| 7 | } else { |
---|
| 8 | $(this).parents('tr').removeClass('delete'); |
---|
| 9 | } |
---|
| 10 | }); |
---|
| 11 | {/literal}{/footer_script} |
---|
| 12 | |
---|
| 13 | <div class="titrePage"> |
---|
| 14 | <h2>Contact Form</h2> |
---|
| 15 | </div> |
---|
| 16 | |
---|
| 17 | <form method="post" action="{$CONTACT_FORM_ADMIN}-emails" class="properties"> |
---|
| 18 | <table class="table2" id="emails"> |
---|
| 19 | <tr class="throw"> |
---|
| 20 | <th>{'Name'|@translate}</th> |
---|
| 21 | <th>{'Email address'|@translate}</th> |
---|
| 22 | <th>{'Active'|@translate}</th> |
---|
| 23 | <th>{'Delete'|@translate}</th> |
---|
| 24 | </tr> |
---|
| 25 | {counter start=0 assign=i} |
---|
| 26 | {foreach from=$EMAILS item=entry} |
---|
| 27 | <tr class="{if $i is odd}row1{else}row2{/if}"> |
---|
| 28 | <td> |
---|
| 29 | <input type="text" name="emails[{$i}][name]" value="{$entry.name}" size="20"> |
---|
| 30 | </td> |
---|
| 31 | <td> |
---|
| 32 | <input type="text" name="emails[{$i}][email]" value="{$entry.email}" size="30"> |
---|
| 33 | </td> |
---|
| 34 | <td style="text-align:center;"> |
---|
| 35 | <input type="checkbox" name="emails[{$i}][active]" value="1" {if $entry.active}checked="checked"{/if}> |
---|
| 36 | </td> |
---|
| 37 | <td style="text-align:center;"> |
---|
| 38 | <input type="checkbox" name="emails[{$i}][delete]" value="1" class="delete"> |
---|
| 39 | </td> |
---|
| 40 | </tr> |
---|
| 41 | {counter} |
---|
| 42 | {/foreach} |
---|
| 43 | <tr class="{if $i is odd}row1{else}row2{/if}" id="addEntryContainer"> |
---|
| 44 | <td colspan="4"> |
---|
| 45 | <a id="addEntry">{'+ Add an email'|@translate}</a> |
---|
| 46 | </td> |
---|
| 47 | </tr> |
---|
| 48 | </table> |
---|
| 49 | {footer_script}var entry = {$i};{/footer_script} |
---|
| 50 | |
---|
| 51 | <p><input type="submit" name="save_emails" value="{'Submit'|@translate}" class="submit"></p> |
---|
| 52 | </form> |
---|
| 53 | |
---|
| 54 | {footer_script}{literal} |
---|
| 55 | jQuery('#addEntry').click(function() { |
---|
| 56 | entry++; |
---|
| 57 | i = entry; |
---|
| 58 | |
---|
| 59 | $('#emails').append( |
---|
| 60 | '<tr class="row'+ (i%2+1) +'">'+ |
---|
| 61 | '<td>'+ |
---|
| 62 | '<input type="text" name="emails['+ i +'][name]" size="20">'+ |
---|
| 63 | '</td>'+ |
---|
| 64 | '<td>'+ |
---|
| 65 | '<input type="text" name="emails['+ i +'][email]" size="30">'+ |
---|
| 66 | '</td>'+ |
---|
| 67 | '<td style="text-align:center;">'+ |
---|
| 68 | '<input type="checkbox" name="emails['+ i +'][active]" value="1" checked="checked">'+ |
---|
| 69 | '</td>'+ |
---|
| 70 | '<td style="text-align:center;">'+ |
---|
| 71 | '<input type="checkbox" name="emails['+ i +'][delete]" value="1" class="delete">'+ |
---|
| 72 | '</td>'+ |
---|
| 73 | '</tr>' |
---|
| 74 | ); |
---|
| 75 | |
---|
| 76 | $('#addEntryContainer') |
---|
| 77 | .removeClass('row1 row2') |
---|
| 78 | .addClass('row'+ Math.abs(i%2-2)) |
---|
| 79 | .appendTo($('#emails')); |
---|
| 80 | }); |
---|
| 81 | {/literal}{/footer_script} |
---|