From 7e79a0b71259c08177af93d30e26d7a262a41c7c Mon Sep 17 00:00:00 2001 From: spikecodes <19519553+spikecodes@users.noreply.github.com> Date: Sun, 22 Nov 2020 16:29:05 -0800 Subject: [PATCH] Create Base Template --- static/style.css | 26 ++++++++ templates/base.html | 34 +++++++++++ templates/error.html | 24 ++------ templates/popular.html | 104 +++++++++++++------------------ templates/post.html | 125 +++++++++++++++++-------------------- templates/subreddit.html | 129 ++++++++++++++++++--------------------- templates/user.html | 114 ++++++++++++++++------------------ 7 files changed, 276 insertions(+), 280 deletions(-) create mode 100644 templates/base.html diff --git a/static/style.css b/static/style.css index 96e48dd..bbf2444 100644 --- a/static/style.css +++ b/static/style.css @@ -22,6 +22,10 @@ header { font-size: 20px; } +#lib, #github { + color: white; +} + main { max-width: 750px; margin: 0 auto; @@ -83,6 +87,10 @@ span { padding: 20px; } +#stats { + margin-top: 10px; +} + /* User */ .user { @@ -124,6 +132,11 @@ span { cursor: pointer; } +#sort > div.selected { + background: aqua; + color: black; +} + #sort > div:hover { background: #222; } @@ -136,6 +149,15 @@ span { display: flex; } +.post.highlighted { + border: 2px solid #555; + background: #222; +} + +.post.highlighted > .post_left { + background: #333; +} + .post:hover { background: #222; } @@ -158,6 +180,10 @@ span { padding: 5px; } +.post_right > p > span, .comment_right > p > span { + float: right; +} + .post_title { font-size: 20px; } diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 0000000..7e44e79 --- /dev/null +++ b/templates/base.html @@ -0,0 +1,34 @@ + + + + {% block head %} + {% block title %}{% endblock %} + + + + {% block sortstyle %} + + {% endblock %} + {% endblock %} + + + {% block body %} + {% block header %} +
+ libreddit. + GITHUB +
+ {% endblock %} + +
+ {% block content %} + {% endblock %} +
+ {% endblock %} + + \ No newline at end of file diff --git a/templates/error.html b/templates/error.html index 7c63d70..cf86271 100644 --- a/templates/error.html +++ b/templates/error.html @@ -1,18 +1,6 @@ - - - - Error loading page. - - - - - -
- libreddit. - GITHUB -
-
-

{{ message }}

-
- - \ No newline at end of file +{% extends "base.html" %} +{% block title %}Error: {{ message }}{% endblock %} +{% block sortstyle %}{% endblock %} +{% block content %} +

{{ message }}

+{% endblock %} \ No newline at end of file diff --git a/templates/popular.html b/templates/popular.html index 57bc8d7..05c319b 100644 --- a/templates/popular.html +++ b/templates/popular.html @@ -1,62 +1,44 @@ - - - Libreddit - - - - - - -
- libreddit. - GITHUB -
-
-
- - - -
- {% for post in posts %} -
-
- -

{{ post.score }}

- -
-
-

- r/{{ post.community }} - • - Posted by - - {{ post.time }} -

-

- {% if post.flair.0 != "" %} - {{ post.flair.0 }} - {% endif %} - {{ post.title }} -

-
- -

- {% endfor %} +{% extends "base.html" %} +{% block title %}Libreddit{% endblock %} +{% block content %} +
+ + + +
+ {% for post in posts %} +
+
+ +

{{ post.score }}

+ +
+
+

+ r/{{ post.community }} + • + Posted by + + {{ post.time }} +

+

+ {% if post.flair.0 != "" %} + {{ post.flair.0 }} + {% endif %} + {{ post.title }} +

+
+ +

+ {% endfor %} - -
- - \ No newline at end of file + +{% endblock %} \ No newline at end of file diff --git a/templates/post.html b/templates/post.html index 06398bb..36322ac 100644 --- a/templates/post.html +++ b/templates/post.html @@ -1,70 +1,55 @@ - - - {{ post.title }} - r/{{ post.community }} - - - - - - - -
- libreddit. - GITHUB -
-
-
-
- -

{{ post.score }}

- -
-
-

- r/{{ post.community }} - • - Posted by - - {{ post.time }} -

-

- {{ post.title }} - {% if post.flair.0 != "" %} - {{ post.flair.0 }} - {% endif %} -

- {{ post.media }} -

{{ post.body }}

-
-
-
- - - - - -
- {% for comment in comments %} -
-
- -

{{ comment.score }}

- -
-
-

