kemal/src/kemal/helpers/templates.cr

37 lines
26 KiB
Crystal
Raw Normal View History

2016-07-17 11:10:56 +00:00
# This file contains the built-in view templates that Kemal uses.
# Currently it contains templates for 404 and 500 error codes.
def render_404
<<-HTML
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
body { text-align:center;font-family:helvetica,arial;font-size:22px;
color:#888;margin:20px}
img { max-width: 579px; width: 100%; }
#c {margin:0 auto;width:500px;text-align:left}
</style>
</head>
<body>
<h2>Kemal doesn't know this way.</h2>
2018-06-30 11:49:39 +00:00
<svg id="svg" version="1.1" width="400" height="400" viewBox="0 0 400 400" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" ><g id="svgg"><path id="path0" d="M262.800 99.200 L 262.800 150.400 265.461 150.400 L 268.121 150.400 267.864 144.300 C 267.722 140.945,267.510 120.110,267.391 98.000 C 267.273 75.890,267.074 55.595,266.948 52.900 L 266.719 48.000 264.760 48.000 L 262.800 48.000 262.800 99.200 M160.800 290.800 C 160.800 291.301,161.224 291.301,162.000 290.800 C 162.485 290.486,162.428 290.411,161.700 290.406 C 161.205 290.403,160.800 290.580,160.800 290.800 M173.233 290.544 C 173.670 290.920,177.221 291.157,176.997 290.795 C 176.863 290.578,175.923 290.400,174.910 290.400 C 173.896 290.400,173.142 290.465,173.233 290.544 M217.600 290.800 C 217.600 291.269,217.907 291.269,219.000 290.800 C 219.709 290.495,219.675 290.453,218.700 290.428 C 218.095 290.413,217.600 290.580,217.600 290.800 M230.433 290.545 C 230.828 290.889,233.981 291.093,233.776 290.762 C 233.653 290.563,232.813 290.400,231.910 290.400 C 231.006 290.400,230.342 290.465,230.433 290.545 M179.600 291.600 C 180.376 292.101,180.800 292.101,180.800 291.600 C 180.800 291.380,180.395 291.203,179.900 291.206 C 179.172 291.211,179.115 291.286,179.600 291.600 M294.000 293.600 C 294.000 294.101,294.424 294.101,295.200 293.600 C 295.685 293.286,295.628 293.211,294.900 293.206 C 294.405 293.203,294.000 293.380,294.000 293.600 M103.478 295.766 C 104.095 296.297,104.674 296.658,104.764 296.569 C 104.980 296.353,103.182 294.800,102.716 294.800 C 102.518 294.800,102.860 295.235,103.478 295.766 M190.600 295.407 C 191.040 295.766,191.760 296.235,192.200 296.451 L 193.000 296.844 192.200 296.193 C 191.760 295.834,191.040 295.365,190.600 295.149 L 189.800 294.756 190.600 295.407 M203.100 295.503 C 201.482 296.507,201.758 296.916,203.400 295.947 C 204.170 295.493,204.800 295.049,204.800 294.960 C 204.800 294.638,204.174 294.837,203.100 295.503 M246.606 295.210 C 246.872 295.640,248.400 295.980,248.400 295.609 C 248.400 295.435,247.955 295.208,247.412 295.104 C 246.869 295.001,246.506 295.048,246.606 295.210 M290.562 295.662 L 289.800 296.524 290.900 295.816 C 292.034 295.086,292.249 294.800,291.662 294.800 C 291.476 294.800,290.981 295.188,290.562 295.662 M308.970 295.152 C 309.090 295.345,309.595 295.606,310.094 295.732 C 310.968 295.952,310.973 295.940,310.224 295.380 C 309.364 294.738,308.632 294.604,308.970 295.152 M312.417 297.073 C 312.426 297.253,313.066 297.803,313.838 298.295 C 314.610 298.788,315.137 299.021,315.009 298.814 C 314.639 298.216,312.398 296.711,312.417 297.073 M196.266 299.533 C 196.340 299.826,196.400 300.141,196.400 300.233 C 196.400 300.325,196.683 300.400,197.029 300.400 C 197.683 300.400,198.800 299.485,198.800 298.949 C 198.800 298.779,198.584 298.856,198.320 299.120 C 197.785 299.655,196.558 299.764,196.299 299.300 C 196.207 299.135,196.192 299.240,196.266 299.533 M97.200 300.400 C 96.764 300.682,97.092 300.788,98.400 300.788 C 99.708 300.788,100.036 300.682,99.600 300.400 C 99.270 300.187,98.730 300.012,98.400 300.012 C 98.070 300.012,97.530 300.187,97.200 300.400 M295.000 300.400 C 294.853 300.639,295.337 300.800,296.200 300.800 C 297.063 300.800,297.547 300.639,297.400 300.400 C 297.264 300.180,296.724 300.000,296.200 300.000 C 295.676 300.000,295.136 300.180,295.000 300.400 M77.060 301.238 C 76.666 301.699,76.447 302.181,76.575 302.309 C 76.815 302.548,77.964 301.238,77.987 300.700 C 78.007 300.234,77.834 300.334,77.060 301.238 M317.336 301.809 C 317.811 302.556,318.327 303.174,318.481 303.183 C 318.906 303.209,317.470 300.840,316.936 300.633 C 316.681 300.534,316.861 301.063,317.336 301.809 M258.394 301.582 C 258.941 302.002,259.468 302.266,259.565 302.169 C 259.791 301.942,258.329 300.827,257.800 300.822 C 257.580 300.820,257.847 301.161,258.394 301.582 M292.000 301.400 C 291.726 301.730,291.224 302.000,290.884 302.000 C 290.545 302.000,290.376 302.110,290.510 302.244 C 290.808 302.541,293.200 301.526,293.200 301.102 C 293.200 300.597,292.528 300.764,292.000 301.400 M108.285 302.402 C 108.400 302.843,108
</body>
</html>
2015-12-10 18:40:39 +00:00
HTML
end
2018-07-01 13:43:04 +00:00
def render_500(context, exception, verbosity)
context.response.content_type = "text/html"
context.response.status_code = 500
2018-07-01 13:43:04 +00:00
template = if verbosity
Kemal::ExceptionPage.for_runtime_exception(context, exception).to_s
else
Kemal::ExceptionPage.for_production_exception
end
2016-01-24 15:44:37 +00:00
context.response.print template
context
2015-12-10 18:40:39 +00:00
end