Skip to content

Commit

Permalink
update config
Browse files Browse the repository at this point in the history
  • Loading branch information
saleem-hadad committed Jun 28, 2019
1 parent c913fa2 commit d681b27
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion publishable/config/larecipe.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
'versions' => [
'default' => '1.0',
'published' => [
'1.0'
'1.0' => ['en'],
]
],

Expand Down
2 changes: 1 addition & 1 deletion resources/views/partials/nav.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class="px-4">

<template slot="list">
<ul class="list-reset">
@foreach ($versions as $version)
@foreach (array_keys($versions) as $version)
<li class="py-2 hover:bg-grey-lightest">
<a class="px-6 text-grey-darkest" href="{{ route('larecipe.show', ['version' => $version, 'page' => $currentSection]) }}">{{ $version }}</a>
</li>
Expand Down
10 changes: 10 additions & 0 deletions src/DocumentationRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,18 @@ protected function prepareCanonical()
*/
public function isPublishedVersion($version)
{
if($this->isAssoc($this->publishedVersions)) {
return array_key_exists($version, $this->publishedVersions);
}

return in_array($version, $this->publishedVersions);
}

function isAssoc(array $arr)
{
if (array() === $arr) return false;
return array_keys($arr) !== range(0, count($arr) - 1);
}

/**
* Check if the given version is not in the published versions.
Expand Down

0 comments on commit d681b27

Please sign in to comment.