Skip to content
This repository has been archived by the owner on May 1, 2019. It is now read-only.

Commit

Permalink
Merge pull request #371 from ins0/feature/search-results
Browse files Browse the repository at this point in the history
Feature: added message for none results on search
  • Loading branch information
Ocramius committed Feb 7, 2015
2 parents 294f274 + 49d6d52 commit 329ed86
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 51 deletions.
87 changes: 48 additions & 39 deletions module/Application/view/application/index/index.phtml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php $this->headTitle(sprintf('Browse %d modules for Zend Framework 2', $this->totalModules())); ?>
<?php $this->inlineScript()->appendScript('$(\'#live-search input[name="query"]\').liveSearch({url: "' . $this->url('live-search', [], ['query' => ['query' => '']]) . '"});'); ?>
<div class="row">
<div class="span8">
<div class="row-fluid">
Expand All @@ -14,53 +13,63 @@
</div>
</div>
</div>
<?php foreach ($this->repositories as $module): ?>
<?php /* @var ZfModule\Entity\Module $module */ ?>
<div class="row-fluid module-row">
<div class="span12">
<div class="row-fluid">
<div class="module-info">
<div class="span6 module-author">
<div class="row-fluid">
<div class="span3">
<img src="<?php echo $this->escapeHtmlAttr($module->getPhotoUrl()) ?>" alt="<?php echo $this->escapeHtmlAttr($module->getOwner()) ?>" class="avatar">
</div>
<div class="span9">
<strong><?php echo $this->escapeHtml($module->getOwner()) ?></strong>
<p>
<span class="author-label">Github:</span>
<a href="<?php echo $this->escapeHtmlAttr($module->getUrl()) ?>"><?php echo $this->escapeHtml($module->getName()) ?></a>
</p>
<?php if (count($this->repositories) >= 1): ?>
<?php foreach ($this->repositories as $module): ?>
<?php /* @var ZfModule\Entity\Module $module */ ?>
<div class="row-fluid module-row">
<div class="span12">
<div class="row-fluid">
<div class="module-info">
<div class="span6 module-author">
<div class="row-fluid">
<div class="span3">
<img src="<?php echo $this->escapeHtmlAttr($module->getPhotoUrl()) ?>" alt="<?php echo $this->escapeHtmlAttr($module->getOwner()) ?>" class="avatar">
</div>
<div class="span9">
<strong><?php echo $this->escapeHtml($module->getOwner()) ?></strong>
<p>
<span class="author-label">Github:</span>
<a href="<?php echo $this->escapeHtmlAttr($module->getUrl()) ?>"><?php echo $this->escapeHtml($module->getName()) ?></a>
</p>
</div>
</div>
</div>
<div class="span6">
<strong>
<a href="<?php echo $this->url('view-module', ['vendor' => $this->escapeUrl($module->getOwner()), 'module' => $this->escapeUrl($module->getName())]) ?>">
<?php echo $this->escapeHtml($module->getName()) ?>
</a>
</strong>
<p>
<span class="author-label">Created:</span> <?php echo $module->getCreatedAtDateTime()->format('Y-m-d') ?><br>
</p>
</div>
<div style="clear: both;"></div>
</div>
<div class="span6">
<strong>
<a href="<?php echo $this->url('view-module', ['vendor' => $this->escapeUrl($module->getOwner()), 'module' => $this->escapeUrl($module->getName())]) ?>">
<?php echo $this->escapeHtml($module->getName()) ?>
</a>
</strong>
<p>
<span class="author-label">Created:</span> <?php echo $module->getCreatedAtDateTime()->format('Y-m-d') ?><br>
</p>
</div>
<div style="clear: both;"></div>
</div>
</div>
<div class="row-fluid">
<div class="module-description">
<div class="span12">
<p>
<?php echo $this->escapeHtml($module->getDescription()) ?>
</p>
<div class="row-fluid">
<div class="module-description">
<div class="span12">
<p>
<?php echo $this->escapeHtml($module->getDescription()) ?>
</p>
</div>
<div style="clear: both;"></div>
</div>
<div style="clear: both;"></div>
</div>
</div>
</div>
<?php endforeach; ?>
<?php echo $this->paginationControl($this->repositories, 'Sliding', 'application/index/pagination', ['query' => $this->query]) ?>
<?php else: ?>
<div class="well">
<?php if($this->query): ?>
<b>No modules found that match your search criteria "<?php echo $this->escapeHtml($this->query); ?>"</b>
<?php else: ?>
<b>No modules found</b>
<?php endif; ?>
</div>
<?php endforeach; ?>
<?php echo $this->paginationControl($this->repositories, 'Sliding', 'application/index/pagination', ['query' => $this->query]) ?>
<?php endif; ?>
</div>
<div class="span4">
<div class="sidebar">
Expand Down
28 changes: 16 additions & 12 deletions module/Application/view/application/search/index.phtml
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
<?php foreach ($results as $module): ?>
<div class="row-fluid">
<div class="span12">
<div class="span2">
<img src="<?php echo $this->escapeHtmlAttr($module->getPhotoUrl()) ?>" alt="<?php echo $this->escapeHtmlAttr($module->getName()) ?>" class="avatar">
</div>
<div class="span10">
<a href="<?php echo $this->escapeHtmlAttr($module->getUrl()) ?>"><?php echo $this->escapeHtml($module->getName()) ?></a><br>
<?php echo $this->escapeHtml($module->getDescription()) ?>
<?php if (count($results) >= 1): ?>
<?php foreach ($results as $module): ?>
<div class="row-fluid">
<div class="span12">
<div class="span2">
<img src="<?php echo $this->escapeHtmlAttr($module->getPhotoUrl()) ?>" alt="<?php echo $this->escapeHtmlAttr($module->getName()) ?>" class="avatar">
</div>
<div class="span10">
<a href="<?php echo $this->escapeHtmlAttr($module->getUrl()) ?>"><?php echo $this->escapeHtml($module->getName()) ?></a><br>
<?php echo $this->escapeHtml($module->getDescription()) ?>
</div>
</div>
</div>
</div>
<hr style="margin:2px;padding:0;"/>
<?php endforeach; ?>
<hr style="margin:2px;padding:0;"/>
<?php endforeach; ?>
<?php else: ?>
<b>No modules found that match your search criteria</b>
<?php endif; ?>

0 comments on commit 329ed86

Please sign in to comment.