init
This commit is contained in:
commit
5309e0593b
22 changed files with 722 additions and 0 deletions
blog/templates
10
blog/templates/entries/edit.html
Normal file
10
blog/templates/entries/edit.html
Normal file
|
@ -0,0 +1,10 @@
|
|||
{% extends "layout.html" %}
|
||||
{% block body %}
|
||||
<form action="{{ url_for('update_entry', id=entry.id) }}" method="post">
|
||||
<label for="title">タイトル</label>
|
||||
<input type="text" id="title" name=title value={{ entry.title }}>
|
||||
<label for="text">本文</label>
|
||||
<textarea id="text" name=text rows="3">{{ entry.text | safe }}</textarea>
|
||||
<button type="submit">更新</button>
|
||||
</form>
|
||||
{% endblock %}
|
13
blog/templates/entries/index.html
Normal file
13
blog/templates/entries/index.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
{% extends "layout.html" %}
|
||||
{% block body %}
|
||||
<ul>
|
||||
{% for entry in entries %}
|
||||
<li>
|
||||
<h5>{{ entry.title }}</h5>
|
||||
<a href="{{ url_for('show_entry', id=entry.id) }}">続きを読む</a>
|
||||
</li>
|
||||
{% else %}
|
||||
投稿がありません
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock %}
|
10
blog/templates/entries/new.html
Normal file
10
blog/templates/entries/new.html
Normal file
|
@ -0,0 +1,10 @@
|
|||
{% extends "layout.html" %}
|
||||
{% block body %}
|
||||
<form action="{{ url_for('add_entry') }}" method="post">
|
||||
<label for="title">タイトル</label>
|
||||
<input type="text" id="title" name="title">
|
||||
<label for="text">本文</label>
|
||||
<textarea id="text" name="text" rows="3"></textarea>
|
||||
<button type="submit">作成</button>
|
||||
</form>
|
||||
{% endblock %}
|
14
blog/templates/entries/show.html
Normal file
14
blog/templates/entries/show.html
Normal file
|
@ -0,0 +1,14 @@
|
|||
{% extends "layout.html" %}
|
||||
{% block body %}
|
||||
<h2>{{ entry.title }}</h2>
|
||||
<br>
|
||||
{{ entry.text }}
|
||||
<br><br>
|
||||
投稿日時 {{ entry.created_at }}
|
||||
<form action="{{ url_for('edit_entry', id=entry.id) }}" method="GET">
|
||||
<button type="submit">編集</button>
|
||||
</form>
|
||||
<form action="{{ url_for('delete_entry', id=entry.id) }}" method="POST">
|
||||
<button type="submit">削除</button>
|
||||
</form>
|
||||
{% endblock %}
|
30
blog/templates/layout.html
Normal file
30
blog/templates/layout.html
Normal file
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Flask Blog</title>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css">
|
||||
</head>
|
||||
<body class="container">
|
||||
<header>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="/">Flask Blog</a></li>
|
||||
</ul>
|
||||
<ul>
|
||||
{% if not session.logged_in %}
|
||||
<li><a href="{{ url_for('login')}}">ログイン</a></li>
|
||||
{% else %}
|
||||
<li><a href="{{ url_for('new_entry')}}">新規投稿</a></li>
|
||||
<li><a href="{{ url_for('logout')}}">ログアウト</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
{% for message in get_flashed_messages() %}
|
||||
<p>{{ message }}</p>
|
||||
{% endfor %}
|
||||
<main>
|
||||
{% block body %}{% endblock %}
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
10
blog/templates/login.html
Normal file
10
blog/templates/login.html
Normal file
|
@ -0,0 +1,10 @@
|
|||
{% extends "layout.html" %}
|
||||
{% block body %}
|
||||
<form action="{{ url_for('login')}}" method="post">
|
||||
<label for="username">ユーザ名</label>
|
||||
<input type="text" id="username" name="username">
|
||||
<label for="password">パスワード</label>
|
||||
<input type="password" id="password" name="password">
|
||||
<button type="submit">ログイン</button>
|
||||
</form>
|
||||
{% endblock %}
|
Loading…
Add table
Add a link
Reference in a new issue