\$("#{$input_id}").bind("propertychanged", search_input_changed); rhoone.search.keywords = \$.trim(\$("#{$input_id}").val()); if (rhoone.search.keywords !== "") { \$("title").html("Search: " + html_encode(rhoone.search.keywords)); } \$(document).bind("rhoone:search_start", function(e) { \$("title").html("Search: " + html_encode(rhoone.search.keywords)); }); \$("#{$input_id}").focus(); EOT; $this->registerJs($js); $form = ActiveForm::begin($formConfig); /* @var $form yii\widgets\ActiveForm */ ?> <div class="form-group form-group-search"> <?php echo $form->field($model, 'keywords', ['template' => '{input}'])->textInput($inputConfig); ?> <?php /** * @todo Translation to other languages. * We need everyone's help. */ ?> <?php echo Html::submitButton(FormWidget::t('Search'), $submitConfig); ?> </div> <?php ActiveForm::end();
use rhoone\assets\NprogressAsset; use rhoone\widgets\search\assets\SearchAsset; use rhoone\widgets\search\panel\FormWidget; SearchAsset::register($this); NprogressAsset::register($this); $js = <<<EOT NProgress.configure({ showSpinner: false , parent:'.panel-heading'}); NProgress.start(); setTimeout(function(){NProgress.done();}, 1000); \$(document).bind("rhoone:search_start", NProgress.start); \$(document).bind("rhoone:search_cancel", NProgress.done); \$(document).bind("rhoone:search_end", NProgress.done); EOT; $this->registerJs($js); /* @var $formConfig array */ ?> <div class="panel"> <div class="panel-heading"></div> <div class="panel-body"> <div class="row"> <div class="col-md-3"></div> <div class="col-md-6"> <?php echo FormWidget::widget($formConfig); ?> </div> <div class="col-md-3"></div> </div> </div> </div>