Adding views and schema.
This commit is contained in:
43
templates/cards.html
Normal file
43
templates/cards.html
Normal file
@@ -0,0 +1,43 @@
|
||||
{% extends "layout.html" %}
|
||||
{% block body %}
|
||||
{% if session.logged_in %}
|
||||
<form action="{{ url_for('add_card') }}" method=post class=add-card>
|
||||
<dl>
|
||||
<dt>
|
||||
<label for="type">Type:</label>
|
||||
</dt>
|
||||
<dd>
|
||||
<select name="type">
|
||||
<option value="1">General</option>
|
||||
<option value="2">Code</option>
|
||||
</select>
|
||||
</dd>
|
||||
<dt>
|
||||
<label for="front">Front:</label>
|
||||
</dt>
|
||||
<dd><input type="text" size=30 name="front" /></dd>
|
||||
<dt>
|
||||
<label for="back">Back:</label>
|
||||
</dt>
|
||||
<dd><textarea name="back" rows="15" cols="60"></textarea></dd>
|
||||
<dd><input type="submit" value="Save" /></dd>
|
||||
</dl>
|
||||
</form>
|
||||
{% endif %}
|
||||
<hr />
|
||||
<ul class=cards>
|
||||
{% for card in cards %}
|
||||
<li>
|
||||
<h3>{{ card.front }}</h3>
|
||||
{% if card.type == 1 %}
|
||||
{{ card.back|replace("\n", "<br />") }}
|
||||
{% else %}
|
||||
<pre><code>{{ card.back|safe }}</code></pre>
|
||||
{% endif %}
|
||||
<hr>
|
||||
</li>
|
||||
{% else %}
|
||||
<li><em>Unbelievable. No cards here so far.</em>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock %}
|
||||
6
templates/index.html
Normal file
6
templates/index.html
Normal file
@@ -0,0 +1,6 @@
|
||||
{% extends "layout.html" %}
|
||||
{% block body %}
|
||||
<p>
|
||||
Well, hello there.
|
||||
</p>
|
||||
{% endblock %}
|
||||
20
templates/layout.html
Normal file
20
templates/layout.html
Normal file
@@ -0,0 +1,20 @@
|
||||
<!doctype html>
|
||||
<title>CS Flash Cards</title>
|
||||
<link rel=stylesheet type=text/css href="{{ url_for('static', filename='style.css') }}">
|
||||
<div class=page>
|
||||
<h1>CS Flash Cards</h1>
|
||||
<div class=metanav>
|
||||
{% if not session.logged_in %}
|
||||
<a href="{{ url_for('login') }}">log in</a>
|
||||
{% else %}
|
||||
<a href="{{ url_for('cards') }}">cards</a>
|
||||
|
||||
|
||||
<a href="{{ url_for('logout') }}">log out</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% for message in get_flashed_messages() %}
|
||||
<div class=flash>{{ message }}</div>
|
||||
{% endfor %}
|
||||
{% block body %}{% endblock %}
|
||||
</div>
|
||||
14
templates/login.html
Normal file
14
templates/login.html
Normal file
@@ -0,0 +1,14 @@
|
||||
{% extends "layout.html" %}
|
||||
{% block body %}
|
||||
<h2>Login</h2>
|
||||
{% if error %}<p class=error><strong>Error:</strong> {{ error }}{% endif %}
|
||||
<form action="{{ url_for('login') }}" method=post>
|
||||
<dl>
|
||||
<dt>Username:
|
||||
<dd><input type=text name=username>
|
||||
<dt>Password:
|
||||
<dd><input type=password name=password>
|
||||
<dd><input type=submit value="Log in">
|
||||
</dl>
|
||||
</form>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user