7601a03268906854637fbe4078187e1b4fb01fe0

Author: Mark Story

Date: 2009-02-05 23:46:05 -0500

Adding global functions to search results, Fixing log output when updating index. Making search a little less fickle.

diff --git a/models/api_class.php b/models/api_class.php index 2ae6203..aaf0211 100644 --- a/models/api_class.php +++ b/models/api_class.php @@ -143,8 +143,8 @@ class ApiClass extends ApiGeneratorAppModel { $conditions = array(); foreach ($terms as $term) { $conditions['OR'][] = array('ApiClass.slug LIKE' => $term . '%'); - $conditions['OR'][] = array('ApiClass.method_index LIKE' => '% ' . $term . '%'); - $conditions['OR'][] = array('ApiClass.property_index LIKE' => '% ' . $term . '%'); + $conditions['OR'][] = array('ApiClass.method_index LIKE' => '%' . $term . '%'); + $conditions['OR'][] = array('ApiClass.property_index LIKE' => '%' . $term . '%'); } $results = $this->find('all', compact('conditions', 'order', 'fields')); return $this->_queryFiles($results, $terms); diff --git a/vendors/shells/api_index.php b/vendors/shells/api_index.php index 0cef498..e2f7acc 100644 --- a/vendors/shells/api_index.php +++ b/vendors/shells/api_index.php @@ -146,7 +146,7 @@ class ApiIndexShell extends Shell { if (!empty($docsInFile['function'])) { $this->ApiClass->create(); if ($this->ApiClass->savePseudoClassDocs($docsInFile['function'], $file)) { - $this->out('Added docs for global functions in ' . $file); + $this->out('Added docs for global functions in ' . basename($file)); } } } diff --git a/views/api_generator/search.ctp b/views/api_generator/search.ctp index 89e3a83..fed353f 100644 --- a/views/api_generator/search.ctp +++ b/views/api_generator/search.ctp @@ -13,20 +13,47 @@ endif; ?> <ul id="search-results"> <?php foreach ($docs as $result): - foreach ($result['class'] as $name => $doc): ?> - <li class="doc-block class-info"> - <h2><?php echo $apiDoc->classLink($doc->name, array(), array('class' => false)); ?></h2><?php - if ($doc->properties): - echo $this->element('properties', array('doc' => $doc, 'isSearch' => true)); - endif; + if (isset($result['function'])): + foreach($result['function'] as $name => $doc): ?> + <li class="doc-block function-info"> + <h2><?php echo $apiDoc->fileLink($doc->info['declaredInFile']); ?></h2> + <div class="doc-body"> + <table class="summary"> + <tbody> + <tr class="even"> + <td class="access public"><span>public</span></td> + <td> + <?php + echo $html->link($doc->info['signature'], + array('action' => 'view_file', $apiDoc->trimFileName($doc->info['declaredInFile']), + '#' => 'function-' . $doc->name), + array('class' => 'scroll-link') + ); + ?> + </td> + </tr> + </tbody> + </table> + + </div> + </li> +<?php endforeach; + elseif (isset($result['class'])) : + foreach ($result['class'] as $name => $doc): ?> + <li class="doc-block class-info"> + <h2><?php echo $apiDoc->classLink($doc->name, array(), array('class' => false)); ?></h2><?php + if ($doc->properties): + echo $this->element('properties', array('doc' => $doc, 'isSearch' => true)); + endif; - if ($doc->methods): - echo $this->element('method_summary', array('doc' => $doc, 'isSearch' => true)); - endif; -?> - </li> -<?php - endforeach; + if ($doc->methods): + echo $this->element('method_summary', array('doc' => $doc, 'isSearch' => true)); + endif; + ?> + </li> + <?php + endforeach; + endif; endforeach; ?> </ul> \ No newline at end of file