show all links on list page

This commit is contained in:
cornernote 2015-08-11 17:08:10 +09:30
parent b48af47faa
commit c2219ce059
3 changed files with 8 additions and 6 deletions

View File

@ -374,20 +374,22 @@ class Package extends ActiveRecord
}
/**
* @param bool $inline
* @return string
* @throws \Exception
*/
public function getLinksHtml()
public function getLinksHtml($inline = true)
{
$items = [];
if ($this->homepage && $this->homepage != Git::getUrl($this->url)) {
if ($this->homepage && $this->homepage != Git::getUrl($this->url) && $this->homepage != $this->forum) {
$items[] = ['label' => 'Homepage', 'url' => $this->homepage];
}
$items[] = ['label' => 'Project', 'url' => Git::getUrl($this->url)];
if ($this->forum) {
$items[] = ['label' => 'Forum', 'url' => $this->forum];
}
$items[] = ['label' => 'Project', 'url' => Git::getUrl($this->url)];
return Menu::widget([
'options' => ['class' => 'list-unstyled', 'style' => 'margin-bottom:0;'],
'options' => ['class' => 'list-unstyled' . ($inline ? ' list-inline' : ''), 'style' => 'margin-bottom:0;'],
'items' => $items,
]);
}

View File

@ -19,7 +19,7 @@ use yii\widgets\DetailView;
'attributes' => [
'description',
'keywords',
'homepage:url',
'linksHtml:raw',
],
]) ?>
</div>

View File

@ -38,7 +38,7 @@ $this->params['breadcrumbs'][] = $this->title;
'keywords',
[
'label' => 'Links',
'value' => $model->getLinksHtml(),
'value' => $model->getLinksHtml(false),
'format' => 'raw',
],
[