Skip to content

Commit 5ec5656

Browse files
committed
improve and organize ui
1 parent f2d4460 commit 5ec5656

File tree

13 files changed

+82
-107
lines changed

13 files changed

+82
-107
lines changed

src/core/views.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,30 @@
99

1010

1111
def about(request):
12-
return render(request, 'main/about.html', {'title': 'The Collector APP'})
12+
return render(request, 'core/about.html', {'title': 'About'})
1313

1414

1515
def handler404(request, *args, **kwargs):
1616
return render(
17-
request, 'main/Error.html',
18-
{'title': 'Page not found', 'head': 'Not Found', 'status': '404'},
17+
request, 'core/error.html',
18+
{'title': '404', 'message': 'Page Not Found', 'status': '404'},
1919
status=404,)
2020

2121

2222
def handler500(request, *args, **kwargs):
2323
return render(
24-
request, 'main/Error.html',
25-
{'title': 'Server Error', 'head': 'Server Error', 'status': '500'},
24+
request, 'core/error.html',
25+
{'title': '500', 'message': 'Internal Server Error', 'status': '500'},
2626
status=500)
2727

2828

2929
def inuse(request):
3030
return render(
31-
request, 'main/inuse.html',
32-
{'title': 'Account is already in use ', 'status': '403'},)
31+
request, 'core/error.html',
32+
{'title': '403 ',
33+
'message':
34+
'Twitter account is already linked to another user in our site',
35+
'status': '403'},)
3336

3437

3538
def media(request, path):

src/posts/views.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
def home(request):
1818
page = request.GET.get('page', 1)
19-
2019
posts = Post.objects.annotate(Count('post_comments')).all().values(
2120
'id', 'thumnail_photo', 'created_at', 'author_screen_name',
2221
'title', 'rtl', 'post_comments__count').order_by('-created_at')
@@ -30,7 +29,7 @@ def home(request):
3029
cache.set(f'random_posts', random_posts, timeout=60*15)
3130

3231
context = {'title': 'Home', 'posts': posts, 'random_posts': random_posts}
33-
return render(request, 'main/index.html', context)
32+
return render(request, 'posts/index.html', context)
3433

3534

3635
@login_required

