mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-10-29 10:18:29 -04:00
- Implemented `planting_alternate_name.js` to load alternate names for crops in the planting form based on user input. - Added `tab_navigation.js` to manage tab navigation and update the URL hash accordingly. Update map rendering in member and place views - Modified `_map.html.haml` to include a custom marker icon for member maps. - Updated `index.html.haml` and `show.html.haml` to pass `places_map_data` to the map sections. Refactor asset management in Rails application - Removed Sprockets from the application configuration and adjusted asset paths. - Updated asset precompilation settings and removed deprecated asset configurations from environment files. - Added new build scripts for CSS and updated package dependencies in `package.json` for Bootstrap, Chart.js, and others. Ensure React and CSS bundles are built before running tests - Updated `react_bundle.rb` to check for the existence of both JavaScript and CSS bundles and build them if missing.
33 lines
1.1 KiB
JavaScript
33 lines
1.1 KiB
JavaScript
const memberMapElement = document.getElementById("membermap");
|
|
if (memberMapElement !== null) {
|
|
|
|
var default_marker_icon = L.icon({
|
|
iconUrl: memberMapElement.dataset.markerIcon,
|
|
iconSize: [48, 48],
|
|
iconAnchor: [24, 48],
|
|
popupAnchor: [0, -46],
|
|
});
|
|
|
|
$.getJSON(location.pathname + '.json', function(member) {
|
|
if (member.latitude && member.longitude) {
|
|
var membermap = L.map('membermap').setView([member.latitude, member.longitude], 4);
|
|
|
|
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
|
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
|
|
maxZoom: 18
|
|
}).addTo(membermap);
|
|
var marker = new L.Marker(new L.LatLng(member.latitude, member.longitude),
|
|
{'icon': default_marker_icon});
|
|
|
|
var member_url = "/members/" + member.slug;
|
|
var member_link = "<a href='" + member_url + "'>" + member.login_name + "</a>";
|
|
|
|
var where = "<p><i>" + member.location + "</i></p>";
|
|
|
|
marker.bindPopup(member_link + where).openPopup();
|
|
marker.addTo(membermap);
|
|
}
|
|
});
|
|
|
|
}
|