mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 01:01:39 -05:00
3.5 KiB
3.5 KiB
Places Integration Checklist
Files Modified:
- ✅
app/javascript/controllers/stat_page_controller.js- Added PlacesManager integration - ✅
app/javascript/maps/places.js- Fixed API authentication headers - ✅
app/views/stats/_month.html.erb- Added Places button and tag filters - ✅
app/views/shared/_place_creation_modal.html.erb- Already exists
What Should Appear:
On Monthly Stats Page (/stats/YYYY/MM):
-
Map Controls (top right of map):
- "Heatmap" button
- "Points" button
- "Places" button ← NEW!
-
Below the Map:
- "Filter Places by Tags" section ← NEW!
- Checkboxes for each tag you've created
- Each checkbox shows: icon + name + color dot
Troubleshooting Steps:
Step 1: Restart Server
# Stop server (Ctrl+C)
bundle exec rails server
# Or with Docker:
docker-compose restart web
Step 2: Hard Refresh Browser
- Mac:
Cmd + Shift + R - Windows/Linux:
Ctrl + Shift + R
Step 3: Check Browser Console
- Open Developer Tools (F12)
- Go to Console tab
- Look for errors (red text)
- You should see: "StatPage controller connected"
Step 4: Verify URL
Make sure you're on a monthly stats page:
- ✅
/stats/2024/11← Correct - ❌
/stats← Wrong (main stats index) - ❌
/stats/2024← Wrong (yearly stats)
Step 5: Check JavaScript Loading
In browser console, type:
console.log(document.querySelector('[data-controller="stat-page"]'))
Should show the element, not null.
Step 6: Verify Controller Registration
In browser console:
console.log(application.controllers)
Should include "stat-page" in the list.
Expected Behavior:
When You Click "Places" Button:
- Places layer toggles on/off
- Button highlights when active
- Map shows custom markers with tag icons
When You Check Tag Filters:
- Map updates immediately
- Shows only places with selected tags
- Unchecking all shows all places
If Nothing Shows:
Check if you have any places created:
bundle exec rails console
# In console:
user = User.find_by(email: 'your@email.com')
user.places.count # Should be > 0
user.tags.count # Should be > 0
Create test data:
bundle exec rails console
user = User.first
tag = user.tags.create!(name: "Test", icon: "📍", color: "#FF5733")
# Create via API or console:
place = user.places.create!(
name: "Test Place",
latitude: 40.7128,
longitude: -74.0060,
source: :manual
)
place.tags << tag
Verification Script:
Run this in Rails console to verify everything:
user = User.first
puts "Tags: #{user.tags.count}"
puts "Places: #{user.places.count}"
puts "Places with tags: #{user.places.joins(:tags).distinct.count}"
if user.tags.any?
puts "\nYour tags:"
user.tags.each do |tag|
puts " #{tag.icon} #{tag.name} (#{tag.places.count} places)"
end
end
if user.places.any?
puts "\nYour places:"
user.places.limit(5).each do |place|
puts " #{place.name} at (#{place.latitude}, #{place.longitude})"
puts " Tags: #{place.tags.map(&:name).join(', ')}"
end
end
Still Having Issues?
Check these files exist and have the right content:
app/javascript/maps/places.js- Should export PlacesManager classapp/javascript/controllers/stat_page_controller.js- Should import PlacesManagerapp/views/stats/_month.html.erb- Should have Places button at line ~73
Look for JavaScript errors in browser console that might indicate:
- Import/export issues
- Syntax errors
- Missing dependencies