diff --git a/frontend/assets/MapAsset.php b/frontend/assets/MapAsset.php
index 03bc41b..23143c3 100644
--- a/frontend/assets/MapAsset.php
+++ b/frontend/assets/MapAsset.php
@@ -15,8 +15,7 @@
public $baseUrl = '@web';
public $css = [];
public $js = [
- 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false',
- 'js/gmaps.js',
+ '//maps.googleapis.com/maps/api/js?key=AIzaSyCoR1Jb-mIFUjPwKiuSlmtYBEwnJOBnAgg&callback=initMap',
'js/gmaps.init.js',
];
public $depends = [
diff --git a/frontend/controllers/SiteController.php b/frontend/controllers/SiteController.php
index 4582dd1..46a5aee 100644
--- a/frontend/controllers/SiteController.php
+++ b/frontend/controllers/SiteController.php
@@ -116,27 +116,6 @@ class SiteController extends Controller
}
/**
- * Signs user up.
- *
- * @return mixed
- */
- public function actionSignup()
- {
- $model = new SignupForm();
- if ($model->load(Yii::$app->request->post())) {
- if ($user = $model->signup()) {
- if (Yii::$app->getUser()->login($user)) {
- return $this->goHome();
- }
- }
- }
-
- return $this->render('signup', [
- 'model' => $model,
- ]);
- }
-
- /**
* Requests password reset.
*
* @return mixed
@@ -217,6 +196,12 @@ class SiteController extends Controller
return [
'success' => true,
'message' => 'Success message',
+ 'alert' => '
+
Success
+
+ Success text
+
+
',
];
} else {
return [
diff --git a/frontend/views/site/contact.php b/frontend/views/site/contact.php
index 48e05d8..9e4a7ad 100644
--- a/frontend/views/site/contact.php
+++ b/frontend/views/site/contact.php
@@ -6,15 +6,24 @@
*/
use artbox\core\models\Feedback;
+ use common\models\Settings;
use frontend\assets\MapAsset;
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use yii\web\View;
MapAsset::register($this);
+ $settings = Settings::getInstance();
$this->title = 'Contact';
$this->params[ 'breadcrumbs' ][] = $this->title;
+
+ $js = <<< JS
+window.lat = {$settings->lat};
+window.lon = {$settings->lon};
+JS;
+
+ $this->registerJs($js, View::POS_END);
?>
@@ -144,8 +153,6 @@
-
-
diff --git a/frontend/web/css/custom.css b/frontend/web/css/custom.css
index d04b22d..3a4e04e 100644
--- a/frontend/web/css/custom.css
+++ b/frontend/web/css/custom.css
@@ -88,7 +88,7 @@
#back-to-top {
position: fixed;
top: 100px;
- left: 0px;
+ left: 0;
z-index: 9999;
width: 40px;
height: 40px;
@@ -100,7 +100,7 @@
text-decoration: none;
transition: opacity 0.2s ease-out;
opacity: 0;
- padding: 4px;
+ padding: 4px 1px 4px 0;
}
#back-to-top:hover {
diff --git a/frontend/web/js/gmaps.init.js b/frontend/web/js/gmaps.init.js
index 466ff74..cf2ee52 100644
--- a/frontend/web/js/gmaps.init.js
+++ b/frontend/web/js/gmaps.init.js
@@ -1,116 +1,19 @@
$(
function() {
- map();
-
- }
-);
-
-/* map */
-
-function map() {
-
- var styles = [
- {
- "featureType": "landscape",
- "stylers": [
- {"saturation": -100},
- {"lightness": 65},
- {"visibility": "on"}
- ]
- },
- {
- "featureType": "poi",
- "stylers": [
- {"saturation": -100},
- {"lightness": 51},
- {"visibility": "simplified"}
- ]
- },
- {
- "featureType": "road.highway",
- "stylers": [
- {"saturation": -100},
- {"visibility": "simplified"}
- ]
- },
- {
- "featureType": "road.arterial",
- "stylers": [
- {"saturation": -100},
- {"lightness": 30},
- {"visibility": "on"}
- ]
- },
- {
- "featureType": "road.local",
- "stylers": [
- {"saturation": -100},
- {"lightness": 40},
- {"visibility": "on"}
- ]
- },
- {
- "featureType": "transit",
- "stylers": [
- {"saturation": -100},
- {"visibility": "simplified"}
- ]
- },
- {
- "featureType": "administrative.province",
- "stylers": [ {"visibility": "off"} ]
- },
- {
- "featureType": "water",
- "elementType": "labels",
- "stylers": [
- {"visibility": "on"},
- {"lightness": -25},
- {"saturation": -100}
- ]
- },
- {
- "featureType": "water",
- "elementType": "geometry",
- "stylers": [
- {"hue": "#ffff00"},
- {"lightness": -25},
- {"saturation": -97}
- ]
- }
- ];
- map = new GMaps(
- {
- el: '#map',
- lat: -12.043333,
- lng: -77.028333,
- zoomControl: true,
- zoomControlOpt: {
- style: 'SMALL',
- position: 'TOP_LEFT'
- },
- panControl: false,
- streetViewControl: false,
- mapTypeControl: false,
- overviewMapControl: false,
+ function initMap() {
+ var map = new google.maps.Map(
+ document.getElementById('map'), {
+ center: {
+ lat: parseFloat(window.lat),
+ lng: parseFloat(window.lon)
+ },
scrollwheel: false,
- draggable: false,
- styles: styles
+ zoom: 16
+ }
+ );
}
- );
-
- var image = 'img/marker.png';
- map.addMarker(
- {
- lat: -12.043333,
- lng: -77.028333,
- icon: image/* ,
- title: '',
- infoWindow: {
- content: 'HTML Content
'
- }*/
- }
- );
-}
\ No newline at end of file
+ window.initMap = initMap();
+ }
+);
diff --git a/frontend/web/js/script.js b/frontend/web/js/script.js
index af2b67d..ed766d7 100644
--- a/frontend/web/js/script.js
+++ b/frontend/web/js/script.js
@@ -1,6 +1,9 @@
$(
function() {
+ /**
+ * Modal form submit code
+ */
$(document)
.on(
'beforeSubmit', '#feedback-form', function(e) {
@@ -33,6 +36,40 @@ $(
}
);
+ /**
+ * Contact form submitting
+ */
+ $(document)
+ .on(
+ 'beforeSubmit', '#contact-form', function(e) {
+ var f = this;
+ var form = $(this);
+ var formData = form.serialize();
+ $.ajax(
+ {
+ url: form.attr("action"),
+ type: form.attr("method"),
+ data: formData,
+ success: function(data) {
+ f.reset();
+ form.replaceWith(data.alert)
+ },
+ error: function() {
+
+ }
+ }
+ );
+ }
+ )
+ .on(
+ 'submit', '#contact-form', function(e) {
+ e.preventDefault();
+ }
+ );
+
+ /**
+ * Button UP code
+ */
if ($('#back-to-top').length) {
var scrollTrigger = 100, // px
backToTop = function() {
--
libgit2 0.21.4