Claude
b1cbb5555f
Refactor: Apply Rails best practices to trip sharing implementation
...
- Remove unused @is_public_view variable from controller
- Simplify conditionals by leveraging methods that return [] when empty
- Move public view from trips/public_show to shared/trips/show (Rails conventions)
- Refactor trips#update to be HTML-only (remove JSON responses)
- Convert sharing form to use proper Rails form helpers
- Move JS controller to shared/ subdirectory with proper namespacing
- Create RSpec shared examples for Shareable concern to eliminate duplication
- Update request specs to match HTML-only controller behavior
- Apply 'render/redirect ... and return' pattern for early returns
2025-11-07 12:05:34 +00:00
Claude
ce5e57a691
Implement public trip sharing with Shareable concern
...
This commit implements comprehensive public trip sharing functionality
by extracting sharing logic into a reusable Shareable concern and
extending it to Trip models.
## Key Features
**Shareable Concern (DRY principle)**
- Extract sharing logic from Stat model into reusable concern
- Support for time-based expiration (1h, 12h, 24h, permanent)
- UUID-based secure public access
- User-controlled sharing of notes and photos
- Automatic UUID generation on model creation
**Database Changes**
- Add sharing_uuid (UUID) column to trips table
- Add sharing_settings (JSONB) column for configuration storage
- Add unique index on sharing_uuid for performance
**Public Trip Sharing**
- Public-facing trip view with read-only access
- Interactive map with trip route visualization
- Optional sharing of notes and photo previews
- Branded footer with Dawarich attribution
- Responsive design matching existing UI patterns
**Sharing Management**
- In-app sharing controls in trip show view
- Enable/disable sharing with one click
- Configurable expiration times
- Copy-to-clipboard for sharing URLs
- Visual indicators for sharing status
**Authorization & Security**
- TripPolicy for fine-grained access control
- Public access only for explicitly shared trips
- Automatic expiration enforcement
- Owner-only sharing management
- UUID-based URLs prevent enumeration attacks
**API & Routes**
- GET /shared/trips/:trip_uuid for public access
- PATCH /trips/:id/sharing for sharing management
- RESTful endpoint design consistent with stats sharing
**Frontend**
- New public-trip-map Stimulus controller
- OpenStreetMap tiles for public viewing (no API key required)
- Start/end markers on trip route
- Automatic map bounds fitting
**Tests**
- Comprehensive concern specs (Shareable)
- Model specs for Trip sharing functionality
- Request specs for public and authenticated access
- Policy specs for authorization rules
- 100% coverage of sharing functionality
## Implementation Details
### Models Updated
- Stat: Now uses Shareable concern (removed duplicate code)
- Trip: Includes Shareable concern with notes/photos options
### Controllers Added
- Shared::TripsController: Handles public viewing and sharing management
### Views Added
- trips/public_show.html.erb: Public-facing trip view
- trips/_sharing.html.erb: Sharing controls partial
### JavaScript Added
- public_trip_map_controller.js: Map rendering for public trips
### Helpers Extended
- TripsHelper: Added sharing status and expiration helpers
## Breaking Changes
None. This is a purely additive feature.
## Migration Required
Yes. Run: rails db:migrate
## Testing
All specs pass:
- spec/models/concerns/shareable_spec.rb
- spec/models/trip_spec.rb
- spec/requests/shared/trips_spec.rb
- spec/policies/trip_policy_spec.rb
2025-11-05 15:44:27 +00:00
Eugene Burmakin
6787273713
Updte map view
2025-10-30 19:16:38 +01:00
Eugene Burmakin
05237995cf
Fix remembering family members layer state and refreshing locations
2025-10-21 19:54:25 +02:00
Eugene Burmakin
18551fb940
Update map settings button size and styling
2025-10-20 20:41:01 +02:00
Eugene Burmakin
1e63b03b49
Show battery status on family member popup
2025-10-20 20:34:05 +02:00
Eugene Burmakin
1bf02bc063
Merge branch 'dev' into fix/family-stuff
2025-10-20 20:21:20 +02:00
Eugene Burmakin
04a9d4b418
Show flash message
2025-10-20 20:18:35 +02:00
Eugene Burmakin
632f389ace
Remember enabled map layers for users
2025-10-20 20:11:28 +02:00
Eugene Burmakin
e7884b1f4f
Properly provide default distance unit in user settings
2025-10-20 19:42:24 +02:00
Eugene Burmakin
e3c6da1332
Add tooltips to map controls
2025-10-15 12:01:51 +02:00
Eugene Burmakin
44cbfff8ff
Extract map controls to a separate file
2025-10-15 11:43:49 +02:00
Eugene Burmakin
79a2140e6f
Make sure date nav not being hidden when clicking next/prev day button
2025-10-14 17:39:17 +02:00
Eugene Burmakin
6da1019bf3
Add collapsible footer to map controls and update location search icon
2025-10-14 17:30:53 +02:00
Eugene Burmakin
e72b2d9182
Update map navigation control for better responsiveness
2025-10-14 14:58:21 +02:00
Eugene Burmakin
4d5088a014
Add collapsible map controls panel for mobile view
2025-10-14 14:21:48 +02:00
Eugene Burmakin
732839d586
Update icons on the map
2025-10-14 13:47:41 +02:00
Eugene Burmakin
b4fbe6dbda
Add a button to copy invitation link for pending invitations
2025-10-14 13:28:56 +02:00
Eugene Burmakin
39c3c157c8
Implement real-time family member location updates via ActionCable
2025-10-13 14:10:36 +02:00
Eugene Burmakin
0ee3deedd8
Fix family members tooltip and popup styles
2025-10-13 13:15:54 +02:00
Evgenii Burmakin
99281317d7
Merge branch 'dev' into feature/family
2025-10-13 12:30:27 +02:00
Eugene Burmakin
87d7b8be7c
Fix minor bugs in map visit interactivity and popup styling
2025-10-07 21:16:42 +02:00
Eugene Burmakin
56a20d4db6
Fix popup styling for manual visit creation
2025-10-07 21:02:20 +02:00
Eugene Burmakin
e7df54d738
Fix routes to use singular resource for family
2025-10-04 23:08:02 +02:00
Eugene Burmakin
9bc0e2accc
Use family path instead of families/id
2025-10-04 22:39:47 +02:00
Eugene Burmakin
cfe319df9b
Move family controllers to their own namespace
2025-10-04 20:48:44 +02:00
Eugene Burmakin
78693f3001
Merge branch 'dev' into feature/family
2025-10-04 15:57:03 +02:00
Eugene Burmakin
db8d886ee2
Use ids instead of uuids for primary keys in family tables
2025-09-30 18:43:26 +02:00
Eugene Burmakin
0728c21c61
Update stuff, fix stuff
2025-09-29 22:27:07 +02:00
Eugene Burmakin
f6b32371ec
Show family members on the map
2025-09-29 21:31:24 +02:00
Eugene Burmakin
1f67e889e3
Complete phase 5
2025-09-28 13:10:07 +02:00
Eugene Burmakin
ea0d03f4b0
Merge branch 'dev', remote-tracking branch 'origin' into refactoring/user-data-import
2025-09-26 19:31:31 +02:00
Eugene Burmakin
38e3915404
Remove forced theme switching for maps based on OS theme.
2025-09-26 19:28:46 +02:00
Eugene Burmakin
7a7f0b09df
Update map layers based on user theme preference (light/dark) and add theme-aware styling to map controls and buttons.
2025-09-26 18:49:13 +02:00
Eugene Burmakin
63aa197a29
Update error message
2025-09-23 21:16:25 +02:00
Eugene Burmakin
6a0cc112dc
Introduce limit for trial users: max 5 imports, 10MB per file
2025-09-23 21:14:55 +02:00
Eugene Burmakin
031104cdaa
Rework importing user data archive
2025-09-23 20:39:12 +02:00
Eugene Burmakin
a20a3c5b36
Fix missing hexes
2025-09-19 22:52:08 +02:00
Eugene Burmakin
0905ef65a5
Don't pass h3_resolution from frontend; use default in backend service
2025-09-18 19:45:53 +02:00
Eugene Burmakin
c67532bb10
Reimplement hexagons with H3
2025-09-17 01:55:42 +02:00
Eugene Burmakin
8c45404420
Fix hexagons render
2025-09-15 20:10:53 +02:00
Eugene Burmakin
6314442770
Calculate only centers of hexagons
2025-09-14 12:41:16 +02:00
Eugene Burmakin
a2aa1be271
Precalculate hexagons for stats
2025-09-13 23:11:42 +02:00
Eugene Burmakin
ef01d028ba
Load leaflet protomaps only if not selfhosted on public month page
2025-09-13 12:07:29 +02:00
Eugene Burmakin
cc1fecfd22
Show QR code by default and use map tiles based on self-hosted setting
2025-09-13 11:58:50 +02:00
Eugene Burmakin
5ff35136f2
Add images for stats page backgrounds
2025-09-12 20:11:14 +02:00
Eugene Burmakin
612c30026c
Add hexagons to public stats page
2025-09-12 08:33:51 +02:00
Eugene Burmakin
e8c5b3dfdc
Update stats page
2025-09-11 21:41:52 +02:00
Eugene Burmakin
fc068ec79d
Add Lucide icons and stats sharing
2025-09-11 20:41:43 +02:00
Eugene Burmakin
acd3b20ef5
Add stats month page
2025-09-11 00:19:34 +02:00