From b7311f230812038a8e2c144a4e740c6f5f6bccaa Mon Sep 17 00:00:00 2001 From: binaryDiv Date: Sun, 10 Nov 2019 23:37:31 +0100 Subject: [PATCH] #4: add base template; extend base template in views --- issues/templates/issues/detail.html | 18 +++++++++----- issues/templates/issues/index.html | 30 ++++++++++++++--------- issues/templates/issues/new.html | 32 ++++++++++++++---------- projects/templates/projects/index.html | 28 ++++++++++++--------- projects/templates/projects/view.html | 34 +++++++++++++++----------- templates/base.html | 12 +++++++++ templates/registration/login.html | 18 +++++++++----- 7 files changed, 110 insertions(+), 62 deletions(-) create mode 100644 templates/base.html diff --git a/issues/templates/issues/detail.html b/issues/templates/issues/detail.html index 42ea47c..e25b70d 100644 --- a/issues/templates/issues/detail.html +++ b/issues/templates/issues/detail.html @@ -1,6 +1,12 @@ -

#{{ issue.id }}: {{ issue.title }}

-

- Project: {{ issue.project }}
- Created: {{ issue.create_date }} -

-

{{ issue.text }}

\ No newline at end of file +{% extends "base.html" %} + +{% block title %}Issue: {{ issue.title }}{% endblock %} + +{% block content %} +

#{{ issue.id }}: {{ issue.title }}

+

+ Project: {{ issue.project }}
+ Created: {{ issue.create_date }} +

+

{{ issue.text }}

+{% endblock %} diff --git a/issues/templates/issues/index.html b/issues/templates/issues/index.html index c109698..9eb3e07 100644 --- a/issues/templates/issues/index.html +++ b/issues/templates/issues/index.html @@ -1,13 +1,19 @@ -{% if issue_list %} - -{% else %} -

No issues.

-{% endif %} +{% extends "base.html" %} -

Create new issue

+{% block title %}Issues{% endblock %} + +{% block content %} + {% if issue_list %} + + {% else %} +

No issues.

+ {% endif %} + +

Create new issue

+{% endblock %} diff --git a/issues/templates/issues/new.html b/issues/templates/issues/new.html index e9b9899..0e6d87c 100644 --- a/issues/templates/issues/new.html +++ b/issues/templates/issues/new.html @@ -1,15 +1,21 @@ -

Create new issue

+{% extends "base.html" %} -{% if error_message %}

{{ error_message }}

{% endif %} +{% block title %}Create issue{% endblock %} -
- {% csrf_token %} - - {{ form.as_table }} - - - -
- -
-
+{% block content %} +

Create new issue

+ + {% if error_message %}

{{ error_message }}

{% endif %} + +
+ {% csrf_token %} + + {{ form.as_table }} + + + +
+ +
+
+{% endblock %} diff --git a/projects/templates/projects/index.html b/projects/templates/projects/index.html index b64c0da..ee9bb64 100644 --- a/projects/templates/projects/index.html +++ b/projects/templates/projects/index.html @@ -1,11 +1,17 @@ -{% if project_list %} - -{% else %} -

No projects.

-{% endif %} \ No newline at end of file +{% extends "base.html" %} + +{% block title %}Projects{% endblock %} + +{% block content %} + {% if project_list %} + + {% else %} +

No projects.

+ {% endif %} +{% endblock %} diff --git a/projects/templates/projects/view.html b/projects/templates/projects/view.html index e38e16f..afae756 100644 --- a/projects/templates/projects/view.html +++ b/projects/templates/projects/view.html @@ -1,15 +1,21 @@ -

{{ project.project_key }} - {{ project.name }}

-

{{ project.description }}

+{% extends "base.html" %} -

Issues

-{% if issue_list %} - -{% else %} -

This project has no issues yet.

-{% endif %} \ No newline at end of file +{% block title %}Project: {{ project.name }}{% endblock %} + +{% block content %} +

{{ project.project_key }} - {{ project.name }}

+

{{ project.description }}

+ +

Issues

+ {% if issue_list %} + + {% else %} +

This project has no issues yet.

+ {% endif %} +{% endblock %} diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 0000000..c54107f --- /dev/null +++ b/templates/base.html @@ -0,0 +1,12 @@ + + + + {% block title %}Tofu{% endblock %} - Tofu + + + +

Tofu

+ + {% block content %}No content.{% endblock %} + + diff --git a/templates/registration/login.html b/templates/registration/login.html index 1325723..f3d53be 100644 --- a/templates/registration/login.html +++ b/templates/registration/login.html @@ -1,7 +1,13 @@ -

Login

+{% extends "base.html" %} -
- {% csrf_token %} - {{ form.as_p }} - -
+{% block title %}Login{% endblock %} + +{% block content %} +

Login

+ +
+ {% csrf_token %} + {{ form.as_p }} + +
+{% endblock %}