Commit: 1ec53245613ba493becc7e734210f81c96b3249f

Author: Nate Abele | Date: 2010-03-08 09:27:08 -0500
Changing method source display to a toggle button that defaults to hidden. Moving to bottom of page.
diff --git a/views/browser/view.html.php b/views/browser/view.html.php index 21c4cc7..c555b92 100644 --- a/views/browser/view.html.php +++ b/views/browser/view.html.php @@ -75,14 +75,6 @@ $curPath = str_replace('\\', '/', $name); </span> <?php } ?> -<?php // Method source ?> -<?php if (isset($object['source'])) { ?> - <h4>Source</h4> - <pre> - <code><?php echo $object['source']; ?></code> - </pre> -<?php } ?> - <?php // Related items ?> <?php if (isset($object['info']['tags']['see'])) { ?> <h4><?=$t('Related', array('scope' => 'li3_docs')); ?></h4> @@ -123,4 +115,12 @@ $curPath = str_replace('\\', '/', $name); <li><?php echo $this->html->link($class, $url); ?></li> <?php } ?> </ul> -<?php } ?> \ No newline at end of file +<?php } ?> + +<?php // Method source ?> +<?php if (isset($object['source'])) { ?> + <pre class="source-code"> + <code><?php echo $object['source']; ?></code> + </pre> + <button class="source-toggle">Show source</button> +<?php } ?> diff --git a/views/layouts/default.html.php b/views/layouts/default.html.php index e09521a..2a2f663 100644 --- a/views/layouts/default.html.php +++ b/views/layouts/default.html.php @@ -50,9 +50,18 @@ <script type="text/javascript" charset="utf-8"> $(document).ready(function () { var converter = new Showdown.converter("/"); + $(".markdown").each(function () { $(this).html(converter.makeHtml($.trim($(this).text()))); }); + + $('pre.source-code').hide(); + + $('.source-toggle').bind('click', function() { + visible = $('pre.source-code').is(':visible'); + $(this).text((visible ? 'Show' : 'Hide') + ' source'); + visible ? $('pre.source-code').slideUp() : $('pre.source-code').slideDown(); + }); }); </script> </body>