Add ability to take GPX storage offline.
This commit is contained in:
parent
70dfeb0f3b
commit
0f5646d7f0
6 changed files with 26 additions and 4 deletions
|
@ -11,6 +11,8 @@ class TraceController < ApplicationController
|
|||
before_filter :check_api_writable, :only => [:api_create]
|
||||
before_filter :require_allow_read_gpx, :only => [:api_details, :api_data]
|
||||
before_filter :require_allow_write_gpx, :only => [:api_create]
|
||||
before_filter :offline_warning, :only => [:mine, :view]
|
||||
before_filter :offline_redirect, :only => [:create, :edit, :delete, :data, :api_data, :api_create]
|
||||
around_filter :api_call_handle_error, :only => [:api_details, :api_data, :api_create]
|
||||
|
||||
# Counts and selects pages of GPX traces for various criteria (by user, tags, public etc.).
|
||||
|
@ -387,4 +389,12 @@ private
|
|||
|
||||
end
|
||||
|
||||
def offline_warning
|
||||
flash.now[:warning] = t 'trace.offline_warning.message' if OSM_STATUS == :gpx_offline
|
||||
end
|
||||
|
||||
def offline_redirect
|
||||
redirect_to :action => :offline if OSM_STATUS == :gpx_offline
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
<tr>
|
||||
<% cl = cycle('table0', 'table1') %>
|
||||
<td class="<%= cl %>">
|
||||
<% if trace.inserted %>
|
||||
<a href="<%= url_for :controller => 'trace', :action => 'view', :id => trace.id, :display_name => trace.user.display_name %>"><img src="<%= url_for :controller => 'trace', :action => 'icon', :id => trace.id, :display_name => trace.user.display_name %>" border="0" alt="" /></a>
|
||||
<% else %>
|
||||
<span style="color:red"><%= t'trace.trace.pending' %></span>
|
||||
<% if OSM_STATUS != :gpx_offline %>
|
||||
<% if trace.inserted %>
|
||||
<a href="<%= url_for :controller => 'trace', :action => 'view', :id => trace.id, :display_name => trace.user.display_name %>"><img src="<%= url_for :controller => 'trace', :action => 'icon', :id => trace.id, :display_name => trace.user.display_name %>" border="0" alt="" /></a>
|
||||
<% else %>
|
||||
<span style="color:red"><%= t'trace.trace.pending' %></span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="<%= cl %>"><%= link_to trace.name, {:controller => 'trace', :action => 'view', :display_name => trace.user.display_name, :id => trace.id} %>
|
||||
|
|
2
app/views/trace/offline.html.erb
Normal file
2
app/views/trace/offline.html.erb
Normal file
|
@ -0,0 +1,2 @@
|
|||
<h2><%= t 'trace.offline.heading' %></h2>
|
||||
<p><%= t 'trace.offline.message' %></p>
|
|
@ -1,10 +1,12 @@
|
|||
<h2><%= t 'trace.view.heading', :name => h(@trace.name) %></h2>
|
||||
|
||||
<% if OSM_STATUS != :gpx_offline %>
|
||||
<% if @trace.inserted %>
|
||||
<img src="<%= url_for :controller => 'trace', :action => 'picture', :id => @trace.id, :display_name => @trace.user.display_name %>">
|
||||
<% else %>
|
||||
<span style="color:red"><%= t'trace.view.pending' %></span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<table border="0">
|
||||
<tr>
|
||||
|
|
|
@ -23,6 +23,7 @@ API_VERSION = ENV['OSM_API_VERSION'] || '0.6'
|
|||
# :api_offline - site online but API offline
|
||||
# :database_readonly - database and site in read-only mode
|
||||
# :database_offline - database offline with site in emergency mode
|
||||
# :gpx_offline - gpx storage offline
|
||||
#
|
||||
OSM_STATUS = :online
|
||||
|
||||
|
|
|
@ -1252,6 +1252,11 @@ en:
|
|||
scheduled_for_deletion: "Trace scheduled for deletion"
|
||||
make_public:
|
||||
made_public: "Trace made public"
|
||||
offline_warning:
|
||||
message: "The GPX file upload system is currently unavailable"
|
||||
offline:
|
||||
heading: "GPX Storage Offline"
|
||||
message: "The GPX file storage and upload system is currently unavailable."
|
||||
application:
|
||||
require_cookies:
|
||||
cookies_needed: "You appear to have cookies disabled - please enable cookies in your browser before continuing."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue