From 83bcef8260b83f8102ab67afdfb34893c60a04be Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Fri, 31 Aug 2018 09:01:04 -0400 Subject: [PATCH] Update for the member list view Bring in changes from main plugin to have better mobile leaflet maps. --- glm-member-db/views/front/members/list.html | 40 ++++++++++++++------- 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/glm-member-db/views/front/members/list.html b/glm-member-db/views/front/members/list.html index 142f280..729a2b9 100644 --- a/glm-member-db/views/front/members/list.html +++ b/glm-member-db/views/front/members/list.html @@ -112,13 +112,13 @@ {/if} {*list_show_search*} {if $settings.list_show_map} - + {apply_filters('glm-member-db-front-members-list-mapTop', '')}
{if $settings.selected_map_interface == 1} -
+
{/if} {if $settings.selected_map_interface == 2} @@ -163,15 +163,20 @@

{/if} {*list_map_show_address*}
-

- {if $m.phone && $settings.list_map_show_phone}Phone: {apply_filters('glm_associate_phone_filter', $m.phone)}
{/if} - {if $m.toll_free && $settings.list_map_show_tollfree}{apply_filters('glm_associate_phone_filter', $m.toll_free)}
{/if} - {if $m.url && $settings.list_map_show_url}Web site: {$m.url}
{/if} +

+ {if $m.phone && $settings.list_map_show_phone}Phone: {apply_filters('glm_associate_phone_filter', $m.phone)}
{/if} + {if $m.toll_free && $settings.list_map_show_tollfree}{apply_filters('glm_associate_phone_filter', $m.toll_free)}
{/if} {if $m.email && $settings.list_map_show_email}E-Mail Address: {$m.email}
{/if} - {if $m.region && $settings.list_map_show_region}Region: {$m.region}{/if} + {if $m.region && $settings.list_map_show_region}Region: {$m.region}
{/if} + {if $m.url && $settings.list_map_show_url}Website
{/if}

+ + {if $m.short_descr && $settings.list_map_show_short_descr}{$m.short_descr|truncate:200}
{/if} + {if $settings.list_map_show_detaillink && !$m.has_no_profile} + More Info + {/if} {if $m.categories && $settings.list_map_show_categories}
{$terms.term_member_cap} Categories @@ -184,7 +189,7 @@
{/if} - + {/literal} --> {if $settings.list_map_show_amenities}
Amenities: @@ -593,13 +598,23 @@ }); {/if} + var mapContainerWidth = Number(leafletMap._container.clientWidth); + var maxPopupWidth = .65 * mapContainerWidth; + if (maxPopupWidth > 600) { + maxPopupWidth = 600; + } + var mapContainerHeight = Number(leafletMap._container.clientHeight); + var maxPopupHeight = .7 * mapContainerHeight; {foreach $mapItems as $m} {if $m.lat != 0 && $m.lon != 0} // Create marker for this member and and to Feature Group var leafletMarker = L.marker([{$m.lat}, {$m.lon}], { title: '{$m.member_name|escape:quotes}' }) - .bindPopup($('#map_info_' + {$m.id}).html()) + .bindPopup($('#map_info_' + {$m.id}).html(), { + maxWidth: maxPopupWidth, + maxHeight: maxPopupHeight + }) .addTo(markerGroup); {/if} @@ -616,7 +631,8 @@ leafletMap.on('popupopen', function(e) { var px = leafletMap.project(e.popup._latlng); - px.y -= e.popup._container.clientHeight/2; + px.x -= 20; // Bump a bit to the right to avoid resize buttons + px.y -= e.popup._container.clientHeight/2; // Position more toward the center leafletMap.panTo(leafletMap.unproject(px),{ animate: true }); }); -- 2.17.1