Claude
429f90e666
Refactor: Apply Rails best practice for early returns
...
Follow Rails convention of using "render/redirect ... and return"
instead of standalone return statements in controller actions.
## Changes
**Shared::TripsController#show**
Before:
```ruby
unless @trip&.public_accessible?
return redirect_to root_path, alert: '...'
end
```
After:
```ruby
redirect_to root_path, alert: '...' and return unless @trip&.public_accessible?
```
**TripsController#update**
Before:
```ruby
if params[:sharing]
return update_sharing
end
```
After:
```ruby
update_sharing and return if params[:sharing]
```
## Benefits
- More idiomatic Rails code
- Clearer intent with single-line guard clauses
- Prevents potential double render issues
- Follows community best practices
2025-11-07 11:49:05 +00:00
Claude
9fba3ce4ca
Refactor: Move trip sharing management to trips#update
...
Simplifies architecture by using the existing trips#update route for
sharing settings management instead of a separate route.
## Changes
**Routes**
- Removed: PATCH /trips/:id/sharing → shared/trips#update
- Now uses: PATCH /trips/:id (existing route) with sharing params
**Controllers**
- Shared::TripsController: Simplified to only handle public view (show)
- TripsController: Added update_sharing private method to handle
sharing params when present
**Views**
- Updated JavaScript in _sharing.html.erb to use trip_path with
nested sharing params
**Tests**
- Updated request specs to use trip_path instead of sharing_trip_path
- All params now nested under sharing key
## Benefits
- Cleaner namespace separation (Shared:: only for public access)
- Follows Rails conventions (one update route handles everything)
- Simpler routing structure
- Reduced code duplication
## Backwards Compatibility
This is a breaking change for the sharing API endpoint, but since
this feature was just implemented and hasn't been released yet,
no migration path is needed.
2025-11-05 15:54:42 +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
6c62edb593
Fix UTM parameter assignment and update version to 0.34.2
2025-10-31 19:29:20 +01:00
Eugene Burmakin
8e35b8e09f
Move UTM parameter tracking logic into a concern
2025-10-30 19:59:31 +01:00
Eugene Burmakin
6787273713
Updte map view
2025-10-30 19:16:38 +01:00
Eugene Burmakin
8c9fc5a5e0
Add titles to family views for better SEO and UX and update map tile URLs to use the planet dataset.
2025-10-26 11:59:06 +01:00
Eugene Burmakin
d23e118645
Make sure family invitations are handled after sign-in
2025-10-22 21:36:51 +02:00
Eugene Burmakin
7ee2cb22ba
Small fixes
2025-10-22 20:39:02 +02:00
Eugene Burmakin
4677bcc698
Fix confirmation dialogs to show only once.
2025-10-21 20:01:13 +02: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
801e0c9bfa
Don't c hange map.html.erb
2025-10-20 20:19:21 +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
1671a781b0
Improve performance of Google Maps imports by batching database inserts.
2025-10-16 18:59:21 +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
36289d2469
Use margins for left and right spacing instead of padding to prevent horizontal overflow on small screens.
2025-10-14 18:29:31 +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
9953c2fb88
Merge branch 'dev' into fix/family-stuff
2025-10-14 13:49:46 +02:00
Eugene Burmakin
b1dd654463
Merge branch 'dev', remote-tracking branch 'origin' into feature/full-screen-map
2025-10-14 13:47:58 +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
Eugene Burmakin
aff44d6669
Fix stats layout
2025-10-13 12:45:42 +02:00
Evgenii Burmakin
99281317d7
Merge branch 'dev' into feature/family
2025-10-13 12:30:27 +02:00
Eugene Burmakin
a93cb8ff41
Remove comments
2025-10-13 12:25:30 +02:00
Eugene Burmakin
29ae5c04f1
Refactor family membership and invitation policies for clarity and security
2025-10-13 12:23:01 +02:00
Eugene Burmakin
923ea113c8
Fix some minor stuff
2025-10-11 14:17:48 +02:00
Eugene Burmakin
d3aa3bd067
Fix missing default map layer when user settings are not set
2025-10-07 22:25:41 +02:00
Eugene Burmakin
cde5af7c24
Rename method call to not shadow variable name
2025-10-07 22:10:48 +02:00
Eugene Burmakin
a7b92c10f5
Fix time shift when creating visits manually
2025-10-07 22:00:11 +02:00
Eugene Burmakin
194f8c3c45
Show visited countries in a modal window on the Trip page
2025-10-07 21:49:58 +02:00
Eugene Burmakin
ab4786d7b9
Fix minor bugs in Stat model related to sharing settings
2025-10-07 21:24:38 +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
e711ff25fe
Refactor family invitations and memberships into separate models and controllers
2025-10-07 18:38:06 +02:00
Eugene Burmakin
87c5c34fb4
Update batch size for streaming imports to 5000
2025-10-05 21:18:16 +02:00
Eugene Burmakin
6591a629ad
Stream points during user data import
2025-10-05 20:59:03 +02:00
Eugene Burmakin
6fb5d98b19
Extract update location sharing logic to a service object
2025-10-05 19:40:42 +02:00
Eugene Burmakin
018760812a
Extract family functionality to a concern
2025-10-05 14:24:45 +02:00
Eugene Burmakin
0b9a1005e5
Fix tests
2025-10-05 01:09:46 +02:00