From 318064b2a7f4b39119dfab02c712832c0f8c5859 Mon Sep 17 00:00:00 2001 From: Dimitar <19364673+Dimitar5555@users.noreply.github.com> Date: Sun, 22 Jan 2023 12:25:42 +0200 Subject: [PATCH] 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 --- app/assets/stylesheets/common.scss | 16 ------- app/controllers/site_controller.rb | 9 +++- app/views/layouts/_flash.html.erb | 6 +-- app/views/site/edit.html.erb | 8 +++- app/views/site/offline.html.erb | 7 --- test/controllers/accounts_controller_test.rb | 12 ++--- test/controllers/messages_controller_test.rb | 2 +- test/controllers/passwords_controller_test.rb | 2 +- .../preferences_controller_test.rb | 8 ++-- test/controllers/profiles_controller_test.rb | 8 ++-- test/controllers/site_controller_test.rb | 2 +- test/integration/user_login_test.rb | 48 +++++++++---------- 12 files changed, 58 insertions(+), 70 deletions(-) delete mode 100644 app/views/site/offline.html.erb diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index 5a197d9b1..06f98cc57 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -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 { diff --git a/app/controllers/site_controller.rb b/app/controllers/site_controller.rb index a05fe376b..5fb8aa111 100644 --- a/app/controllers/site_controller.rb +++ b/app/controllers/site_controller.rb @@ -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 diff --git a/app/views/layouts/_flash.html.erb b/app/views/layouts/_flash.html.erb index 5dda3ad5c..eaf3078fe 100644 --- a/app/views/layouts/_flash.html.erb +++ b/app/views/layouts/_flash.html.erb @@ -1,5 +1,5 @@ <% if flash[:error] %> -