]> cat aescling's git repositories - mastodon.git/commitdiff
New error page graphic. Other error page improvements (#5099)
authorEugen Rochko <eugen@zeonfederated.com>
Mon, 25 Sep 2017 21:05:54 +0000 (23:05 +0200)
committerGitHub <noreply@github.com>
Mon, 25 Sep 2017 21:05:54 +0000 (23:05 +0200)
- 500.html generated with admin-set default locale if set
- Error page `<title>` includes Mastodon site title
- 500 title changed to "This page is not
  correct" (ref: <https://www.youtube.com/watch?v=2VCAP_seh1A>)
- 500 content appended with "on our end" to make clear it's
  not user's fault

app/javascript/styles/basics.scss
app/views/errors/500.html.haml
app/views/layouts/error.html.haml
config/locales/en.yml
lib/tasks/assets.rake
public/oops.gif [new file with mode: 0644]
public/oops.png [deleted file]

index 48652a0358555c4da91be7956d1b4265f3a5342c..96f0023c3d8aeb80f86d950e52f2cb4307ee2538 100644 (file)
@@ -70,9 +70,8 @@ body {
 
     .dialog img {
       display: block;
-      margin: 20px auto;
-      margin-top: 50px;
-      max-width: 600px;
+      margin: 0 auto;
+      max-width: 470px;
       width: 100%;
       height: auto;
     }
index e124be5517ac216b6445c0630b52721b02c424a0..6244ff209f66dae71a27bf027f26431bb7323925 100644 (file)
@@ -1,5 +1,5 @@
 - content_for :page_title do
-  = t('errors.500')
+  = t('errors.500.title')
 
 - content_for :content do
-  = t('errors.500')
+  = t('errors.500.content')
index 0b5f908aefc8cfa9ef06c3d5ba5c458d35c5b171..31f3220964a440bdd80c80c046def06043d75dcf 100644 (file)
@@ -3,12 +3,12 @@
   %head
     %meta{ content: 'text/html; charset=UTF-8', 'http-equiv' => 'Content-Type' }/
     %meta{ charset: 'utf-8' }/
-    %title= yield :page_title
+    %title= safe_join([yield(:page_title), title], ' - ')
     %meta{ content: 'width=device-width,initial-scale=1', name: 'viewport' }/
     = stylesheet_pack_tag 'common', media: 'all'
     = stylesheet_pack_tag Setting.default_settings['theme'], media: 'all'
   %body.error
     .dialog
-      %img{ alt: 'Mastodon', src: '/oops.png' }/
+      %img{ alt: title, src: '/oops.gif' }/
       %div
         %h1= yield :content
index cc440e1b0bcb6c1d191e0b594673f2c41fc9ef38..f87d8532c551cb90e8f80e0b3f2bac4ad75c5029 100644 (file)
@@ -310,7 +310,9 @@ en:
       content: Security verification failed. Are you blocking cookies?
       title: Security verification failed
     '429': Throttled
-    '500': We're sorry, but something went wrong.
+    '500':
+      content: We're sorry, but something went wrong on our end.
+      title: This page is not correct
     noscript_html: To use the Mastodon web application, please enable JavaScript. Alternatively, try one of the <a href="https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/Apps.md">native apps</a> for Mastodon for your platform.
   exports:
     blocks: You block
index ad7c6ba9009ee973326dcda4d2426c2a57c7b3eb..2ef72fdef060044bb80140730a482dfad768d486 100644 (file)
@@ -3,15 +3,16 @@
 namespace :assets do
   desc 'Generate 500.html'
   task :generate_500 do
-    html = ApplicationController.render('errors/500', layout: 'error')
-    File.write(Rails.root.join('public', '500.html'), html)
+    I18n.with_locale(ENV['DEFAULT_LOCALE'] || I18n.default_locale) do
+      html = ApplicationController.render('errors/500', layout: 'error')
+      File.write(Rails.root.join('public', '500.html'), html)
+    end
   end
 end
 
 if Rake::Task.task_defined?('assets:precompile')
   Rake::Task['assets:precompile'].enhance do
     Webpacker::Manifest.load
-
     Rake::Task['assets:generate_500'].invoke
   end
 end
diff --git a/public/oops.gif b/public/oops.gif
new file mode 100644 (file)
index 0000000..ad19c4e
Binary files /dev/null and b/public/oops.gif differ
diff --git a/public/oops.png b/public/oops.png
deleted file mode 100644 (file)
index 0abddad..0000000
Binary files a/public/oops.png and /dev/null differ