fix links to search results for #15

This commit is contained in:
cornernote 2015-08-11 23:20:39 +09:30
parent 5f1a88d752
commit 36cc7f801f
4 changed files with 9 additions and 2 deletions

View File

@ -34,6 +34,7 @@ $web = [
'packages' => 'package/index',
// mods
'submit' => 'mod/create',
'cloud' => 'mod/cloud',
'mods/update/<name:\w+>' => 'mod/update',
'mods/<name:\w+>' => 'mod/view',
'mods' => 'mod/index',

View File

@ -25,7 +25,7 @@ class ModController extends Controller
public function actionIndex()
{
$searchModel = new PackageSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
$dataProvider = $searchModel->search(['PackageSearch' => Yii::$app->request->queryParams]);
return $this->render('index', [
'searchModel' => $searchModel,
@ -108,7 +108,7 @@ class ModController extends Controller
$keywords[$keyword] = [
'text' => $keyword,
'weight' => 0,
'link' => Url::to(['/mods/search', 'keyword' => $keyword]),
'link' => Url::to(['/mod/index', 'search' => $keyword]),
];
}
$keywords[$keyword]['weight']++;

View File

@ -17,6 +17,9 @@ use yii\helpers\Html;
<?php
echo $form->field($model, 'search', [
'inputOptions' => [
'name' => 'search',
],
'addon' => [
'append' => [
'content' => Html::submitButton('<i class="glyphicon glyphicon-search"></i>', ['class' => 'btn btn-primary']),

View File

@ -1,6 +1,7 @@
<?php
use app\widgets\TagCloud;
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $keywords array */
@ -12,6 +13,8 @@ $this->params['breadcrumbs'][] = $this->title;
?>
<div class="mod-cloud">
<h1><?= Html::encode($this->title) ?></h1>
<?php
echo TagCloud::widget([
'tags' => $keywords,