Merge pull request #99 from webbuilders-group/duplicate-home-fix

BUGFIX: Fixed duplicate Home links appearing
This commit is contained in:
Cam Findlay 2016-03-01 10:35:56 +13:00
commit 405af6b377
3 changed files with 33 additions and 2 deletions

View File

@ -61,6 +61,11 @@ class DocumentationManifest
*/
private $entity;
/**
* @var boolean
*/
private $has_default_entity = false;
/**
* @var boolean
*/
@ -157,6 +162,9 @@ class DocumentationManifest
if (isset($details['DefaultEntity'])) {
$entity->setIsDefaultEntity($details['DefaultEntity']);
if ($entity->getIsDefaultEntity()) {
$this->has_default_entity = true;
}
}
$this->registeredEntities->push($entity);
@ -760,4 +768,13 @@ class DocumentationManifest
return $versions;
}
/**
* Gets whether there is a default entity or not
* @return boolean
*/
public function getHasDefaultEntity()
{
return $this->has_default_entity;
}
}

View File

@ -710,4 +710,14 @@ class DocumentationViewer extends Controller
{
return Config::inst()->get('DocumentationViewer', 'link_base');
}
/**
* Gets whether there is a default entity or not
* @return boolean
* @see DocumentationManifest::getHasDefaultEntity()
*/
public function getHasDefaultEntity()
{
return $this->getManifest()->getHasDefaultEntity();
}
}

View File

@ -3,10 +3,14 @@
$DocumentationSearchForm
<ul class="nav">
<% if not HasDefaultEntity %>
<li><a href="$Link" class="top">Home</a></li>
<% end_if %>
<% loop Menu %>
<li><a href="$Link" class="top">Home</a></li>
<% if DefaultEntity %>
<li><a href="$Link" class="top">Home</a></li>
<% loop Children %>
<li class="$LinkingMode <% if Last %>last<% end_if %>">
<a href="$Link" class="top">$Title</a>