Merge remote-tracking branch 'upstream/pull/5403'
This commit is contained in:
commit
2cfc030bba
7 changed files with 51 additions and 27 deletions
app
controllers
views
config
|
@ -259,12 +259,7 @@ class ApplicationController < ActionController::Base
|
||||||
|
|
||||||
request.content_security_policy = policy
|
request.content_security_policy = policy
|
||||||
|
|
||||||
case Settings.status
|
flash.now[:warning] = { :partial => "layouts/offline_flash" } unless api_status == "online"
|
||||||
when "database_offline", "api_offline"
|
|
||||||
flash.now[:warning] = t("layouts.osm_offline")
|
|
||||||
when "database_readonly", "api_readonly"
|
|
||||||
flash.now[:warning] = t("layouts.osm_read_only")
|
|
||||||
end
|
|
||||||
|
|
||||||
request.xhr? ? "xhr" : "map"
|
request.xhr? ? "xhr" : "map"
|
||||||
end
|
end
|
||||||
|
|
|
@ -107,6 +107,14 @@ class SiteController < ApplicationController
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
# don't try and derive a location from a missing/deleted object
|
# don't try and derive a location from a missing/deleted object
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if api_status != "online"
|
||||||
|
flash.now[:warning] = { :partial => "layouts/offline_flash" }
|
||||||
|
elsif current_user && !current_user.data_public?
|
||||||
|
flash.now[:warning] = { :partial => "not_public_flash" }
|
||||||
|
else
|
||||||
|
@enable_editor = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def copyright
|
def copyright
|
||||||
|
@ -129,11 +137,7 @@ class SiteController < ApplicationController
|
||||||
def export; end
|
def export; end
|
||||||
|
|
||||||
def offline
|
def offline
|
||||||
flash.now[:warning] = if Settings.status == "database_offline"
|
flash.now[:warning] = { :partial => "layouts/offline_flash" }
|
||||||
t("layouts.osm_offline")
|
|
||||||
else
|
|
||||||
t("layouts.osm_read_only")
|
|
||||||
end
|
|
||||||
render :html => nil, :layout => true
|
render :html => nil, :layout => true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
26
app/views/layouts/_offline_flash.erb
Normal file
26
app/views/layouts/_offline_flash.erb
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
<div class="d-flex flex-column gap-2">
|
||||||
|
<% if %w[database_offline api_offline].include? Settings.status %>
|
||||||
|
<p class="mb-0">
|
||||||
|
<%= t(".osm_offline") %>
|
||||||
|
</p>
|
||||||
|
<% elsif %w[database_readonly api_readonly].include? Settings.status %>
|
||||||
|
<p class="mb-0">
|
||||||
|
<%= t(".osm_read_only") %>
|
||||||
|
</p>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if Settings.status_expected_restore_date %>
|
||||||
|
<% expected_restore_time = Time.parse(Settings.status_expected_restore_date).utc %>
|
||||||
|
<% if expected_restore_time > Time.now.utc %>
|
||||||
|
<p class="mb-0">
|
||||||
|
<%= t ".expected_restore_html", :time => friendly_date(expected_restore_time) %>
|
||||||
|
</p>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if Settings.status_announcement_url %>
|
||||||
|
<p class="mb-0">
|
||||||
|
<%= link_to t(".announcement"), Settings.status_announcement_url %>
|
||||||
|
</p>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
3
app/views/site/_not_public_flash.erb
Normal file
3
app/views/site/_not_public_flash.erb
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<p><%= t ".not_public" %></p>
|
||||||
|
<p><%= t ".not_public_description_html", :user_page => (link_to t(".user_page_link"), edit_account_path(:anchor => "public")) %></p>
|
||||||
|
<p><%= t ".anon_edits_html", :link => link_to(t(".anon_edits_link_text"), t(".anon_edits_link")) %></p>
|
|
@ -1,17 +1,5 @@
|
||||||
<% content_for :content do %>
|
<% content_for :content do %>
|
||||||
<% if Settings.status == "database_offline" or Settings.status == "api_offline" %>
|
<% if @enable_editor %>
|
||||||
<div class="alert alert-warning text-center">
|
|
||||||
<p class="my-2"><%= t "layouts.osm_offline" %></p>
|
|
||||||
</div>
|
|
||||||
<% elsif Settings.status == "database_readonly" or Settings.status == "api_readonly" %>
|
|
||||||
<div class="alert alert-warning text-center">
|
|
||||||
<p class="my-2"><%= t "layouts.osm_read_only" %></p>
|
|
||||||
</div>
|
|
||||||
<% elsif !current_user.data_public? %>
|
|
||||||
<p><%= t ".not_public" %></p>
|
|
||||||
<p><%= t ".not_public_description_html", :user_page => (link_to t(".user_page_link"), edit_account_path(:anchor => "public")) %></p>
|
|
||||||
<p><%= t ".anon_edits_html", :link => link_to(t(".anon_edits_link_text"), t(".anon_edits_link")) %></p>
|
|
||||||
<% else %>
|
|
||||||
<%= render :partial => preferred_editor %>
|
<%= render :partial => preferred_editor %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -1624,8 +1624,6 @@ en:
|
||||||
partners_corpmembers: "OSMF corporate members"
|
partners_corpmembers: "OSMF corporate members"
|
||||||
partners_partners: "partners"
|
partners_partners: "partners"
|
||||||
tou: "Terms of Use"
|
tou: "Terms of Use"
|
||||||
osm_offline: "The OpenStreetMap database is currently offline while essential database maintenance work is carried out."
|
|
||||||
osm_read_only: "The OpenStreetMap database is currently in read-only mode while essential database maintenance work is carried out."
|
|
||||||
nothing_to_preview: "Nothing to preview."
|
nothing_to_preview: "Nothing to preview."
|
||||||
help: Help
|
help: Help
|
||||||
about: About
|
about: About
|
||||||
|
@ -1633,6 +1631,11 @@ en:
|
||||||
communities: Communities
|
communities: Communities
|
||||||
learn_more: "Learn More"
|
learn_more: "Learn More"
|
||||||
more: More
|
more: More
|
||||||
|
offline_flash:
|
||||||
|
osm_offline: "The OpenStreetMap database is currently offline while essential maintenance work is carried out."
|
||||||
|
osm_read_only: "The OpenStreetMap database is currently in read-only mode while essential maintenance work is carried out."
|
||||||
|
expected_restore_html: "Services are expected to be restored in %{time}."
|
||||||
|
announcement: "You can read the announcement here."
|
||||||
user_mailer:
|
user_mailer:
|
||||||
diary_comment_notification:
|
diary_comment_notification:
|
||||||
description: "OpenStreetMap Diary Entry #%{id}"
|
description: "OpenStreetMap Diary Entry #%{id}"
|
||||||
|
@ -2249,13 +2252,14 @@ en:
|
||||||
license_url: "https://openstreetmap.org/copyright"
|
license_url: "https://openstreetmap.org/copyright"
|
||||||
project_url: "https://openstreetmap.org"
|
project_url: "https://openstreetmap.org"
|
||||||
remote_failed: "Editing failed - make sure JOSM or Merkaartor is loaded and the remote control option is enabled"
|
remote_failed: "Editing failed - make sure JOSM or Merkaartor is loaded and the remote control option is enabled"
|
||||||
edit:
|
not_public_flash:
|
||||||
not_public: "You have not set your edits to be public."
|
not_public: "You have not set your edits to be public."
|
||||||
not_public_description_html: "You can no longer edit the map unless you do so. You can set your edits as public from your %{user_page}."
|
not_public_description_html: "You can no longer edit the map unless you do so. You can set your edits as public from your %{user_page}."
|
||||||
user_page_link: user page
|
user_page_link: user page
|
||||||
anon_edits_html: "(%{link})"
|
anon_edits_html: "(%{link})"
|
||||||
anon_edits_link: "https://wiki.openstreetmap.org/wiki/Disabling_anonymous_edits"
|
anon_edits_link: "https://wiki.openstreetmap.org/wiki/Disabling_anonymous_edits"
|
||||||
anon_edits_link_text: "Find out why this is the case."
|
anon_edits_link_text: "Find out why this is the case."
|
||||||
|
edit:
|
||||||
id_not_configured: "iD has not been configured"
|
id_not_configured: "iD has not been configured"
|
||||||
export:
|
export:
|
||||||
title: "Export"
|
title: "Export"
|
||||||
|
|
|
@ -23,6 +23,10 @@ api_version: "0.6"
|
||||||
# database_offline - database offline with site in emergency mode
|
# database_offline - database offline with site in emergency mode
|
||||||
# gpx_offline - gpx storage offline
|
# gpx_offline - gpx storage offline
|
||||||
status: "online"
|
status: "online"
|
||||||
|
# Expected services restoration date added to offline flash messages
|
||||||
|
#status_expected_restore_date: "2024-12-18 12:00:00Z"
|
||||||
|
# Application status announcement url added to offline flash messages
|
||||||
|
#status_announcement_url: "https://en.osm.town/@osm_tech"
|
||||||
# The maximum area you're allowed to request, in square degrees
|
# The maximum area you're allowed to request, in square degrees
|
||||||
max_request_area: 0.25
|
max_request_area: 0.25
|
||||||
# Number of GPS trace/trackpoints returned per-page
|
# Number of GPS trace/trackpoints returned per-page
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue