diff options
Diffstat (limited to 'templates')
-rw-r--r-- | templates/index.html | 115 | ||||
-rw-r--r-- | templates/login.html | 34 | ||||
-rw-r--r-- | templates/register.html | 42 |
3 files changed, 191 insertions, 0 deletions
diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..15548c5 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,115 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <title>Toot Scheduler</title> + <style> + body { + font-family: Arial, sans-serif; + line-height: 1.6; + margin: 20px; + padding: 0; + background-color: #f4f4f9; + color: #333; + } + h1, h2 { + color: #0056b3; + } + form { + margin-bottom: 20px; + } + ul { + list-style: none; + padding: 0; + } + li { + background: #fff; + margin: 10px 0; + padding: 10px; + border: 1px solid #ddd; + border-radius: 5px; + } + button { + background: #0056b3; + color: #fff; + border: none; + padding: 5px 10px; + border-radius: 3px; + cursor: pointer; + } + button:hover { + background: #003d80; + } + label { + display: block; + margin-top: 10px; + } + input, select { + width: 100%; + padding: 8px; + margin-top: 5px; + margin-bottom: 15px; + border: 1px solid #ddd; + border-radius: 5px; + } + </style> +</head> +<body> + <h1>Toot Scheduler</h1> + <h2>Welcome, {{ current_user.username }}</h2> + + <!-- Form to add a new toot --> + <form action="{{ url_for('add_toot') }}" method="post"> + <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"> + <label for="message">Message:</label> + <input type="text" id="message" name="message" required> + <label for="toot_time">Time:</label> + <input type="time" id="toot_time" name="toot_time" required> + <label for="day">Day:</label> + <select id="day" name="day" required> + <option value="monday">Monday</option> + <option value="tuesday">Tuesday</option> + <option value="wednesday">Wednesday</option> + <option value="thursday">Thursday</option> + <option value="friday">Friday</option> + <option value="saturday">Saturday</option> + <option value="sunday">Sunday</option> + <option value="everyday">Everyday</option> + </select> + <button type="submit">Add Toot</button> + </form> + + <!-- List of scheduled toots --> + <h2>Scheduled Toots</h2> + <ul> + {% for toot in toots %} + <li> + <strong>{{ toot.message }}</strong> at {{ toot.toot_time }} on {{ toot.day }} + {% if toot.suspended %} + <em>(Suspended)</em> + <form action="{{ url_for('resume_toot', toot_id=toot.id) }}" method="post" style="display:inline;"> + <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"> + <button type="submit">Resume</button> + </form> + {% else %} + <form action="{{ url_for('suspend_toot', toot_id=toot.id) }}" method="post" style="display:inline;"> + <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"> + <button type="submit">Suspend</button> + </form> + {% endif %} + <form action="{{ url_for('delete_toot', toot_id=toot.id) }}" method="post" style="display:inline;"> + <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"> + <button type="submit">Delete</button> + </form> + </li> + {% endfor %} + </ul> + + <!-- Logout form --> + <form action="{{ url_for('logout') }}" method="post"> + <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"> + <button type="submit">Logout</button> + </form> +</body> +</html> diff --git a/templates/login.html b/templates/login.html new file mode 100644 index 0000000..9973dfd --- /dev/null +++ b/templates/login.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <title>Login</title> +</head> +<body> + <h1>Login</h1> + <form action="{{ url_for('login') }}" method="post"> + {{ form.csrf_token }} + <div> + <label for="username">Username:</label> + <input type="text" id="username" name="username" value="{{ form.username.data }}" required> + </div> + <div> + <label for="password">Password:</label> + <input type="password" id="password" name="password" required> + </div> + <div> + <button type="submit">Login</button> + </div> + </form> + {% with messages = get_flashed_messages() %} + {% if messages %} + <ul> + {% for message in messages %} + <li>{{ message }}</li> + {% endfor %} + </ul> + {% endif %} + {% endwith %} +</body> +</html> diff --git a/templates/register.html b/templates/register.html new file mode 100644 index 0000000..ddf950f --- /dev/null +++ b/templates/register.html @@ -0,0 +1,42 @@ +<!doctype html> +<html> +<head> + <title>Register</title> +</head> +<body> + <h1>Register</h1> + <form method="POST" action="{{ url_for('register') }}"> + {{ form.hidden_tag() }} + <p> + {{ form.username.label }}<br> + {{ form.username(size=32) }}<br> + {% for error in form.username.errors %} + <span style="color: red;">[{{ error }}]</span> + {% endfor %} + </p> + <p> + {{ form.email.label }}<br> + {{ form.email(size=32) }}<br> + {% for error in form.email.errors %} + <span style="color: red;">[{{ error }}]</span> + {% endfor %} + </p> + <p> + {{ form.password.label }}<br> + {{ form.password(size=32) }}<br> + {% for error in form.password.errors %} + <span style="color: red;">[{{ error }}]</span> + {% endfor %} + </p> + <p> + {{ form.password2.label }}<br> + {{ form.password2(size=32) }}<br> + {% for error in form.password2.errors %} + <span style="color: red;">[{{ error }}]</span> + {% endfor %} + </p> + <p>{{ form.submit() }}</p> + </form> + <a href="{{ url_for('login') }}">Login</a> +</body> +</html> |