gitprep / mojo / lib / Mojolicious / templates / exception.development.html.ep /
7f391f5 10 years ago
1 contributor
226 lines | 7.147kb
<!DOCTYPE html>
<html>
  <head>
    <title>Server error</title>
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Expires" content="-1">
    %= javascript '/mojo/jquery/jquery.js'
    %= javascript '/mojo/prettify/run_prettify.js'
    %= stylesheet '/mojo/prettify/prettify-mojo-dark.css'
    %= stylesheet begin
      a img { border: 0 }
      body {
        background: url(<%= url_for '/mojo/pinstripe-light.png' %>);
        color: #445555;
        font: 0.9em 'Helvetica Neue', Helvetica, sans-serif;
        font-weight: normal;
        line-height: 1.5em;
        margin: 0;
      }
      pre {
        font: 0.9em Consolas, Menlo, Monaco, Courier, monospace;
        margin: 0;
        white-space: pre-wrap;
      }
      table {
        border-collapse: collapse;
        margin-top: 1em;
        margin-bottom: 1em;
        width: 100%;
      }
      td { padding: 0.5em }
      .box {
        background-color: #fff;
        box-shadow: 0px 0px 2px #999;
        overflow: hidden;
        padding: 1em;
      }
      .code {
        background-color: #1a1a1a;
        background: url(<%= url_for '/mojo/pinstripe-dark.png' %>);
        color: #eee;
        text-shadow: #333 0 1px 0;
      }
      .important { background-color: rgba(47, 48, 50, .75) }
      .infobox { color: #333 }
      .infobox tr:nth-child(odd) .value { background-color: #ddeeff }
      .infobox tr:nth-child(even) .value { background-color: #eef9ff }
      .key { text-align: right }
      .spaced {
        margin-left: 5em;
        margin-right: 5em;
      }
      .striped { border-top: solid #cce4ff 1px }
      .tap {
        font: 0.5em Verdana, sans-serif;
        text-align: center;
      }
      .value {
        padding-left: 1em;
        width: 100%;
      }
      #footer {
        padding-top: 1em;
        text-align: center;
      }
      #nothing { padding-top: 60px }
      #showcase > pre {
        font: 1.5em 'Helvetica Neue', Helvetica, sans-serif;
        font-weight: 300;
        margin: 0;
        text-shadow: #333 0 1px 0;
      }
      #showcase td {
        padding-top: 0;
        padding-bottom: 0;
      }
      #showcase .key { padding-right: 0 }
      #more, #trace {
        border-bottom-left-radius: 5px;
        border-bottom-right-radius: 5px;
      }
      #more .tap, #trace .tap { text-shadow: #ddd 0 1px 0 }
      #request {
        border-top-left-radius: 5px;
        border-top-right-radius: 5px;
        margin-top: 1em;
      }
      #wrapperlicious {
        max-width: 1000px;
        margin: 0 auto;
      }
    % end
  </head>
  <body>
    %= include inline => app->renderer->_bundled('mojobar')
    <div id="wrapperlicious">
      <div id="nothing" class="box spaced"></div>
      % my $cv = begin
        % my ($key, $value, $i) = @_;
        %= tag 'tr', $i ? (class => 'important') : undef, begin
          <td class="key"><%= $key %></td>
          <td class="value"><pre class="prettyprint"><%= $value %></pre></td>
        % end
      % end
      % my $kv = begin
        % my ($key, $value) = @_;
        <tr>
          <td class="key"><%= $key %>:</td>
          <td class="striped value"><pre><%= $value %></pre></td>
        </tr>
      % end
      <div id="showcase" class="box code spaced">
        <pre><%= $exception->message %></pre>
        <div id="context">
          <table>
            % for my $line (@{$exception->lines_before}) {
              %= $cv->($line->[0], $line->[1])
            % }
            % if (defined $exception->line->[1]) {
              %= $cv->($exception->line->[0], $exception->line->[1], 1)
            % }
            % for my $line (@{$exception->lines_after}) {
              %= $cv->($line->[0], $line->[1])
            % }
          </table>
        </div>
        % if (defined $exception->line->[2]) {
          <div id="insight">
            <table>
              % for my $line (@{$exception->lines_before}) {
                %= $cv->($line->[0], $line->[2])
              % }
              %= $cv->($exception->line->[0], $exception->line->[2], 1)
              % for my $line (@{$exception->lines_after}) {
                %= $cv->($line->[0], $line->[2])
              % }
            </table>
          </div>
          <div class="tap">tap for more</div>
          %= javascript begin
            var current = '#context';
            $('#showcase').click(function() {
              $(current).slideToggle('slow', function() {
                if (current == '#context') {
                  current = '#insight';
                }
                else {
                  current = '#context';
                }
                $(current).slideToggle('slow');
              });
            });
            $('#insight').toggle();
          % end
        % }
      </div>
      <div id="trace" class="box spaced">
        % if (@{$exception->frames}) {
          <div class="infobox" id="frames">
            <table>
              % for my $frame (@{$exception->frames}) {
                <tr>
                  <td class="striped value">
                    <pre><%= $frame->[1] . ':' . $frame->[2] %></pre>
                  </td>
                </tr>
              % }
            </table>
          </div>
          <div class="tap">tap for more</div>
          %= javascript begin
            $('#trace').click(function() {
              $('#frames').slideToggle('slow');
            });
            $('#frames').toggle();
          % end
        % }
      </div>
      <div id="request" class="box infobox spaced">
        <table>
          % my $req = $self->req;
          %= $kv->(Method => $req->method)
          % my $url = $req->url;
          %= $kv->(URL => $url->to_string)
          %= $kv->('Base URL' => $url->base->to_string)
          %= $kv->(Parameters => dumper $req->params->to_hash)
          %= $kv->(Stash => dumper $snapshot)
          %= $kv->(Session => dumper session)
          %= $kv->(Version => $req->version)
          % for my $name (sort @{$self->req->headers->names}) {
            % my $value = $self->req->headers->header($name);
            %= $kv->($name, $value)
          % }
        </table>
      </div>
      <div id="more" class="box infobox spaced">
        <div id="infos">
          <table>
            %= $kv->(Perl => "$^V ($^O)")
            % my $version  = $Mojolicious::VERSION;
            % my $codename = $Mojolicious::CODENAME;
            %= $kv->(Mojolicious => "$version ($codename)")
            %= $kv->(Home => app->home)
            %= $kv->(Include => dumper \@INC)
            %= $kv->(PID => $$)
            %= $kv->(Name => $0)
            %= $kv->(Executable => $^X)
            %= $kv->(Time => scalar localtime(time))
          </table>
        </div>
        <div class="tap">tap for more</div>
      </div>
    </div>
    <div id="footer">
      %= link_to 'http://mojolicio.us' => begin
        %= image '/mojo/logo-black.png', alt => 'Mojolicious logo'
      % end
    </div>
    %= javascript begin
      $('#more').click(function() {
        $('#infos').slideToggle('slow');
      });
      $('#infos').toggle();
    % end
  </body>
</html>