Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] 790 new dealer locator #19

Draft
wants to merge 34 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
234bccb
v2-dealer-locator init #790
alexiscoelhonc Aug 16, 2024
1f094d4
Merge branch 'develop' into 790-new-dealer-locator
alexiscoelhonc Aug 16, 2024
cb38a19
Update original dealer locator #790
alexiscoelhonc Aug 16, 2024
bda993c
Add DL versions #790
alexiscoelhonc Aug 16, 2024
dd552d8
Normalise dl as much as possible #790
alexiscoelhonc Aug 16, 2024
cae128c
Normalise dl main file #790
alexiscoelhonc Aug 16, 2024
b2c037e
Fix indentation #790
alexiscoelhonc Aug 16, 2024
1ad4402
Format documents #790
alexiscoelhonc Aug 19, 2024
1686ffa
Format documents #790
alexiscoelhonc Aug 19, 2024
b65998b
Format documents #790
alexiscoelhonc Aug 19, 2024
e5de394
Restore proper la file #790
alexiscoelhonc Aug 19, 2024
322a773
Format documents #790
alexiscoelhonc Aug 19, 2024
582b05a
Move files #790
alexiscoelhonc Aug 19, 2024
c019955
Load CSS files #790
alexiscoelhonc Aug 19, 2024
3395384
Rename selectors #790
alexiscoelhonc Aug 19, 2024
9a0d34d
Refactor #790
alexiscoelhonc Aug 19, 2024
4bce7f0
Refactor CSS #790
alexiscoelhonc Aug 19, 2024
afffe2e
Remove unnecessary file #790
alexiscoelhonc Aug 19, 2024
6e880be
Refactor #790
alexiscoelhonc Aug 19, 2024
7f843fd
Refactor #790
alexiscoelhonc Aug 19, 2024
f81b03a
Refactor and share code #790
alexiscoelhonc Aug 19, 2024
7c018a0
Minor improvements #790
alexiscoelhonc Aug 19, 2024
fb2fad4
Fix script links #790
alexiscoelhonc Aug 19, 2024
99a50f0
Minor fix #790
alexiscoelhonc Aug 19, 2024
e34261e
v2-dealer-locator #837
alexiscoelhonc Aug 16, 2024
b84f58a
Merge branch '790-new-dealer-locator' of github.com:hlxsites/vg-mackt…
alexiscoelhonc Aug 20, 2024
84c8c67
Refactor v2-dealer-locator, document and get configurations from bloc…
alexiscoelhonc Aug 20, 2024
7d1f532
update v2dl #837
alexiscoelhonc Aug 20, 2024
2c484b6
update v2dl #837
alexiscoelhonc Aug 20, 2024
0629c44
update v2dl #837
alexiscoelhonc Aug 20, 2024
4508776
update v2dl #837
alexiscoelhonc Aug 20, 2024
932aa76
Merge branch 'develop' into 790-new-dealer-locator
alexiscoelhonc Aug 20, 2024
34a373a
update v2dl #837
alexiscoelhonc Aug 20, 2024
4b89dc2
update v2dl #837
alexiscoelhonc Aug 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,330 changes: 1,666 additions & 1,664 deletions blocks/dealer-locator/dealer-locator.css

Large diffs are not rendered by default.

25 changes: 16 additions & 9 deletions blocks/dealer-locator/sidebar-maps.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ var uptimeClicked = false;
$electricDealer = false;
$hoverText = $('#hoverText').val();
$country = window.locatorConfig.country;
var isLocationOFF = false;

// Google callback letting us know maps is ready to be used
(function () {
Expand All @@ -103,7 +104,7 @@ $country = window.locatorConfig.country;
lat: defaultCenterCoords.lat,
lng: defaultCenterCoords.lng
},
zoom: 8,
zoom: 4,
mapTypeControl: false,
streetViewControl: false,
fullscreenControl: false,
Expand Down Expand Up @@ -1386,7 +1387,7 @@ $.fn.deleteCookie = function (name) {
document.cookie = name + '=; Max-Age=-99999999;';
}

$.fn.sortedPins = function () {
$.fn.sortedPins = function (isLocationOff = false) {
$pinLength = $pins.length;

for (var i = 0; i < $pinLength; i++) {
Expand All @@ -1399,7 +1400,9 @@ $.fn.sortedPins = function () {
$sortedPins = $pins;

$sortedPins.sort(function (a, b) {
return parseFloat(a.distance) - parseFloat(b.distance);
return isLocationOff
? a.COMPANY_DBA_NAME.localeCompare(b.COMPANY_DBA_NAME)
: parseFloat(a.distance) - parseFloat(b.distance);
});

$sortedPins.filter(function (i) {
Expand Down Expand Up @@ -1566,9 +1569,6 @@ $.fn.tmpPins = function (tmpPinList) {
$("<div/>", {
'html': templateClone,
'click': function () {
// look into a child element with class teaser-top and get the data-id attribute
var id = $(this).find('.teaser-top').attr('data-id');
$.fn.switchSidebarPane('sidebar-pin', id);
},
'mouseenter': function () {

Expand Down Expand Up @@ -1680,7 +1680,7 @@ $.fn.filterNearbyPins = function () {

// First get the full details of our locations
var tmpPinList = [];
var sorted = $.fn.sortedPins();
var sorted = $.fn.sortedPins(isLocationOFF);

$nearbyPins.forEach(function (pin) {
tmpPinList.push($.grep(sorted, function (v, i) {
Expand All @@ -1689,7 +1689,9 @@ $.fn.filterNearbyPins = function () {
});

tmpPinList.sort(function (a, b) {
return parseFloat(a.distance) - parseFloat(b.distance);
return isLocationOFF
? a.COMPANY_DBA_NAME.localeCompare(b.COMPANY_DBA_NAME)
: parseFloat(a.distance) - parseFloat(b.distance);
});
$("#filterUptime,#filterElectricDealer,#filterDealer").css("cursor", "pointer");
$('.no-dealer-text').hide();
Expand Down Expand Up @@ -2401,10 +2403,11 @@ $.fn.setAddress = function () {
};

// Handles geolocation
$.fn.setLocation = function () {
$.fn.setLocation = function (e) {
if (navigator.geolocation) {

navigator.geolocation.getCurrentPosition(function (position) {

var pos = {
lat: position.coords.latitude,
lng: position.coords.longitude
Expand Down Expand Up @@ -2645,6 +2648,10 @@ $.fn.handleLocationError = function (browserHasGeolocation, infoWindow, pos) {
if (!browserHasGeolocation) {
alert('Error: Your browser doesn\'t support geolocation.');
} else {
console.log('%cError:%c The Geolocation service failed. Check your browser if Geolocation is enabled.'
, 'color: white; font-weight: bold; background-color: red', 'color: default; font-weight: normal;');
// sort pins Alphabetically by Brand Name if Geolocation is disabled
isLocationOFF = true;
$('.loading-overlay').css('display', 'none');
$('.waiting-overlay').css('display', 'block');
}
Expand Down
9 changes: 9 additions & 0 deletions blocks/v2-dealer-locator/images/add.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions blocks/v2-dealer-locator/images/bolt.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions blocks/v2-dealer-locator/images/clock.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions blocks/v2-dealer-locator/images/dealer-electric.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions blocks/v2-dealer-locator/images/dealer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions blocks/v2-dealer-locator/images/filter.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions blocks/v2-dealer-locator/images/globe-detail.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions blocks/v2-dealer-locator/images/globe.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading