Files
Brenda Wallace e68c98fd38 Add JavaScript functionality for planting alternate names and tab navigation
- 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.
2026-10-20 23:55:33 +13:00

27 lines
803 B
JavaScript

// Clears the finished at date field when a planting or seed is
// marked unfinished, and repopulates the field with a cached value
// when marking unfinished is undone.
document.addEventListener('DOMContentLoaded', function () {
['planting', 'seed'].forEach(function (model) {
const checkbox = document.getElementById(`${model}_finished`);
if (!checkbox) return;
let previousValue = '';
checkbox.addEventListener('click', function () {
const finished = document.getElementById(`${model}_finished_at`);
if (checkbox.checked) {
if (previousValue.length) {
finished.value = previousValue;
} else {
finished.focus();
}
} else {
previousValue = finished.value;
finished.value = '';
}
});
});
});