Source

talks / flask / solutions / 8-top10 / templates / index.html

Full commit
<!DOCTYPE html>
<html>
    <head>
        <title>Shorty - URL Shortener</title>
        <link rel="stylesheet" 
              href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css"
        />
        <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}" />

    </head>
    <body>
        <div class="container">
            <div class="page-header"><h3>Shorty - URL Shortener</h3></div>
            <form action="/" method="POST">
                <div class="input-group">
                    <input type="text" class="form-control" name="url"
                    placeholder="Paste URL here">
                    <span class="input-group-btn">
                        <button class="btn btn-default" type="button" id="add">
                            +
                        </button>
                    </span>
                </div>
            </form>
            {% if error %}
                <div class="alert alert-danger">ERROR: {{ error }}</div>
            {% endif %}
            {% if short %}
                <div class="alert alert-success">
                    URL shortened to 
                    <a class="alert-link" href="/u/{{ short }}">
                        /u/{{ short }}
                    </a>
                </div>
            {% endif %}
            <div class="row">
                <h4>Top Links</h4>
                    <img id="loading" 
                         src="{{ url_for('static', filename='loading.gif') }}" 
                    />
                    <ul class="list-group" id="top10">
                    </ul>
            </div>
            <hr />
            We shortened {{ link_count }} URLs so far.
        </div>
    </body>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js">
    </script>
    <script src="{{ url_for('static', filename='index.js') }}"></script>

</html>