Commit 46ac41bb authored by Markus Mößler's avatar Markus Mößler
Browse files

added forms and templates of original tornado github blog example

parent b2ca8fcd
Loading
Loading
Loading
Loading
+153 −0
Original line number Diff line number Diff line
/*
 * Copyright 2009 Facebook
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may
 * not use this file except in compliance with the License. You may obtain
 * a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */

body {
  background: white;
  color: black;
  margin: 15px;
  margin-top: 0;
}

body,
input,
textarea {
  font-family: Georgia, serif;
  font-size: 12pt;
}

table {
  border-collapse: collapse;
  border: 0;
}

td {
  border: 0;
  padding: 0;
}

h1,
h2,
h3,
h4 {
  font-family: "Helvetica Nue", Helvetica, Arial, sans-serif;
  margin: 0;
}

h1 {
  font-size: 20pt;
}

pre,
code {
  font-family: monospace;
  color: #060;
}

pre {
  margin-left: 1em;
  padding-left: 1em;
  border-left: 1px solid silver;
  line-height: 14pt;
}

a,
a code {
  color: #00c;
}

#body {
  max-width: 800px;
  margin: auto;
}

#header {
  background-color: #3b5998;
  padding: 5px;
  padding-left: 10px;
  padding-right: 10px;
  margin-bottom: 1em;
}

#header,
#header a {
  color: white;
}

#header h1 a {
  text-decoration: none;
}

#footer,
#content {
  margin-left: 10px;
  margin-right: 10px;
}

#footer {
  margin-top: 3em;
}

.entry h1 a {
  color: black;
  text-decoration: none;
}

.entry {
  margin-bottom: 2em;
}

.entry .date {
  margin-top: 3px;
}

.entry p {
  margin: 0;
  margin-bottom: 1em;
}

.entry .body {
  margin-top: 1em;
  line-height: 16pt;
}

.compose td {
  vertical-align: middle;
  padding-bottom: 5px;
}

.compose td.field {
  padding-right: 10px;
}

.compose .title,
.compose .submit {
  font-family: "Helvetica Nue", Helvetica, Arial, sans-serif;
  font-weight: bold;
}

.compose .title {
  font-size: 20pt;
}

.compose .title,
.compose .markdown {
  width: 100%;
}

.compose .markdown {
  height: 500px;
  line-height: 16pt;
}
+31 −0
Original line number Diff line number Diff line
{% extends "base.html" %}

{% block head %}
  <style type="text/css">
    ul.archive {
      list-style-type: none;
      margin: 0;
      padding: 0;
    }

    ul.archive li {
      margin-bottom: 1em;
    }

    ul.archive .title {
      font-family: "Helvetica Nue", Helvetica, Arial, sans-serif;
      font-size: 14pt;
    }
  </style>
{% end %}

{% block body %}
  <ul class="archive">
    {% for entry in entries %}
      <li>
        <div class="title"><a href="/entry/{{ entry.slug }}">{{ entry.title }}</a></div>
        <div class="date">{{ locale.format_date(entry.published, full_format=True, shorter=True) }}</div>
      </li>
    {% end %}
  </ul>
{% end %}
+27 −0
Original line number Diff line number Diff line
<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>{{ escape(handler.settings["blog_title"]) }}</title>
    <link rel="stylesheet" href="{{ static_url("blog.css") }}" type="text/css">
    <link rel="alternate" href="/feed" type="application/atom+xml" title="{{ escape(handler.settings["blog_title"]) }}">
    {% block head %}{% end %}
  </head>
  <body>
    <div id="body">
      <div id="header">
        <div style="float:right">
          {% if current_user %}
            <a href="/compose">{{ _("New post") }}</a> -
            <a href="/auth/logout?next={{ url_escape(request.uri) }}">{{ _("Sign out") }}</a>
          {% else %}
            {% raw _('<a href="%(url)s">Sign in</a> to compose/edit') % {"url": "/auth/login?next=" + url_escape(request.uri)} %}
          {% end %}
        </div>
        <h1><a href="/">{{ escape(handler.settings["blog_title"]) }}</a></h1>
      </div>
      <div id="content">{% block body %}{% end %}</div>
    </div>
    {% block bottom %}{% end %}
  </body>
</html>
+41 −0
Original line number Diff line number Diff line
{% extends "base.html" %}

{% block body %}
  <form action="{{ request.path }}" method="post" class="compose">
    <div style="margin-bottom:5px"><input name="title" type="text" class="title" value="{{ entry.title if entry else "" }}"/></div>
    <div style="margin-bottom:5px"><textarea name="markdown" rows="30" cols="40" class="markdown">{{ entry.markdown if entry else "" }}</textarea></div>
    <div>
      <div style="float:right"><a href="http://daringfireball.net/projects/markdown/syntax">{{ _("Syntax documentation") }}</a></div>
      <input type="submit" value="{{ _("Save changes") if entry else _("Publish post") }}" class="submit"/>
      &nbsp;<a href="{{ "/entry/" + entry.slug if entry else "/" }}">{{ _("Cancel") }}</a>
    </div>
    {% if entry %}
      <input type="hidden" name="id" value="{{ entry.id }}"/>
    {% end %}
    {% module xsrf_form_html() %}
  </form>
{% end %}

{% block bottom %}
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
  <script type="text/javascript">
  //<![CDATA[

    $(function() {
      $("input[name=title]").select();
      $("form.compose").submit(function() {
          var required = ["title", "markdown"];
          var form = $(this).get(0);
          for (var i = 0; i < required.length; i++) {
              if (!form[required[i]].value) {
                  $(form[required[i]]).select();
                  return false;
              }
          }
          return true;
      });
    });

  //]]>
  </script>
{% end %}
+11 −0
Original line number Diff line number Diff line
{% extends "base.html" %}

{% block body %}
<form action="/auth/create" method="POST">
  Email: <input name="email" type="text"><br>
  Name: <input name="name" type="text"><br>
  Password: <input name="password" type="password"><br>
  {% module xsrf_form_html() %}
  <input type="submit">
</form>
{% end %}
Loading