You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

500.tmpl 2.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. {{/* This page should only depend the minimal template functions/variables, to avoid triggering new panics.
  2. * base template functions: AppName, AssetUrlPrefix, AssetVersion, AppSubUrl, ThemeName
  3. * ctx.Locale
  4. * .Flash
  5. * .ErrorMsg
  6. * .SignedUser (optional)
  7. */}}
  8. <!DOCTYPE html>
  9. <html lang="{{ctx.Locale.Lang}}" data-theme="{{ThemeName .SignedUser}}">
  10. <head>
  11. <meta name="viewport" content="width=device-width, initial-scale=1">
  12. <title>Internal Server Error - {{AppName}}</title>
  13. <link rel="icon" href="{{AssetUrlPrefix}}/img/favicon.svg" type="image/svg+xml">
  14. <link rel="alternate icon" href="{{AssetUrlPrefix}}/img/favicon.png" type="image/png">
  15. {{template "base/head_style" .}}
  16. </head>
  17. <body>
  18. <div class="full height">
  19. <nav class="ui secondary menu">
  20. <div class="ui container tw-flex">
  21. <div class="item tw-flex-1">
  22. <a href="{{AppSubUrl}}/" aria-label="{{ctx.Locale.Tr "home"}}">
  23. <img width="30" height="30" src="{{AssetUrlPrefix}}/img/logo.svg" alt="{{ctx.Locale.Tr "logo"}}" aria-hidden="true">
  24. </a>
  25. </div>
  26. <div class="item">
  27. <button class="ui icon button disabled">{{svg "octicon-three-bars"}}</button>{{/* a fake button to make the UI looks better*/}}
  28. </div>
  29. </div>
  30. </nav>
  31. <div class="divider gt-my-0"></div>
  32. <div role="main" class="page-content status-page-500">
  33. <div class="ui container" >
  34. <style> .ui.message.flash-message { text-align: left; } </style>
  35. {{template "base/alert" .}}
  36. </div>
  37. <p class="gt-mt-5 center"><img src="{{AssetUrlPrefix}}/img/500.png" alt="Internal Server Error"></p>
  38. <div class="divider"></div>
  39. <div class="ui container gt-my-5">
  40. {{if .ErrorMsg}}
  41. <p>{{ctx.Locale.Tr "error.occurred"}}:</p>
  42. <pre class="tw-whitespace-pre-wrap tw-break-all">{{.ErrorMsg}}</pre>
  43. {{end}}
  44. <div class="center gt-mt-5">
  45. {{if or .SignedUser.IsAdmin .ShowFooterVersion}}<p>{{ctx.Locale.Tr "admin.config.app_ver"}}: {{AppVer}}</p>{{end}}
  46. {{if .SignedUser.IsAdmin}}<p>{{ctx.Locale.Tr "error.report_message"}}</p>{{end}}
  47. </div>
  48. </div>
  49. </div>
  50. </div>
  51. {{/* When a sub-template triggers an 500 error, its parent template has been partially rendered, then the 500 page
  52. will be rendered after that partially rendered page, the HTML/JS are totally broken. Use this inline script to try to move it to main viewport.
  53. And this page shouldn't include any other JS file, avoid duplicate JS execution (still due to the partial rendering).*/}}
  54. <script type="module">
  55. const embedded = document.querySelector('.page-content .page-content.status-page-500');
  56. if (embedded) {
  57. // move the 500 error page content to main view
  58. const embeddedParent = embedded.parentNode;
  59. let main = document.querySelector('.page-content');
  60. main = main ?? document.querySelector('body');
  61. main.prepend(document.createElement('hr'));
  62. main.prepend(embedded);
  63. embeddedParent.remove(); // remove the unrelated 500-page elements (eg: the duplicate nav bar)
  64. }
  65. </script>
  66. </body>
  67. </html>