{% extends "layout.html" %}
{% block body %}
  <h2>Overview</h2>
  {% if g.user %}
    <p>
      Hello {{ g.user.screen_name }}!  Wanna tweet something?
    </p>
    <form action="{{ url_for('tweet') }}"  method=post>
      <p>
        <input type=text name=tweet size=40>
        <input type=submit value="Tweet!">
      </p>
    </form>
    {% if tweets %}
    <h3>Your Timeline</h3>
    <ul>
    {% for tweet in tweets %}
      <li><a href="http://twitter.com/{{ tweet.user.screen_name
        }}">{{ tweet.user.screen_name }}</a>: {{ tweet.text|urlize }}</li>
    {% endfor %}
    </ul>
    {% endif %}
  {% else %}
    <p>
      Sign in to view your public timeline and to tweet from this
      example application.
    </p>
    <p>
      <a href="{{ url_for('login') }}"><img src="{{
        url_for('static', filename='sign-in.png') }}" alt="sign in"></a>
    </p>
  {% endif %}
{% endblock %}
