From 74cf3b2135661ae17b4e390c91182c673645cad7 Mon Sep 17 00:00:00 2001
From: James Taylor <user234683@users.noreply.github.com>
Date: Sun, 21 Jul 2019 22:50:57 -0700
Subject: Use variable to set title on base template instead of block

---
 youtube/templates/base.html                 | 2 +-
 youtube/templates/channel.html              | 2 +-
 youtube/templates/comments_page.html        | 4 +---
 youtube/templates/delete_comment.html       | 3 +--
 youtube/templates/error.html                | 3 +--
 youtube/templates/local_playlist.html       | 2 +-
 youtube/templates/local_playlists_list.html | 2 +-
 youtube/templates/login.html                | 2 +-
 youtube/templates/playlist.html             | 2 +-
 youtube/templates/post_comment.html         | 3 +--
 youtube/templates/search.html               | 2 +-
 youtube/templates/status.html               | 3 +--
 youtube/templates/watch.html                | 2 +-
 13 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/youtube/templates/base.html b/youtube/templates/base.html
index eafd369..3dda55d 100644
--- a/youtube/templates/base.html
+++ b/youtube/templates/base.html
@@ -2,7 +2,7 @@
 <html>
     <head>
         <meta charset="utf-8">
-        <title>{% block page_title %}{{ title }}{% endblock %}</title>
+        <title>{{ page_title }}</title>
         <link href="/youtube.com/static/shared.css" type="text/css" rel="stylesheet">
         <link href="/youtube.com/static/comments.css" type="text/css" rel="stylesheet">
         <link href="/youtube.com/static/favicon.ico" type="image/x-icon" rel="icon">
diff --git a/youtube/templates/channel.html b/youtube/templates/channel.html
index 8a3f279..734769d 100644
--- a/youtube/templates/channel.html
+++ b/youtube/templates/channel.html
@@ -1,5 +1,5 @@
+{% set page_title = channel_name + ' - Channel' %}
 {% extends "base.html" %}
