| 1 | <?php if ($editable): ?> |
|---|
| 2 | <?php // Normally we have an editor inline in the page, but in this ?> |
|---|
| 3 | <?php // case we'd rather use the picker built into the media plugin. ?> |
|---|
| 4 | <?php // So we link to the media picker and specify an 'after' URL that ?> |
|---|
| 5 | <?php // points to our slot's edit action. Setting the ajax parameter ?> |
|---|
| 6 | <?php // to false causes the edit action to redirect to the newly ?> |
|---|
| 7 | <?php // updated page. ?> |
|---|
| 8 | <?php // Wrap controls in a slot to be inserted in a slightly different ?> |
|---|
| 9 | <?php // context by the _area.php template ?> |
|---|
| 10 | |
|---|
| 11 | <?php // Very short labels so sidebar slots don't have wrap in their controls. ?> |
|---|
| 12 | <?php // That spoils assumptions that are being made elsewhere that they will ?> |
|---|
| 13 | <?php // amount to only one row. TODO: find a less breakage-prone solution to that problem. ?> |
|---|
| 14 | |
|---|
| 15 | <?php slot("a-slot-controls-$pageid-$name-$permid") ?> |
|---|
| 16 | <li class="a-controls-item choose-image"> |
|---|
| 17 | <?php include_partial('aImageSlot/choose', array('action' => 'aButtonSlot/image', 'buttonLabel' => 'Choose image', 'label' => 'Select an Image', 'class' => 'a-btn icon a-media', 'type' => 'image', 'constraints' => $constraints, 'itemId' => $itemId, 'name' => $name, 'slug' => $slug, 'permid' => $permid)) ?> |
|---|
| 18 | </li> |
|---|
| 19 | <?php include_partial('a/simpleEditWithVariants', array('pageid' => $page->id, 'name' => $name, 'permid' => $permid, 'slot' => $slot, 'page' => $page, 'controlsSlot' => false)) ?> |
|---|
| 20 | <?php end_slot() ?> |
|---|
| 21 | <?php endif ?> |
|---|
| 22 | |
|---|
| 23 | <?php if ($item): ?> |
|---|
| 24 | <ul class="a-button"> |
|---|
| 25 | <li class="a-button-image"> |
|---|
| 26 | <?php $embed = str_replace( |
|---|
| 27 | array("_WIDTH_", "_HEIGHT_", "_c-OR-s_", "_FORMAT_"), |
|---|
| 28 | array($dimensions['width'], |
|---|
| 29 | $dimensions['height'], |
|---|
| 30 | $dimensions['resizeType'], |
|---|
| 31 | $dimensions['format']), |
|---|
| 32 | $embed) ?> |
|---|
| 33 | <?php if ($link): ?> |
|---|
| 34 | <?php $embed = "<a class=\"a-button-link\" href=\"$link\">$embed</a>" ?> |
|---|
| 35 | <?php endif ?> |
|---|
| 36 | <?php echo $embed ?> |
|---|
| 37 | </li> |
|---|
| 38 | <?php if (isset($img_title)): ?> |
|---|
| 39 | <li class="a-button-title"><a class="a-button-link" href="<?php echo $link ?>"><?php echo $img_title ?></a></li> |
|---|
| 40 | <?php endif ?> |
|---|
| 41 | <?php if ($description): ?> |
|---|
| 42 | <li class="a-button-description"><?php echo $item->description ?></li> |
|---|
| 43 | <?php endif ?> |
|---|
| 44 | </ul> |
|---|
| 45 | <?php else: ?> |
|---|
| 46 | <?php if ($defaultImage): ?> |
|---|
| 47 | <ul class="a-button default"> |
|---|
| 48 | <li class="a-button-image"> |
|---|
| 49 | <?php // Corner case: they've set the link but are still using the default image ?> |
|---|
| 50 | <?php if ($link): ?> |
|---|
| 51 | <?php echo link_to(image_tag($defaultImage), $link) ?> |
|---|
| 52 | <?php else: ?> |
|---|
| 53 | <?php echo image_tag($defaultImage) ?> |
|---|
| 54 | <?php endif ?> |
|---|
| 55 | </li> |
|---|
| 56 | </ul> |
|---|
| 57 | <?php endif ?> |
|---|
| 58 | <?php endif ?> |
|---|
| 59 | |
|---|
| 60 | <script type="text/javascript" charset="utf-8"> |
|---|
| 61 | $(document).ready(function() { |
|---|
| 62 | $('.a-button a').hover(function(){ |
|---|
| 63 | $(this).children('img').fadeTo(0,.5); |
|---|
| 64 | },function(){ |
|---|
| 65 | $(this).children('img').fadeTo(0,1); |
|---|
| 66 | }); |
|---|
| 67 | }); |
|---|
| 68 | </script> |
|---|