mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-11-04 20:22:47 -05: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.
41 lines
1.0 KiB
JavaScript
41 lines
1.0 KiB
JavaScript
// Displays datepicker to finished at date
|
|
// when marking a planting finished using a
|
|
// button. The button must have class 'append-date'.
|
|
|
|
jQuery(function () {
|
|
const el = $('.append-date');
|
|
|
|
el.datepicker({ format: 'yyyy-mm-dd' });
|
|
|
|
el.on('click', function (e) {
|
|
e.stopPropagation();
|
|
e.preventDefault();
|
|
|
|
const button = $(this);
|
|
const originalText = button.text();
|
|
const href = button.attr('href');
|
|
button.text('Confirm without date');
|
|
|
|
button.on('click.confirm', function () {
|
|
const link = $(`<a href='${href}' data-method='put'></a>`);
|
|
$('body').append(link);
|
|
link.click();
|
|
});
|
|
|
|
button.on('blur', function () {
|
|
button.text(originalText);
|
|
button.off('click.confirm');
|
|
});
|
|
});
|
|
|
|
el.one('changeDate', function () {
|
|
const date = $(this).datepicker('getDate');
|
|
const href = $(this).attr('href');
|
|
const url = `${href}&planting[finished_at]=${date}`;
|
|
|
|
const link = $(`<a href='${url}' data-method='put'></a>`);
|
|
$('body').append(link);
|
|
link.click();
|
|
});
|
|
});
|