Skip to content

Commit 0cc5ac0

Browse files
authored
Merge pull request #199 from Freika/feature/map-settings
Map settings
2 parents d11cfd8 + fbc5eba commit 0cc5ac0

File tree

15 files changed

+801
-183
lines changed

15 files changed

+801
-183
lines changed

.app_version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.12.1
1+
0.12.2

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8+
## [0.12.2] — 2024-08-28
9+
10+
### Added
11+
12+
- `PATCH /api/v1/settings` endpoint to update user settings with swagger docs
13+
- `GET /api/v1/settings` endpoint to get user settings with swagger docs
14+
- Missing `page` and `per_page` query parameters to the `GET /api/v1/points` endpoint swagger docs
15+
16+
### Changed
17+
18+
- Map settings moved to the map itself and are available in the top right corner of the map under the gear icon.
19+
20+
821
## [0.12.1] — 2024-08-25
922

1023
### Fixed

app/assets/builds/tailwind.css

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/assets/stylesheets/application.css

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,37 @@
2323
.timeline-box {
2424
overflow: visible !important;
2525
}
26+
27+
/* Style for the settings panel */
28+
.leaflet-settings-panel {
29+
background-color: white;
30+
padding: 10px;
31+
border: 1px solid #ccc;
32+
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
33+
}
34+
35+
.leaflet-settings-panel label {
36+
display: block;
37+
margin-bottom: 5px;
38+
}
39+
40+
.leaflet-settings-panel input {
41+
width: 100%;
42+
margin-bottom: 10px;
43+
padding: 5px;
44+
border: 1px solid #ccc;
45+
border-radius: 3px;
46+
}
47+
48+
.leaflet-settings-panel button {
49+
padding: 5px 10px;
50+
background-color: #007bff;
51+
color: white;
52+
border: none;
53+
border-radius: 3px;
54+
cursor: pointer;
55+
}
56+
57+
.leaflet-settings-panel button:hover {
58+
background-color: #0056b3;
59+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# frozen_string_literal: true
2+
3+
class Api::V1::SettingsController < ApiController
4+
def index
5+
render json: {
6+
settings: current_api_user.settings,
7+
status: 'success'
8+
}, status: :ok
9+
end
10+
11+
def update
12+
settings_params.each { |key, value| current_api_user.settings[key] = value }
13+
14+
if current_api_user.save
15+
render json: {
16+
message: 'Settings updated',
17+
settings: current_api_user.settings,
18+
status: 'success'
19+
}, status: :ok
20+
else
21+
render json: {
22+
message: 'Something went wrong',
23+
errors: current_api_user.errors.full_messages
24+
}, status: :unprocessable_entity
25+
end
26+
end
27+
28+
private
29+
30+
def settings_params
31+
params.require(:settings).permit(
32+
:meters_between_routes, :minutes_between_routes, :fog_of_war_meters,
33+
:time_threshold_minutes, :merge_threshold_minutes, :route_opacity
34+
)
35+
end
36+
end

0 commit comments

Comments
 (0)