Commit 233d0921 by Junaid Rahman pv

modified map widget(PlacePicker),added asset file

parent e2370618
...@@ -45,3 +45,5 @@ FACEBOOK_CLIENT_SECRET = your-client-secret ...@@ -45,3 +45,5 @@ FACEBOOK_CLIENT_SECRET = your-client-secret
GLIDE_SIGN_KEY = <generated_key> GLIDE_SIGN_KEY = <generated_key>
GLIDE_MAX_IMAGE_SIZE = 4000000 GLIDE_MAX_IMAGE_SIZE = 4000000
GOOGLE_API_KEY = AIzaSyBcXUZ8SohRQzKnY4iYaa5_B2ix0b_OY9g
...@@ -37,3 +37,5 @@ GITHUB_CLIENT_SECRET = your-client-secret ...@@ -37,3 +37,5 @@ GITHUB_CLIENT_SECRET = your-client-secret
GLIDE_SIGN_KEY = <generated_key> GLIDE_SIGN_KEY = <generated_key>
GLIDE_MAX_IMAGE_SIZE = 4000000 GLIDE_MAX_IMAGE_SIZE = 4000000
GOOGLE_API_KEY = AIzaSyBcXUZ8SohRQzKnY4iYaa5_B2ix0b_OY9g
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
use yii\helpers\Html; use yii\helpers\Html;
use yii\widgets\ActiveForm; use yii\widgets\ActiveForm;
use common\widgets\PlacePicker; use common\widgets\PlacePicker\PlacePicker;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model common\models\Business */ /* @var $model common\models\Business */
......
<?php
/**
* Author: Junaid Rahman <junaid.entero@gmail.com>
*/
namespace common\widgets\PlacePicker;
use yii\web\AssetBundle;
use yii\web\View;
class MapAsset extends AssetBundle
{
public $css = [
];
public $js = [
'http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js'
];
public $depends = [
'yii\web\JqueryAsset',
];
public $key = [
];
public $jsOptions = [
['position' => View::POS_HEAD]
];
public function init()
{
$this->sourcePath = __DIR__."/assets";
parent::init();
$this->js = [
'https://maps.googleapis.com/maps/api/js?key=AIzaSyBcXUZ8SohRQzKnY4iYaa5_B2ix0b_OY9g&libraries=places',
];
}
}
<?php <?php
namespace common\widgets; namespace common\widgets\PlacePicker;
use yii\widgets\InputWidget; use yii\widgets\InputWidget;
use yii\helpers\Html; use yii\helpers\Html;
...@@ -12,6 +12,7 @@ class PlacePicker extends InputWidget ...@@ -12,6 +12,7 @@ class PlacePicker extends InputWidget
public function init() public function init()
{ {
MapAsset::register($this->view);
parent::init(); parent::init();
$this->registerScript(); $this->registerScript();
} }
...@@ -20,8 +21,6 @@ class PlacePicker extends InputWidget ...@@ -20,8 +21,6 @@ class PlacePicker extends InputWidget
{ {
echo Html::tag('br'); echo Html::tag('br');
echo Html::jsFile('http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js');
echo Html::jsFile('http://maps.google.com/maps/api/js?key=AIzaSyBcXUZ8SohRQzKnY4iYaa5_B2ix0b_OY9g&libraries=places&region=uk&language=en&sensor=true');
echo Html::textInput('Address', '', echo Html::textInput('Address', '',
['id' => 'searchTextField', 'class' => 'form-control', 'style' => 'width:90%;']); ['id' => 'searchTextField', 'class' => 'form-control', 'style' => 'width:90%;']);
echo Html::tag('br'); echo Html::tag('br');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment