diff --git a/templates/client/includes/company/company_edit.html b/templates/client/includes/company/company_edit.html index 082603dd..c4520e64 100644 --- a/templates/client/includes/company/company_edit.html +++ b/templates/client/includes/company/company_edit.html @@ -203,7 +203,8 @@ {% endwith %}
{% with tags=company.tag.all %} {% for tag in tags %} diff --git a/templates/client/static_client/css/main.css b/templates/client/static_client/css/main.css index 52667d2b..c6b62c34 100644 --- a/templates/client/static_client/css/main.css +++ b/templates/client/static_client/css/main.css @@ -13526,4 +13526,41 @@ hr + .rq-note { } .news-filter-block .select2-container-multi .select2-choices .select2-search-field:first-child input{ line-height: 36px ; - } \ No newline at end of file + } + +/*****************\ +# карта на странице профиля компании (google maps) +\*****************/ + + .address-wrap .map-wrap{ + margin-top: 1em; + margin-bottom: 2em; + } + .address-wrap .map-wrap .gmap-canvas{ + height: 308px; + } + .address-wrap .map-toggle{ + display: block; + float: right; + color: #a2a2a2; + text-decoration: none; + position: relative; + z-index: 2; + } + .address-wrap .map-toggle:hover{ + color: #ff6600; + + } + .address-wrap .map-toggle:hover .label{ + border: 0; + } + .address-wrap .map-toggle .label{ + font-size: 15px; + line-height: 12px; + + text-decoration: none; + border-bottom: 1px dashed; + } + .address-wrap .map-toggle .fa{ + font-size: 1.3em; + } diff --git a/templates/client/static_client/js/_modules/page.company.js b/templates/client/static_client/js/_modules/page.company.js index dd2a092e..a4f03c46 100644 --- a/templates/client/static_client/js/_modules/page.company.js +++ b/templates/client/static_client/js/_modules/page.company.js @@ -505,6 +505,83 @@ if (EXPO.company){ } }; + + var Map = function (opt) { + var self = this; + this.opt = opt; + this.$wrapper= $("#address-block"); + this.$toggle = $(".map-toggle",this.$wrapper); + this.$container = $(".map-wrap", this.$wrapper); + this.status ={ + visible:false + }; + this.$toggle.on("click", function () { + if($(this).hasClass("active")){ + /** + * hide map + */ + self.hideMap(); + }else{ + /** + * show map + */ + self.showMap(); + } + return false; + }); + /** + * google map initialization + */ + var mapHolder = document.getElementById('gmap-canvas'); + var initGooglemap = function () { + var mapOptions = { + zoom: 4 + }; + self.map = new google.maps.Map(mapHolder, mapOptions); + + //var marker = new google.maps.Marker({ + // position: myLatlng, + // map: map + //}); + //todo: если есть город то геокодировать его + сделать автокомплит + var country = $("#id_country option:selected").text(); + var geocoder = new google.maps.Geocoder(); + geocoder.geocode({"address":country}, function (results, status) { + if (status == google.maps.GeocoderStatus.OK){ + self.map.setCenter(results[0].geometry.location); + var marker = new google.maps.Marker({ + map: self.map, + position: results[0].geometry.location + }); + }else{ + alert("Geocode was not successful for the following reason: " + status); + } + }); + }; + google.maps.event.addDomListener(window, 'load', initGooglemap); + + + + + + + + }; + Map.prototype = { + showMap: function () { + this.$toggle.addClass("active").children(".label").text(this.$toggle.attr("data-hide-text")); + this.status.visible = true; + this.$container.removeClass("hidden"); + }, + hideMap: function () { + this.$toggle.removeClass("active").children(".label").text(this.$toggle.attr("data-show-text")); + this.status.visible = false; + this.$container.addClass("hidden"); + }, + refresh: function () { + + } + }; // methods //инициализация общих свойств @@ -807,9 +884,10 @@ if (EXPO.company){ * preview button */ $('#'+self.opt.previewBtnId).attr('href',window.location.href+"?logout=1"); - //$('#'+self.opt.previewBtnId).on("click", function () { - // - //}); + /** + * google map + */ + this.map = new Map(); });