Facelift offline.html and use Bootstrap classes for "notifications"

Update site_controller_test.rb

Update site_controller_test.rb

Remove whitespace

Reset Settings.status after test is done

Update test for offline page

Update site_controller.rb

Fix indentation

Update offline controller

Update offline.html.erb

Remove flash CSS classes and fix missed tests

Updated tests

Address most PR comments

Update _flash.html.erb

Update _flash.html.erb

Update edit.html.erb

Update offline.html.erb
This commit is contained in:
Dimitar 2023-01-22 12:25:42 +02:00 committed by Sky
parent 1becffcbf5
commit 318064b2a7
12 changed files with 58 additions and 70 deletions

View file

@ -1253,22 +1253,6 @@ tr.turn:hover {
display: none;
}
/* Rules for "flash" notice boxes shown at the top of the content area */
.flash {
&.error {
background-color: #ff7070;
}
&.warning {
background-color: #ffe0cc;
}
&.notice {
background-color: #CBEEA7;
}
}
/* Rules for highlighting fields with rails validation errors */
.formError {

View file

@ -113,7 +113,14 @@ class SiteController < ApplicationController
def export; end
def offline; end
def offline
flash.now[:warning] = if Settings.status == "database_offline"
t("layouts.osm_offline")
else
t("layouts.osm_read_only")
end
render :html => nil, :layout => true
end
def preview
render :html => RichText.new(params[:type], params[:text]).to_html

View file

@ -1,5 +1,5 @@
<% if flash[:error] %>
<div class="flash error row mx-0 p-3 align-items-center">
<div class="alert alert-danger row mx-0 mb-0 p-3 rounded-0 align-items-center">
<div class="col-auto">
<picture>
<source srcset="<%= image_path "notice.svg" %>" type="image/svg+xml" />
@ -11,7 +11,7 @@
<% end %>
<% if flash[:warning] %>
<div class="flash warning row mx-0 p-3 align-items-center">
<div class="alert alert-warning row mx-0 mb-0 p-3 rounded-0 align-items-center">
<div class="col-auto">
<picture>
<source srcset="<%= image_path "notice.svg" %>" type="image/svg+xml"></source>
@ -23,7 +23,7 @@
<% end %>
<% if flash[:notice] %>
<div class="flash notice row mx-0 p-3 align-items-center">
<div class="alert alert-success row mx-0 mb-0 p-3 rounded-0 align-items-center">
<div class="col-auto">
<picture>
<source srcset="<%= image_path "notice.svg" %>" type="image/svg+xml"></source>

View file

@ -1,8 +1,12 @@
<% content_for :content do %>
<% if Settings.status == "database_offline" or Settings.status == "api_offline" %>
<p><%= t "layouts.osm_offline" %></p>
<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" %>
<p><%= t "layouts.osm_read_only" %></p>
<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>

View file

@ -1,7 +0,0 @@
<% if Settings.status == "database_offline" %>
<p><%= t "layouts.osm_offline" %>
</p>
<% else %>
<p><%= t "layouts.osm_read_only" %>
</p>
<% end %>