src/static/css/main-light.css

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,18 @@ ul {
198198
stroke: #222831;
199199
}
200200
.header__logo {
201-
/* margin-left: auto;
202-
margin-right: 42px; */
203201
margin: 0;
204202
}
203+
.header__logo h2 {
204+
font-family: 'cairo-regular';
205+
color: #666ee8;
206+
margin-bottom: 0;
207+
}
208+
.footer__logo h2 {
209+
font-family: 'cairo-regular';
210+
color: #666ee8;
211+
margin-bottom: 0;
212+
}
205213
.header__menu {
206214
position: absolute;
207215
width: 24px;
@@ -299,8 +307,6 @@ ul {
299307
display: none;
300308
}
301309
.header__logo {
302-
/* margin-right: 0;
303-
margin-left: 100px; */
304310
margin: 0;
305311
}
306312
.header__nav {
@@ -340,7 +346,6 @@ ul {
340346
color: rgba(34, 40, 49, 0.8);
341347
font-family: "cairo-semibold";
342348
font-weight: normal;
343-
text-align: right;
344349
margin-bottom: 0;
345350
margin-top: 30px;
346351
}
@@ -405,24 +410,22 @@ ul {
405410
.post__meta {
406411
display: flex;
407412
flex-direction: row;
408-
justify-content: flex-end;
413+
justify-content: space-between;
409414
align-items: center;
410415
margin-top: 20px;
411416
}
412417
.post__meta span {
413418
color: rgba(34, 40, 49, 0.8);
414419
font-size: 12px;
415-
margin-left: 20px;
416420
line-height: 100%;
417421
}
418422
.post__title {
419423
display: block;
420424
width: 100%;
421425
height: 120px;
422426
font-size: 16px;
423-
line-height: 28px;
427+
line-height: 30px;
424428
font-weight: normal;
425-
text-align: right;
426429
color: #222831;
427430
margin-bottom: 0;
428431
margin-top: 20px;
@@ -563,6 +566,9 @@ ul {
563566
font-family: "cairo-semibold";
564567
font-weight: normal;
565568
}
569+
.tw-block a {
570+
direction: ltr !important;
571+
}
566572
.article__list {
567573
margin-top: 30px;
568574
text-align: right;
@@ -1077,8 +1083,10 @@ ul {
10771083
min-height: 100vh;
10781084
padding: 40px 0;
10791085
}
1080-
.page__logo {
1081-
margin-bottom: 10px;
1086+
.page__logo h2 {
1087+
font-family: 'cairo-regular';
1088+
color: #666ee8;
1089+
margin-bottom: 0;
10821090
}
10831091
.footer {
10841092
position: relative;

src/static/css/main.css

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,18 @@ ul {
205205
stroke: #fff;
206206
}
207207
.header__logo {
208-
/* margin-left: auto;
209-
margin-right: 42px; */
210208
margin: 0;
211209
}
210+
.header__logo h2 {
211+
font-family: "cairo-regular";
212+
color: #666ee8;
213+
margin-bottom: 0;
214+
}
215+
.footer__logo h2 {
216+
font-family: "cairo-regular";
217+
color: #666ee8;
218+
margin-bottom: 0;
219+
}
212220
.header__menu {
213221
position: absolute;
214222
width: 24px;
@@ -306,8 +314,6 @@ ul {
306314
display: none;
307315
}
308316
.header__logo {
309-
/* margin-right: 0;
310-
margin-left: 100px; */
311317
margin: 0;
312318
}
313319
.header__nav {
@@ -347,7 +353,6 @@ ul {
347353
color: #ececec;
348354
font-family: "cairo-semibold";
349355
font-weight: normal;
350-
text-align: right;
351356
margin-bottom: 0;
352357
margin-top: 30px;
353358
}
@@ -412,24 +417,22 @@ ul {
412417
.post__meta {
413418
display: flex;
414419
flex-direction: row;
415-
justify-content: flex-end;
420+
justify-content: space-between;
416421
align-items: center;
417422
margin-top: 20px;
418423
}
419424
.post__meta span {
420425
color: #ececec;
421426
font-size: 12px;
422-
margin-left: 20px;
423427
line-height: 100%;
424428
}
425429
.post__title {
426430
display: block;
427431
width: 100%;
428432
height: 120px;
429433
font-size: 16px;
430-
line-height: 28px;
434+
line-height: 30px;
431435
font-weight: normal;
432-
text-align: right;
433436
color: #fff;
434437
margin-bottom: 0;
435438
margin-top: 20px;
@@ -572,7 +575,9 @@ ul {
572575
font-family: "cairo-semibold";
573576
font-weight: normal;
574577
}
575-
578+
.tw-block a {
579+
direction: ltr !important;
580+
}
576581
.article__list {
577582
margin-top: 30px;
578583
text-align: right;
@@ -1087,8 +1092,10 @@ ul {
10871092
min-height: 100vh;
10881093
padding: 40px 0;
10891094
}
1090-
.page__logo {
1091-
margin-bottom: 10px;
1095+
.page__logo h2 {
1096+
font-family: "cairo-regular";
1097+
color: #666ee8;
1098+
margin-bottom: 0;
10921099
}
10931100
.footer {
10941101
position: relative;

src/static/js/main.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,7 @@ $(document).ready(function () {
129129
}
130130
}
131131

132-
const mode = getCookie("mode");
133-
134-
if (mode != "normal" && mode != "dark") {
135-
document.cookie = "mode=dark;path=/;expires=Fri Dec 31 9999 14:00:00 GMT+0200;";
136-
} else if (mode == "normal") {
137-
document.getElementById("mode").setAttribute("href", lightModeCss);
138-
}
139-
132+
140133
const switchButton = document.getElementById("switch");
141134
if (switchButton) switchButton.onclick = switchMode;
142135

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<div class="container">
1313
<div class="row">
1414
<div class="col-12">
15-
<h1 class="section__title" style="text-align: center;" style="text-align: center;">كيف تستخدم خدمتنا</h1>
15+
<h1 class="section__title" style="text-align: center;" style="text-align: center;">How to use our service</h1>
1616
</div>
1717
</div>
1818
</div>
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
<!DOCTYPE html>
22
<html lang="en">
33
{% load static %}
4+
45
<head>
5-
<meta charset="utf-8">
6-
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
6+
<meta charset="utf-8" />
7+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
78

8-
<link rel="stylesheet" href="{% static 'css/styles.min.css' %}">
9-
<link rel="stylesheet" href="{% static 'css/main.css' %}">
9+
<link rel="stylesheet" href="{% static 'css/styles.min.css' %}" />
10+
<link id="mode" rel="stylesheet" href="{% static 'css/main.css' %}" />
11+
<link rel="icon"
12+
href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>📦</text></svg>">
1013

11-
<meta name="description" content="">
12-
<meta name="keywords" content="">
13-
<title>The Collector | {{ title }}</title>
14+
<meta name="description" content="BlogPost & Twitter Bot" />
15+
<meta name="keywords" content="" />
16+
<title>{{title}} | TheCollector</title>
1417
</head>
1518

1619
<body>
@@ -19,18 +22,16 @@
1922
<div class="col-12 col-sm-10 offset-sm-1 col-md-8 offset-md-2 col-lg-6 offset-lg-3 col-xl-4 offset-xl-4">
2023
<div class="page">
2124
<div class="form form--error">
22-
<h4 class="form__title">Error {{status}}</h4>
23-
24-
<p class="form__text">{{head}}</p>
25-
25+
<h4 class="form__title">{{status}}</h4>
26+
<p class="form__text">{{message}}</p>
2627
<a href="{% url 'home' %}" class="form__btn form__btn--big" type="button">Back to home</a>
2728
</div>
2829
</div>
2930
</div>
3031
</div>
3132
</div>
32-
3333
<script src="{% static 'js/scripts.min.js' %}"></script>
34-
<script src="{% static 'js/main.js' %}"></script>
34+
<script src="{% static 'js/main.js' %}"></script>
3535
</body>
36+
3637
</html>

src/templates/layout/auth_base.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<link rel="icon"
1212
href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>📦</text></svg>">
1313

14-
<meta name="description" content="" />
14+
<meta name="description" content="BlogPost & Twitter Bot" />
1515
<meta name="keywords" content="" />
1616
<title>{{title}} | TheCollector</title>
1717
</head>
@@ -22,9 +22,8 @@
2222
<div class="col-12 col-sm-10 offset-sm-1 col-md-8 offset-md-2 col-lg-6 offset-lg-3 col-xl-4 offset-xl-4">
2323
<div class="page">
2424
<a href="{% url 'home' %}" class="page__logo">
25-
<img src="{% static 'img/logo.png' %}" alt="" />
25+
<h2>TheCollector</h2>
2626
</a>
27-
2827
{% block content %} {% endblock %}
2928
</div>
3029
</div>

src/templates/layout/base.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<!DOCTYPE html>
22
<html lang="en">
33
{% load static %}
4-
54
<head>
65
<meta charset="utf-8" />
76
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
87

98
<link rel="stylesheet" href="{% static 'css/styles.min.css' %}" />
10-
<link id="mode" rel="stylesheet" href="{% static 'css/main.css' %}" />
9+
<link id="mode" rel="stylesheet" {% if request.COOKIES.mode == "dark" %} href="{% static 'css/main.css' %}" {% else %}
10+
href="{% static 'css/main-light.css' %}" {% endif %} />
1111
<link rel="icon"
1212
href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>📦</text></svg>">
1313

@@ -23,7 +23,7 @@
2323
<div class="col-12">
2424
<div class="header__content">
2525
<a href="{% url 'home' %}" class="header__logo">
26-
<img src="{% static 'img/logo.png' %}" alt="" />
26+
<h2>TheCollector</h2>
2727
</a>
2828
<button href="#" class="header__color" id="switch" aria-label="switch-mode">
2929
<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512">
@@ -55,7 +55,7 @@
5555
{% else %}
5656
<a href="{% url 'register' %}">Register</a>
5757
{% endif %}
58-
<a href="{% url 'about' %}">How to use</a>
58+
<a href="{% url 'about' %}">About</a>
5959
</nav>
6060
{% if user.is_authenticated %}
6161
<a href="{% url 'logout' %}" class="header__login"><svg xmlns="http://www.w3.org/2000/svg" width="512"
@@ -99,7 +99,7 @@
9999
<div class="col-12">
100100
<div class="footer__content">
101101
<a href="#" class="footer__logo">
102-
<img src="{% static 'img/logo.png' %}" alt="" />
102+
<h2>TheCollector</h2>
103103
</a>
104104
<small class="footer__copyright"></small>
105105
</div>

0 commit comments

Comments
 (0)