Skip to content

Commit 9ade37d

Browse files
committed
Changed no results back to empty map, made it so that category filtering gets cloned into the modal window, fixed missing geocode.js in dist
1 parent c1be901 commit 9ade37d

9 files changed

+70
-64
lines changed

Gruntfile.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ module.exports = function(grunt) {
3434
dist: {
3535
files: {
3636
'dist/js/jquery.<%= pkg.name %>.min.js' : '<%= concat.dist.dest %>',
37-
'dist/js/handlebars.min.js' : 'libs/handlebars/*.js'
37+
'dist/js/handlebars.min.js' : 'libs/handlebars/*.js',
38+
'dist/js/geocode.min.js' : 'src/js/geocode.js'
3839
}
3940
},
4041
},

dist/css/storelocator.css

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535
.bh-sl-container .form-input label {
3636
font-weight: bold;
3737
}
38-
.bh-sl-container .form-input input {
38+
.bh-sl-container .form-input input,
39+
.bh-sl-container .form-input select {
3940
margin: 0 15px 0 10px;
4041
padding: 4px;
4142
line-height: 16px;
@@ -86,18 +87,6 @@
8687
float: left;
8788
margin: 2px 8px 2px 0;
8889
}
89-
.bh-sl-container .bh-sl-noresults {
90-
clear: left;
91-
float: left;
92-
width: 100%;
93-
padding: 30px 0;
94-
text-align: center;
95-
}
96-
.bh-sl-container .bh-sl-noresults .bh-sl-noresults-title {
97-
font-size: 20px;
98-
font-weight: bold;
99-
color: #ae2118;
100-
}
10190
.bh-sl-container .bh-sl-map-container {
10291
clear: left;
10392
float: left;
@@ -177,6 +166,10 @@
177166
top: 0;
178167
right: 6px;
179168
}
169+
.bh-sl-container .bh-sl-loc-list .bh-sl-noresults-title {
170+
font-weight: bold;
171+
color: #ae2118;
172+
}
180173
.bh-sl-container .loc-name {
181174
/* Picked up by both list and infowindows */
182175
color: #ae2118;

dist/css/storelocator.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/geocode.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ <h1>Simple geocoding form</h1>
3838

3939
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
4040
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
41-
<script src="js/geocode.js"></script>
41+
<script src="js/geocode.min.js"></script>
4242

4343
</body>
4444
</html>

dist/js/geocode.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/jquery.storelocator.js

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! jQuery Google Maps Store Locator - v1.4.9 - 2014-08-11
1+
/*! jQuery Google Maps Store Locator - v1.4.9 - 2014-08-12
22
* http://www.bjornblog.com/web/jquery-store-locator-plugin
33
* Copyright (c) 2014 Bjorn Holine; Licensed MIT */
44

@@ -172,6 +172,12 @@
172172

173173
// Add modal window divs if set
174174
if (this.settings.modalWindow === true) {
175+
// Clone the filters if there are any so they can be used in the modal
176+
if (this.settings.taxonomyFilters !== null) {
177+
// Clone the filters
178+
$('.bh-sl-filters-container').clone(true, true).prependTo($this);
179+
}
180+
175181
$this.wrap('<div class="' + this.settings.overlayDiv + '"><div class="' + this.settings.modalWindowDiv + '"><div class="' + this.settings.modalContentDiv + '">');
176182
$('.' + this.settings.modalWindowDiv).prepend('<div class="' + this.settings.closeIconDiv + '"></div>');
177183
$('.' + this.settings.overlayDiv).hide();
@@ -979,7 +985,7 @@
979985
*/
980986
mapping: function (mappingObj) {
981987
var _this = this;
982-
var orig_lat, orig_lng, origin, name, maxDistance, page, firstRun, marker, bounds, storeStart, storeNumToShow, myOptions;
988+
var orig_lat, orig_lng, origin, name, maxDistance, page, firstRun, marker, bounds, storeStart, storeNumToShow, myOptions, noResults;
983989
var i = 0;
984990
if (!this.isEmptyObject(mappingObj)) {
985991
orig_lat = mappingObj.lat;
@@ -990,11 +996,6 @@
990996
page = mappingObj.page;
991997
}
992998

993-
// Remove the no results message if it was previously displayed
994-
if($('.bh-sl-noresults').length) {
995-
$('.bh-sl-noresults').remove();
996-
}
997-
998999
// Enable the visual refresh https://developers.google.com/maps/documentation/javascript/basics#VisualRefresh
9991000
google.maps.visualRefresh = true;
10001001

@@ -1191,11 +1192,14 @@
11911192
}
11921193

11931194
// Append the no rsults message
1194-
var noResults = $('<div class="bh-sl-noresults"><div class="bh-sl-noresults-title">' + _this.settings.noResultsTitle + '</div><br><div class="bh-sl-noresults-desc">' + _this.settings.noResultsDesc + '</div>').hide().fadeIn();
1195-
$('.' + _this.settings.formContainerDiv).append(noResults);
1195+
noResults = $('<li><div class="bh-sl-noresults-title">' + _this.settings.noResultsTitle + '</div><br><div class="bh-sl-noresults-desc">' + _this.settings.noResultsDesc + '</li>').hide().fadeIn();
11961196

1197-
// Stop the mapping function
1198-
return;
1197+
// Setup a no results location
1198+
locationset[0] = {
1199+
'distance': 0,
1200+
'lat' : 0,
1201+
'lng': 0
1202+
};
11991203
}
12001204

12011205
// Sort the multi-dimensional array by distance
@@ -1387,11 +1391,17 @@
13871391

13881392
// Create the links that focus on the related marker
13891393
$('.' + _this.settings.listDiv + ' ul').empty();
1390-
$(markers).each(function (x, marker) {
1391-
var letter = String.fromCharCode('A'.charCodeAt(0) + x);
1392-
var currentMarker = markers[x];
1393-
_this.listSetup(currentMarker, storeStart, page);
1394-
});
1394+
// Check the locationset and continue with the list setup or show no results message
1395+
if(locationset[0].lat === 0 && locationset[0].lng === 0) {
1396+
$('.' + _this.settings.listDiv + ' ul').append(noResults);
1397+
}
1398+
else {
1399+
$(markers).each(function (x, marker) {
1400+
var letter = String.fromCharCode('A'.charCodeAt(0) + x);
1401+
var currentMarker = markers[x];
1402+
_this.listSetup(currentMarker, storeStart, page);
1403+
});
1404+
}
13951405

13961406
// Handle clicks from the list
13971407
$(document).on('click', '.' + _this.settings.listDiv + ' li', function () {

dist/js/jquery.storelocator.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/css/storelocator.less

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
font-weight: bold;
5151
}
5252

53-
input {
53+
input,select {
5454
margin: 0 15px 0 10px;
5555
padding: 4px;
5656
line-height: 16px;
@@ -110,20 +110,6 @@
110110
}
111111
}
112112

113-
.bh-sl-noresults {
114-
clear: left;
115-
float: left;
116-
width: 100%;
117-
padding: 30px 0;
118-
text-align: center;
119-
120-
.bh-sl-noresults-title {
121-
font-size: 20px;
122-
font-weight: bold;
123-
color: @red;
124-
}
125-
}
126-
127113
.bh-sl-map-container {
128114
clear: left;
129115
float: left;
@@ -211,6 +197,11 @@
211197
right: 6px;
212198
}
213199
}
200+
201+
.bh-sl-noresults-title {
202+
font-weight: bold;
203+
color: @red;
204+
}
214205
}
215206

216207
.loc-name {

src/js/jquery.storelocator.js

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,12 @@
174174

175175
// Add modal window divs if set
176176
if (this.settings.modalWindow === true) {
177+
// Clone the filters if there are any so they can be used in the modal
178+
if (this.settings.taxonomyFilters !== null) {
179+
// Clone the filters
180+
$('.bh-sl-filters-container').clone(true, true).prependTo($this);
181+
}
182+
177183
$this.wrap('<div class="' + this.settings.overlayDiv + '"><div class="' + this.settings.modalWindowDiv + '"><div class="' + this.settings.modalContentDiv + '">');
178184
$('.' + this.settings.modalWindowDiv).prepend('<div class="' + this.settings.closeIconDiv + '"></div>');
179185
$('.' + this.settings.overlayDiv).hide();
@@ -981,7 +987,7 @@
981987
*/
982988
mapping: function (mappingObj) {
983989
var _this = this;
984-
var orig_lat, orig_lng, origin, name, maxDistance, page, firstRun, marker, bounds, storeStart, storeNumToShow, myOptions;
990+
var orig_lat, orig_lng, origin, name, maxDistance, page, firstRun, marker, bounds, storeStart, storeNumToShow, myOptions, noResults;
985991
var i = 0;
986992
if (!this.isEmptyObject(mappingObj)) {
987993
orig_lat = mappingObj.lat;
@@ -992,11 +998,6 @@
992998
page = mappingObj.page;
993999
}
9941000

995-
// Remove the no results message if it was previously displayed
996-
if($('.bh-sl-noresults').length) {
997-
$('.bh-sl-noresults').remove();
998-
}
999-
10001001
// Enable the visual refresh https://developers.google.com/maps/documentation/javascript/basics#VisualRefresh
10011002
google.maps.visualRefresh = true;
10021003

@@ -1193,11 +1194,14 @@
11931194
}
11941195

11951196
// Append the no rsults message
1196-
var noResults = $('<div class="bh-sl-noresults"><div class="bh-sl-noresults-title">' + _this.settings.noResultsTitle + '</div><br><div class="bh-sl-noresults-desc">' + _this.settings.noResultsDesc + '</div>').hide().fadeIn();
1197-
$('.' + _this.settings.formContainerDiv).append(noResults);
1197+
noResults = $('<li><div class="bh-sl-noresults-title">' + _this.settings.noResultsTitle + '</div><br><div class="bh-sl-noresults-desc">' + _this.settings.noResultsDesc + '</li>').hide().fadeIn();
11981198

1199-
// Stop the mapping function
1200-
return;
1199+
// Setup a no results location
1200+
locationset[0] = {
1201+
'distance': 0,
1202+
'lat' : 0,
1203+
'lng': 0
1204+
};
12011205
}
12021206

12031207
// Sort the multi-dimensional array by distance
@@ -1389,11 +1393,17 @@
13891393

13901394
// Create the links that focus on the related marker
13911395
$('.' + _this.settings.listDiv + ' ul').empty();
1392-
$(markers).each(function (x, marker) {
1393-
var letter = String.fromCharCode('A'.charCodeAt(0) + x);
1394-
var currentMarker = markers[x];
1395-
_this.listSetup(currentMarker, storeStart, page);
1396-
});
1396+
// Check the locationset and continue with the list setup or show no results message
1397+
if(locationset[0].lat === 0 && locationset[0].lng === 0) {
1398+
$('.' + _this.settings.listDiv + ' ul').append(noResults);
1399+
}
1400+
else {
1401+
$(markers).each(function (x, marker) {
1402+
var letter = String.fromCharCode('A'.charCodeAt(0) + x);
1403+
var currentMarker = markers[x];
1404+
_this.listSetup(currentMarker, storeStart, page);
1405+
});
1406+
}
13971407

13981408
// Handle clicks from the list
13991409
$(document).on('click', '.' + _this.settings.listDiv + ' li', function () {

0 commit comments

Comments
 (0)