Skip to content

Commit

Permalink
added normalizeScopedName
Browse files Browse the repository at this point in the history
  • Loading branch information
hiqsol committed Oct 1, 2017
1 parent 9f54f52 commit eb5f5d9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/models/AssetPackage.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ class AssetPackage extends Object

public static function normalizeName($name)
{
return strtolower($name);
return strtolower(static::normalizeScopedName($name));
}

public static function normalizeScopedName($name)
{
return preg_replace("#@(.+?)/#", '${1}--', $name);
}

/**
Expand Down
5 changes: 3 additions & 2 deletions src/views/package/_search_item.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@
$logoUrl = $bundle->baseUrl . '/logo';
$package = new AssetPackage(strtolower($model->platform), $model->name);

$url = Url::to(['package/detail', 'fullname' => $package->fullName]);
$url = Url::to(['package/detail', 'fullname' => $package->getNormalName()]);
$url = str_replace('%2F', '/', $url);
?>
<div class="row well well-sm">
<div class="col-sm-9">
<h4 class="search-result-item-heading">
<img src="<?= $logoUrl . '/' . strtolower($model->platform) ?>.svg" title="<?= Html::encode($model->platform) ?>" height="20px" />
<a href="<?= $url ?>"><?= Html::encode($package->fullName) ?></a>
<span class="small text-muted"><?= $package->getName() ?></span>
<a href="<?= $url ?>"><?= Html::encode($package->getNormalName()) ?></a>
</h4>
<?php if ($model->description): ?>
<p class="description"><?= Html::encode($model->description) ?></p>
Expand Down

0 comments on commit eb5f5d9

Please sign in to comment.