Skip to content

Commit 1f862c1

Browse files
committed
+ buildPackageUrl()
1 parent 150f226 commit 1f862c1

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

Diff for: src/registry/NpmRegistry.php

+7
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,11 @@
1414
class NpmRegistry extends \Fxp\Composer\AssetPlugin\Repository\NpmRepository
1515
{
1616
use RegistryTrait;
17+
18+
public $siteUrl = 'https://www.npmjs.com/';
19+
20+
public function buildPackageUrl($name)
21+
{
22+
return $this->siteUrl . 'package/' . $name;
23+
}
1724
}

Diff for: src/registry/RegistryTrait.php

+5
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,9 @@ public function getPackageSearchUrl($name)
4444
{
4545
return $this->siteUrl . '/search/?q=' . $name;
4646
}
47+
48+
public function buildPackageUrl($name)
49+
{
50+
return $this->getPackageSearchUrl($name);
51+
}
4752
}

Diff for: src/views/site/search.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<?php
2626
echo Html::a(
2727
Yii::t('app', 'see on {registry}', ['registry' => Inflector::titleize($package->getType())]),
28-
$package->getRegistry()->getPackageSearchUrl($package->getName())
28+
$package->getRegistry()->buildPackageUrl($package->getName())
2929
) ?>
3030
</small>
3131
</h1>

0 commit comments

Comments
 (0)