| 1 | <?php use_helper('I18N') ?> |
|---|
| 2 | <?php if (!isset($controlsSlot)): ?> |
|---|
| 3 | <?php $controlsSlot = true ?> |
|---|
| 4 | <?php endif ?> |
|---|
| 5 | |
|---|
| 6 | <?php if ($controlsSlot): ?> |
|---|
| 7 | <?php slot("a-slot-controls-$pageid-$name-$permid") ?> |
|---|
| 8 | <?php endif ?> |
|---|
| 9 | |
|---|
| 10 | <li class="a-controls-item edit"> |
|---|
| 11 | <?php echo jq_link_to_function(isset($label) ? __($label, null, 'apostrophe') : __("edit", null, 'apostrophe'), "", |
|---|
| 12 | array( |
|---|
| 13 | 'id' => "a-slot-edit-$pageid-$name-$permid", |
|---|
| 14 | 'class' => isset($class) ? $class : 'a-btn icon a-edit', |
|---|
| 15 | 'title' => isset($title) ? $title : __('Edit', null, 'apostrophe'), |
|---|
| 16 | )) ?> |
|---|
| 17 | |
|---|
| 18 | <script type="text/javascript" charset="utf-8"> |
|---|
| 19 | <?php // TODO: Rewrite this as a button class scoped to ALL edit buttons so there's only a single instance of this Javascript ?> |
|---|
| 20 | $(document).ready(function(){ |
|---|
| 21 | var editBtn = $('#a-slot-edit-<?php echo "$pageid-$name-$permid" ?>'); |
|---|
| 22 | var editSlot = $('#a-slot-<?php echo "$pageid-$name-$permid" ?>'); |
|---|
| 23 | editBtn.click(function(event){ |
|---|
| 24 | editBtn.parents('.a-slot, .a-area').addClass('editing-now'); <?php // Apply a class to the Area and Slot Being Edited ?> |
|---|
| 25 | editSlot.children('.a-slot-content').children('.a-slot-content-container').hide(); <?php // Hide the Content Container ?> |
|---|
| 26 | editSlot.children('.a-slot-content').children('.a-slot-form').fadeIn(); <?php // Fade In the Edit Form ?> |
|---|
| 27 | editSlot.children('.a-controls-item variant').hide(); <?php // Hide the Variant Options ?> |
|---|
| 28 | aUI(editBtn.parents('.a-slot').attr('id')); <?php // Refresh the UI scoped to this Slot ?> |
|---|
| 29 | return false; |
|---|
| 30 | }); |
|---|
| 31 | }); |
|---|
| 32 | </script> |
|---|
| 33 | </li> |
|---|
| 34 | |
|---|
| 35 | <?php if ($controlsSlot): ?> |
|---|
| 36 | <?php end_slot() ?> |
|---|
| 37 | <?php endif ?> |
|---|
| 38 | |
|---|
| 39 | |
|---|