0e70eccd1a164118565239ac8c622c5b985b0655

Author: Mark Story

Date: 2009-07-14 22:20:36 -0400

Fixing issue in JS. Updating view file. Updating Shell to include new routes.

diff --git a/vendors/js/api_generator.js b/vendors/js/api_generator.js index 0029913..7656928 100644 --- a/vendors/js/api_generator.js +++ b/vendors/js/api_generator.js @@ -104,7 +104,7 @@ ApiGenerator.packageTree = { }); trees.getElements('ul').each(function (element) { element.hide(); - }) + }); } } diff --git a/vendors/shells/api_index.php b/vendors/shells/api_index.php index 5bbf78c..45f16da 100644 --- a/vendors/shells/api_index.php +++ b/vendors/shells/api_index.php @@ -83,13 +83,22 @@ class ApiIndexShell extends Shell { **/ public function set_routes() { $Routes = new File(CONFIGS . 'routes.php'); - $new = array( - "Router::connect('/class/*', array('plugin' => 'api_generator', 'controller' => 'api_generator', 'action' => 'view_class'));", - "Router::connect('/file/*', array('plugin' => 'api_generator', 'controller' => 'api_generator','action' => 'view_file'));", - "Router::connect('/:action/*', array('plugin' => 'api_generator', 'controller' => 'api_generator'), array('action' => 'classes|source|files|view_source'));", + $add = array( + "Router::connect('/classes', array('plugin' => 'api_generator', 'controller' => 'api_classes', 'action' => 'index'));", + "Router::connect('/class/*', array('plugin' => 'api_generator', 'controller' => 'api_classes', 'action' => 'view_class'));", + "Router::connect('/source', array('plugin' => 'api_generator', 'controller' => 'api_files', 'action' => 'source'));", + "Router::connect('/files', array('plugin' => 'api_generator', 'controller' => 'api_files', 'action' => 'files'));", + "Router::connect('/packages', array('plugin' => 'api_generator', 'controller' => 'api_packages', 'action' => 'index'));", + "Router::connect('/package/*', array('plugin' => 'api_generator', 'controller' => 'api_packages', 'action' => 'view'));" ); - - $data = rtrim(trim($Routes->read()), "?>") . "\n\n\t" . join("\n\n\t", $new); + $currentRoutes = trim($Routes->read()); + $new = array(); + foreach ($add as $newRoute) { + if (strpos($currentRoutes, $newRoute) === false) { + $new[] = $newRoute; + } + } + $data = rtrim($currentRoutes, "?>") . "\n\n\t" . join("\n\t", $new); if ($Routes->write($data)) { $this->out(__('Routes file updated')); return; diff --git a/views/api_packages/view.ctp b/views/api_packages/view.ctp index db98b16..80192cc 100644 --- a/views/api_packages/view.ctp +++ b/views/api_packages/view.ctp @@ -4,7 +4,7 @@ $apiDoc->setClassIndex($classIndex); <div class="api-package"> <h1><?php printf(__('%s Package', true), $apiPackage['ApiPackage']['name']); ?></h1> - <?php if(!empty($apiPackage['ParentPackage'])): ?> + <?php if(!empty($apiPackage['ParentPackage']['name'])): ?> <h3><?php __('Parent Package'); ?> </h3> <ul class="package-list"> <li><?php echo $apiDoc->packageLink($apiPackage['ParentPackage']['name']); ?></li>