-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #199 from Freika/feature/map-settings
Map settings
- Loading branch information
Showing
15 changed files
with
801 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.12.1 | ||
0.12.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# frozen_string_literal: true | ||
|
||
class Api::V1::SettingsController < ApiController | ||
def index | ||
render json: { | ||
settings: current_api_user.settings, | ||
status: 'success' | ||
}, status: :ok | ||
end | ||
|
||
def update | ||
settings_params.each { |key, value| current_api_user.settings[key] = value } | ||
|
||
if current_api_user.save | ||
render json: { | ||
message: 'Settings updated', | ||
settings: current_api_user.settings, | ||
status: 'success' | ||
}, status: :ok | ||
else | ||
render json: { | ||
message: 'Something went wrong', | ||
errors: current_api_user.errors.full_messages | ||
}, status: :unprocessable_entity | ||
end | ||
end | ||
|
||
private | ||
|
||
def settings_params | ||
params.require(:settings).permit( | ||
:meters_between_routes, :minutes_between_routes, :fog_of_war_meters, | ||
:time_threshold_minutes, :merge_threshold_minutes, :route_opacity | ||
) | ||
end | ||
end |
Oops, something went wrong.