From 6a49a8c1fc4489784da44482f0aad9ab491ef0a0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9ric=20Perrin?= Date: Fri, 30 Sep 2016 22:22:59 +0000 Subject: [PATCH] Hide by default details about the quotes --- quotes/static/quotes/quotes.js | 9 +++++++ quotes/static/quotes/style.css | 10 +++++++- quotes/templates/quotes/base.html | 1 + quotes/templates/quotes/display.html | 37 ++++++++++++++++++--------- quotes/templates/quotes/onequote.html | 2 +- 5 files changed, 45 insertions(+), 14 deletions(-) create mode 100644 quotes/static/quotes/quotes.js diff --git a/quotes/static/quotes/quotes.js b/quotes/static/quotes/quotes.js new file mode 100644 index 0000000..ea4ba8a --- /dev/null +++ b/quotes/static/quotes/quotes.js @@ -0,0 +1,9 @@ +function showDetails(id) { + document.getElementById(id).style.display = 'block'; + document.getElementById(id + '_button').style.display = 'none'; +} + +function hideDetails(id) { + document.getElementById(id).style.display = 'none'; + document.getElementById(id + '_button').style.display = 'block'; +} diff --git a/quotes/static/quotes/style.css b/quotes/static/quotes/style.css index db54671..a32d644 100644 --- a/quotes/static/quotes/style.css +++ b/quotes/static/quotes/style.css @@ -1,7 +1,10 @@ -a { +body { color: black; + background-color: white; } +a { color: black; } + a:hover { text-decoration: none; } @@ -25,3 +28,8 @@ a:hover { font-size: 0.8em; text-align: right; } + +.hidden_details { + /* displayed through Javascript */ + display: none; +} diff --git a/quotes/templates/quotes/base.html b/quotes/templates/quotes/base.html index df22ab2..69b3d21 100644 --- a/quotes/templates/quotes/base.html +++ b/quotes/templates/quotes/base.html @@ -2,6 +2,7 @@ {% load staticfiles %} + {% block title %}{% endblock %} diff --git a/quotes/templates/quotes/display.html b/quotes/templates/quotes/display.html index 1369e2c..2e09b35 100644 --- a/quotes/templates/quotes/display.html +++ b/quotes/templates/quotes/display.html @@ -3,23 +3,36 @@ {{ quote.text }}

-

- — - {{ quote.author.name }} - -

+
+

+ + Show details

+
+

+ Hide details

+

+ — + + {{ quote.author.name }} + + +

- {% if quote.tags.all %} -

- Tags: - {% for tag in quote.tags.all %} + {% if quote.tags.all %} +

+ Tags: + {% for tag in quote.tags.all %} {{ tag.tag }} - {% endfor %} -

- {% endif %} + {% endfor %} +

+ {% endif %} +
+
diff --git a/quotes/templates/quotes/onequote.html b/quotes/templates/quotes/onequote.html index e814277..25f7971 100644 --- a/quotes/templates/quotes/onequote.html +++ b/quotes/templates/quotes/onequote.html @@ -1,6 +1,6 @@ {% extends 'quotes/base.html' %} -{% block title %}A quote by {{quote.author.name}}...{% endblock %} +{% block title %}One quote...{% endblock %} {% block body %} -- 2.43.0