mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-11-05 20:52:48 -05:00
Members with photo library access get an "Upload from your device" form on the new photo page. The browser sends the file straight to storage with @rails/activestorage, so the app only gets its signed id. The photo is then created and attached to the garden, planting, job or other item, like a Flickr photo. An upload must use one of the library's licences (CC BY-SA 4.0 by default, CC BY 4.0, CC BY-NC 4.0, CC0), and the member must confirm they took the photo or may share it. Members without access are pointed to where they can ask for it. Assisted by Claude
50 lines
1.7 KiB
JavaScript
50 lines
1.7 KiB
JavaScript
// The site's jQuery-era scripts expect these as globals, and jQuery plugins
|
|
// attach to window.jQuery, so globals must be set before anything else loads.
|
|
import './globals';
|
|
|
|
import 'jquery-ujs';
|
|
import * as ActiveStorage from '@rails/activestorage';
|
|
import 'jquery-ui/dist/jquery-ui';
|
|
import 'bootstrap-datepicker';
|
|
import 'leaflet.markercluster';
|
|
|
|
import './site/append_date';
|
|
import './site/auto_suggest';
|
|
import './site/cropmap';
|
|
import './site/datepicker';
|
|
import './site/editable';
|
|
import './site/finish_toggle';
|
|
import './site/job_ideas';
|
|
import './site/job_notepad';
|
|
import './site/likes';
|
|
import './site/members';
|
|
import './site/navbar_search';
|
|
import './site/places';
|
|
import './site/planting_alternate_name';
|
|
import './site/tab_navigation';
|
|
|
|
// Photos uploaded to the photo library go from the browser straight to
|
|
// storage, not through the app: file fields marked direct_upload.
|
|
ActiveStorage.start();
|
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
var popoverTrigger = Array.prototype.slice.call(document.querySelectorAll('[data-bs-toggle="popover"]'));
|
|
popoverTrigger.map(function(popoverTrigger2) {
|
|
return new bootstrap.Popover(popoverTrigger2);
|
|
});
|
|
|
|
var tooltipTrigger = Array.prototype.slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
|
|
tooltipTrigger.map(function(tooltipTrigger2) {
|
|
return new bootstrap.Tooltip(tooltipTrigger2);
|
|
});
|
|
});
|
|
|
|
// Tell the server which time zone the browser is in, so "today" and "yesterday"
|
|
// are the member's own days.
|
|
try {
|
|
document.cookie = 'timezone=' + encodeURIComponent(Intl.DateTimeFormat().resolvedOptions().timeZone) +
|
|
'; path=/; max-age=31536000; SameSite=Lax';
|
|
} catch (error) {
|
|
// No time zone to send: the server's is used.
|
|
}
|