-{% block page_title %}{{ channel_name + ' - Channel' }}{% endblock %}
 {% import "common_elements.html" as common_elements %}
 {% block style %}
     main{
diff --git a/youtube/templates/comments_page.html b/youtube/templates/comments_page.html
index c7947fa..68c8537 100644
--- a/youtube/templates/comments_page.html
+++ b/youtube/templates/comments_page.html
@@ -1,9 +1,7 @@
+{% set page_title = ('Replies' if comments_info['is_replies'] else 'Comments page ' + comments_info['page_number']) %}
 {% extends "base.html" %}
 {% import "comments.html" as comments %}
 
-{% block page_title %}{{ 'Replies' if comments_info['is_replies'] else 'Comments page ' + comments_info['page_number'] }}{% endblock %}
-
-
 {% block style %}
     main{
         display:grid;
diff --git a/youtube/templates/delete_comment.html b/youtube/templates/delete_comment.html
index 4797240..71555ee 100644
--- a/youtube/templates/delete_comment.html
+++ b/youtube/templates/delete_comment.html
@@ -1,7 +1,6 @@
+{% set page_title = 'Delete comment?' %}
 {% extends "base.html" %}
 
-{% block page_title %}Delete comment?{% endblock %}
-
 {% block style %}
     main{
         display: grid;
diff --git a/youtube/templates/error.html b/youtube/templates/error.html
index 1f33c44..e77c92c 100644
--- a/youtube/templates/error.html
+++ b/youtube/templates/error.html
@@ -1,7 +1,6 @@
+{% set page_title = 'Error' %}
 {% extends "base.html" %}
 
-{% block page_title %}Error{% endblock %}
-
 {% block main %}
     {{ error_message }}
 {% endblock %}
diff --git a/youtube/templates/local_playlist.html b/youtube/templates/local_playlist.html
index 27928df..a7564ca 100644
--- a/youtube/templates/local_playlist.html
+++ b/youtube/templates/local_playlist.html
@@ -1,5 +1,5 @@
+{% set page_title = playlist_name + ' - Local playlist' %}
 {% extends "base.html" %}
-{% block page_title %}{{ playlist_name + ' - Local playlist' }}{% endblock %}
 {% import "common_elements.html" as common_elements %}
 {% block style %}
     main{
diff --git a/youtube/templates/local_playlists_list.html b/youtube/templates/local_playlists_list.html
index 269c151..9b5f510 100644
--- a/youtube/templates/local_playlists_list.html
+++ b/youtube/templates/local_playlists_list.html
@@ -1,5 +1,5 @@
+{% set page_title = 'Local playlists' %}
 {% extends "base.html" %}
-{% block page_title %}Local playlists{% endblock %}
 
 {% block main %}
     <ul>
diff --git a/youtube/templates/login.html b/youtube/templates/login.html
index 49a5365..0f09a62 100644
--- a/youtube/templates/login.html
+++ b/youtube/templates/login.html
@@ -1,5 +1,5 @@
+{% set page_title = 'Login' %}
 {% extends "base.html" %}
-{% block page_title %}Login{% endblock %}
 
 {% block style %}
     main{
diff --git a/youtube/templates/playlist.html b/youtube/templates/playlist.html
index 09e382b..074b813 100644
--- a/youtube/templates/playlist.html
+++ b/youtube/templates/playlist.html
@@ -1,5 +1,5 @@
+{% set page_title = title + ' - Page ' + parameters_dictionary.get('page', '1') %}
 {% extends "base.html" %}
-{% block page_title %}{{ title + ' - Page ' + parameters_dictionary.get('page', '1') }}{% endblock %}
 {% import "common_elements.html" as common_elements %}
 {% block style %}
     main{
diff --git a/youtube/templates/post_comment.html b/youtube/templates/post_comment.html
index 98316ab..67c54f1 100644
--- a/youtube/templates/post_comment.html
+++ b/youtube/templates/post_comment.html
@@ -1,8 +1,7 @@
+{% set page_title = 'Post reply' if replying else 'Post comment' %}
 {% extends "base.html" %}
 {% import "comments.html" as comments %}
 
-{% block page_title %}{{ 'Post reply' if replying else 'Post comment' }}{% endblock %}
-
 {% block style %}
     main{
         display: grid;
diff --git a/youtube/templates/search.html b/youtube/templates/search.html
index 1086cfd..782a85e 100644
--- a/youtube/templates/search.html
+++ b/youtube/templates/search.html
@@ -1,6 +1,6 @@
 {% set search_box_value = query %}
+{% set page_title = query + ' - Search' %}
 {% extends "base.html" %}
-{% block page_title %}{{ query + ' - Search' }}{% endblock %}
 {% import "common_elements.html" as common_elements %}
 {% block style %}
             main{
diff --git a/youtube/templates/status.html b/youtube/templates/status.html
index 1e18b5c..901aa5b 100644
--- a/youtube/templates/status.html
+++ b/youtube/templates/status.html
@@ -1,7 +1,6 @@
+{% set page_title = (title if (title is defined) else 'Status') %}
 {% extends "base.html" %}
 
-{% block page_title %}{{ title if (title is defined) else 'Status'}}{% endblock %}
-
 {% block main %}
     {{ message }}
 {% endblock %}
diff --git a/youtube/templates/watch.html b/youtube/templates/watch.html
index d61997f..82c1a97 100644
--- a/youtube/templates/watch.html
+++ b/youtube/templates/watch.html
@@ -1,7 +1,7 @@
+{% set page_title = title %}
 {% extends "base.html" %}
 {% import "common_elements.html" as common_elements %}
 {% import "comments.html" as comments %}
-{% block page_title %}{{ title }}{% endblock %}
 {% block style %}
             main{
                 display:grid;
-- 
cgit v1.2.3