Skip to content

Commit 54802fd

Browse files
committed
refactor template
1 parent 4406d3e commit 54802fd

File tree

7 files changed

+59
-52
lines changed

7 files changed

+59
-52
lines changed

note_client/src/common.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'bootstrap/dist/css/bootstrap.css'
22
import 'bootstrap-vue/dist/bootstrap-vue.css'
33
import './style/font-awesome-config.scss'
4+
import './style/navigation.scss'
45
import Vue from 'vue'
56
import BootstrapVue from 'bootstrap-vue'
67

note_client/src/components/Note.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
type="button"
3636
class="btn btn-success col-md-12"
3737
@click="create"
38-
:disabled="controller.selectedPage && controller.selectedPage.taint"
38+
:disabled="!controller.loaded || controller.selectedPage && controller.selectedPage.taint"
3939
>新規</button>
4040
</div>
4141
<b-modal

note_client/src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'bootstrap/dist/css/bootstrap.css'
22
import 'bootstrap-vue/dist/bootstrap-vue.css'
33
import './style/font-awesome-config.scss'
4+
import './style/navigation.scss'
45
import Vue from 'vue'
56
import BootstrapVue from 'bootstrap-vue'
67

note_client/src/style/navigation.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#navigation {
2+
min-height: 54px;
3+
}

note_server/templates/base.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<html>
2+
<head>
3+
<meta charset="utf-8">
4+
<title>{% block title %}{% endblock %}</title>
5+
</head>
6+
<body>
7+
<nav class="navbar navbar-dark bg-dark" id="navigation">
8+
<a class="navbar-brand" href="{% url 'index' %}"><i class="fa fa-book"> ノート</i></a>
9+
{% if user.is_authenticated %}
10+
<div class="my-2 my-lg-0">
11+
{% if user.is_superuser %}
12+
<a class="btn btn-outline-success my-2 my-sm-0" href="{% url 'admin:index' %}">管理画面</a>
13+
{% endif %}
14+
<a class="btn btn-outline-success my-2 my-sm-0" href="{% url 'logout' %}">ログアウト</a>
15+
</div>
16+
{% endif %}
17+
</nav>
18+
{% block content %}{% endblock %}
19+
</body>
20+
</html>

note_server/templates/index.html

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,17 @@
1+
{% extends 'base.html' %}
12
{% load static %}
2-
<html>
3-
<head>
4-
<meta charset="utf-8">
5-
<title>ノート</title>
6-
</head>
7-
<body>
8-
<nav class="navbar navbar-dark bg-dark">
9-
<a class="navbar-brand" href="{% url 'index' %}"><i class="fa fa-book"> ノート</i></a>
10-
<div class="my-2 my-lg-0">
11-
{% if user.is_superuser %}
12-
<a class="btn btn-outline-success my-2 my-sm-0" href="{% url 'admin:index' %}">管理画面</a>
13-
{% endif %}
14-
<a class="btn btn-outline-success my-2 my-sm-0" href="{% url 'logout' %}">ログアウト</a>
15-
</div>
16-
</nav>
173

18-
<div class="container-fluid">
19-
<div class="row">
20-
{% verbatim %}
21-
<div id="app">
22-
<note :controller="controller"></note>
23-
</div>
24-
{% endverbatim %}
4+
{% block title %}ノート{% endblock %}
5+
6+
{% block content %}
7+
<div class="container-fluid">
8+
<div class="row">
9+
{% verbatim %}
10+
<div id="app">
11+
<note :controller="controller"></note>
2512
</div>
13+
{% endverbatim %}
2614
</div>
15+
</div>
2716
<script src="{% static 'client/index.js' %}"></script>
28-
</body>
29-
</html>
17+
{% endblock %}

note_server/templates/login.html

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,24 @@
1+
{% extends 'base.html' %}
12
{% load static %}
2-
<html>
3-
<head>
4-
<meta charset="utf-8">
5-
<title>ログイン</title>
6-
</head>
7-
<body>
8-
<nav class="navbar navbar-dark bg-dark">
9-
<a class="navbar-brand" href="{% url 'index' %}">ノート</a>
10-
</nav>
113

12-
<div class="container">
13-
<div class="row">
14-
<form action="" method="post" class="col-12 mt-2">
15-
{% csrf_token %}
16-
<div class="form-group">
17-
<label for="{{ form.username.id_for_label }}">ユーザー名</label>
18-
<input type="text" name="{{ form.username.html_name }}" id="{{ form.username.id_for_label }}" class="form-control" placeholder="User name" required autofocus>
19-
</div>
20-
<div class="form-group">
21-
<label for="{{ form.password.id_for_label }}">Password</label>
22-
<input type="password" name="{{ form.password.html_name }}" id="{{ form.password.id_for_label }}" class="form-control" placeholder="Password" required>
23-
</div>
24-
<button type="submit">ログイン</button>
25-
</form>
26-
</div>
4+
{% block title %}ログイン{% endblock %}
5+
6+
{% block content %}
7+
<div class="container">
8+
<div class="row">
9+
<form action="" method="post" class="col-12 mt-2">
10+
{% csrf_token %}
11+
<div class="form-group">
12+
<label for="{{ form.username.id_for_label }}">ユーザー名</label>
13+
<input type="text" name="{{ form.username.html_name }}" id="{{ form.username.id_for_label }}" class="form-control" placeholder="User name" required autofocus>
14+
</div>
15+
<div class="form-group">
16+
<label for="{{ form.password.id_for_label }}">Password</label>
17+
<input type="password" name="{{ form.password.html_name }}" id="{{ form.password.id_for_label }}" class="form-control" placeholder="Password" required>
18+
</div>
19+
<button class="btn btn-success col-12" type="submit">ログイン</button>
20+
</form>
2721
</div>
28-
<script src="{% static 'client/common.js' %}"></script>
29-
</body>
30-
</html>
22+
</div>
23+
<script src="{% static 'client/common.js' %}"></script>
24+
{% endblock %}

0 commit comments

Comments
 (0)