- Posted by u/{{ comment.author }} - {{ comment.time }} -

-

{{ comment.body }}

-
-

- {% endfor %} -
- - \ No newline at end of file +{% extends "base.html" %} +{% block title %}{{ post.title }} - r/{{ post.community }}{% endblock %} +{% block head %} + {% call super() %} + +{% endblock %} +{% block content %} +
+
+ +

{{ post.score }}

+ +
+
+

+ r/{{ post.community }} + • + Posted by + + {{ post.time }} +

+

+ {{ post.title }} + {% if post.flair.0 != "" %} + {{ post.flair.0 }} + {% endif %} +

+ {{ post.media }} +

{{ post.body }}

+
+
+
+
Best
+
Top
+
New
+
Controversial
+
Old
+
+ {% for comment in comments %} +
+
+ +

{{ comment.score }}

+ +
+
+

+ Posted by u/{{ comment.author }} + {{ comment.time }} +

+

{{ comment.body }}

+
+

+ {% endfor %} +{% endblock %} \ No newline at end of file diff --git a/templates/subreddit.html b/templates/subreddit.html index a109bd5..d86c8ee 100644 --- a/templates/subreddit.html +++ b/templates/subreddit.html @@ -1,73 +1,64 @@ - - - r/{{ sub.name }}: {{ sub.description }} - - - - - - -
- libreddit. - GITHUB -
-
-
-
- {{ sub.icon }} -
-
-

r/{{ sub.name }}

-

{{ sub.description }}

-
+{% extends "base.html" %} +{% block title %}r/{{ sub.name }}: {{ sub.description }}{% endblock %} +{% block body %} + {% block header %} +
+ libreddit. + GITHUB +
+ {% endblock %} +
+
+
+ {{ sub.icon }} +
+
+

r/{{ sub.name }}

+

{{ sub.description }}

+
👤 {{ sub.members }} 🟢 {{ sub.active }}
-
-
- - - +
+
+
+ + + +
+ {% for post in posts %} +
+
+ +

{{ post.score }}

+
- {% for post in posts %} -
-
- -

{{ post.score }}

- -
-
-

- r/{{ sub.name }} - • - Posted by - - {{ post.time }} -

-

- {% if post.flair.0 != "" %} - {{ post.flair.0 }} - {% endif %} - {{ post.title }} -

-
- -

- {% endfor %} +
+

+ r/{{ sub.name }} + • + Posted by + + {{ post.time }} +

+

+ {% if post.flair.0 != "" %} + {{ post.flair.0 }} + {% endif %} + {{ post.title }} +

+
+ +

+ {% endfor %} -
- {% if ends.0 != "" %} - PREV - {% endif %} - - {% if ends.1 != "" %} - NEXT - {% endif %} -
-
- - \ No newline at end of file +
+ {% if ends.0 != "" %} + PREV + {% endif %} + + {% if ends.1 != "" %} + NEXT + {% endif %} +
+
+{% endblock %} \ No newline at end of file diff --git a/templates/user.html b/templates/user.html index cb40237..b2520e4 100644 --- a/templates/user.html +++ b/templates/user.html @@ -1,65 +1,55 @@ - - - Libreddit: u/{{ user.name }} - - - - - - -
- libreddit. - GITHUB -
-
-
-
- -
-
-

u/{{ user.name }}

-

Karma: {{ user.karma }} | Description: "{{ user.description }}"

-
+{% extends "base.html" %} +{% block title %}Libreddit: u/{{ user.name }}{% endblock %} +{% block body %} + {% block header %} +
+ libreddit. + GITHUB +
+ {% endblock %} +
+
+
+ +
+
+

u/{{ user.name }}

+

Karma: {{ user.karma }} | Description: "{{ user.description }}"

-
-
- - - +
+
+
+ + + +
+ {% for post in posts %} +
+
+ +

{{ post.score }}

+
- {% for post in posts %} -
-
- -

{{ post.score }}

- -
-
-

- r/{{ post.community }} - • - Posted by - - {{ post.time }} -

-

- {% if post.flair.0 == "Comment" %} - {% else if post.flair.0 == "" %} - {% else %} - {{ post.flair.0 }} - {% endif %} - {{ post.title }} -

-
- -

- {% endfor %} -
- - \ No newline at end of file +
+

+ r/{{ post.community }} + • + Posted by + + {{ post.time }} +

+

+ {% if post.flair.0 == "Comment" %} + {% else if post.flair.0 == "" %} + {% else %} + {{ post.flair.0 }} + {% endif %} + {{ post.title }} +

+
+ +

+ {% endfor %} + +{% endblock %} \ No newline at end of file