[Flask] Aggregate your news and vote for the content you care about.
Create placeholder content and "yes" page styles.
Changed files
app/placeholder_messages.py
@@ -0,0 +1,20 @@
1
Added:
messages = [{
2
Added:
'author': 'A.Banyan_97',
3
Added:
'date': 'Dec. 26th, 2019',
4
Added:
'content': "How is it going?"
5
Added:
}, {
6
Added:
'author': 'itsgeorgeeid',
7
Added:
'date': 'Dec. 25th, 2019',
8
Added:
'content': "Bas man we should have a private sesh."
9
Added:
}, {
10
Added:
'author': 'Country_V',
11
Added:
'date': 'Dec. 24th, 2019',
12
Added:
'content': "Have you checked out Young Thug's latest leak?!"
13
Added:
}, {
14
Added:
'author':
15
Added:
'Blendoit',
16
Added:
'date':
17
Added:
'Dec. 26th, 2019',
18
Added:
'content':
19
Added:
"Ah, I'm creating a new website with a friend from college, how about you?"
20
Added:
}]
app/placeholder_news.py
@@ -0,0 +1,37 @@
1
Added:
news = [{
2
Added:
'author': 'CNN',
3
Added:
'date': 'Dec. 26th, 2019',
4
Added:
'content': "Breaking news: the squad is in shambles."
5
Added:
}, {
6
Added:
'author': 'Blendoit',
7
Added:
'date': 'Dec. 25th, 2019',
8
Added:
'content': "Ah, this is a public personal update."
9
Added:
}, {
10
Added:
'author': 'Country_V',
11
Added:
'date': 'Dec. 24th, 2019',
12
Added:
'content': "This is a second public personal update."
13
Added:
}, {
14
Added:
'author': 'CNN',
15
Added:
'date': 'Dec. 26th, 2019',
16
Added:
'content': "Breaking news: the squad is in shambles."
17
Added:
}, {
18
Added:
'author': 'Blendoit',
19
Added:
'date': 'Dec. 25th, 2019',
20
Added:
'content': "Ah, this is a public personal update."
21
Added:
}, {
22
Added:
'author': 'Country_V',
23
Added:
'date': 'Dec. 24th, 2019',
24
Added:
'content': "This is a second public personal update."
25
Added:
}, {
26
Added:
'author': 'CNN',
27
Added:
'date': 'Dec. 26th, 2019',
28
Added:
'content': "Breaking news: the squad is in shambles."
29
Added:
}, {
30
Added:
'author': 'Blendoit',
31
Added:
'date': 'Dec. 25th, 2019',
32
Added:
'content': "Ah, this is a public personal update."
33
Added:
}, {
34
Added:
'author': 'Country_V',
35
Added:
'date': 'Dec. 24th, 2019',
36
Added:
'content': "This is a second public personal update."
37
Added:
}]
app/routes.py
@@ -1,5 +1,7 @@
1
1
from flask import Flask, render_template, flash, redirect, url_for
2
2
from forms import RegistrationForm, LoginForm
3
Added:
from placeholder_news import news
4
Added:
from placeholder_messages import messages
3
5
4
6
app = Flask(__name__)
5
7
app.config['SECRET_KEY'] = 'foobarblendoitfoobar!'
@@ -27,13 +29,16 @@
27
29
def home():
28
30
return render_template('home.html', posts=posts)
29
31
32
Added:
30
33
@app.route("/yes")
31
34
def yes():
32
Removed:
return render_template("yes.html")
35
Added:
return render_template("yes.html", messages=messages, news=news)
33
36
37
Added:
34
38
@app.route("/no")
35
39
def no():
36
40
return render_template("no.html")
41
Added:
37
42
38
43
@app.route("/register", methods=['GET', 'POST'])
39
44
def register():
app/static/img/home.png
Binary files differ
app/static/img/home.xcf
Binary files differ
app/static/styles/default.css
@@ -4,6 +4,9 @@
4
4
--home: rgba(200, 200, 200, 0.7);
5
5
--yes: rgba(0, 255, 0, 0.7);
6
6
--no: rgba(255, 0, 0, 0.7);
7
Added:
background-image: url(../img/home.png);
8
Added:
background-repeat: repeat-x;
9
Added:
transition-timing-function: ease-in-out;
7
10
}
8
11
9
12
* {
@@ -17,9 +20,10 @@
17
20
}
18
21
19
22
h1 {
20
Removed:
21
23
}
22
24
23
25
h2 {
26
Added:
}
24
27
28
Added:
p {
25
29
}
app/static/styles/home.css
@@ -1,27 +1,38 @@
1
1
.main {
2
2
height: 100%;
3
3
position: absolute;
4
Added:
z-index: 1;
4
5
left: 3%;
5
6
right: 3%;
6
Removed:
background: linear-gradient(to top, var(--secondary-color), var(--primary-color)) fixed;
7
7
}
8
8
9
9
.tab-yes {
10
10
height: 100%;
11
Removed:
width: 10%;
11
Added:
width: 3%;
12
12
float: left;
13
13
position: fixed;
14
14
z-index: -1;
15
Added:
left: 0;
15
16
background: var(--yes);
16
17
}
17
18
.tab-no {
18
19
height: 100%;
19
Removed:
width: 10%;
20
Added:
width: 3%;
20
21
float: right;
21
22
position: fixed;
22
23
z-index: -1;
23
24
right: 0;
24
25
background: var(--no);
26
Added:
}
27
Added:
28
Added:
.tab-yes:hover {
29
Added:
width: 4%;
30
Added:
transition: 0.2s;
31
Added:
}
32
Added:
33
Added:
.tab-no:hover {
34
Added:
width: 4%;
35
Added:
transition: 0.2s;
25
36
}
26
37
27
38
.tab-yes:hover ~ .main {
app/static/styles/no.css
@@ -1,47 +1,50 @@
1
1
.main {
2
2
height: 100%;
3
Removed:
right: 0;
4
Removed:
left: 6%;
5
3
position: absolute;
6
4
z-index: 1;
7
Removed:
background: linear-gradient(to top, var(--secondary-color), var(--primary-color)) fixed;
5
Added:
left: 7%;
8
6
}
9
7
10
Removed:
.tab-home {
8
Added:
.tab-yes {
11
9
height: 100%;
12
10
width: 3%;
13
11
float: left;
14
12
position: relative;
15
Removed:
z-index: 0;
16
Removed:
background: var(--home);
13
Added:
z-index: 1;
14
Added:
background: var(--yes);
17
15
}
18
16
19
Removed:
.tab-yes {
17
Added:
.tab-home {
20
18
height: 100%;
21
19
width: 3%;
22
20
float: left;
23
21
position: relative;
24
Removed:
z-index: -1;
25
Removed:
background: var(--yes);
22
Added:
z-index: 1;
23
Added:
background: var(--home);
26
24
}
27
25
28
Removed:
.tab-home:hover ~ .main {
29
Removed:
left: 9%;
26
Added:
.tab-home:hover {
27
Added:
width: 4%;
30
28
transition: 0.2s;
31
29
}
32
30
33
Removed:
.tab-home:hover {
34
Removed:
width: 6%;
31
Added:
.tab-yes:hover ~ .main {
32
Added:
left: 10%;
35
33
transition: 0.2s;
36
34
}
37
35
38
Removed:
.tab-yes:hover ~ .main {
39
Removed:
left: 9%;
36
Added:
.tab-home:hover ~ .main {
37
Added:
left: 8%;
40
38
transition: 0.2s;
41
39
}
42
40
41
Added:
.tab-yes:hover ~ .tab-home {
42
Added:
width: 5%;
43
Added:
transition: 0.2s;
44
Added:
}
45
Added:
43
46
.tab-yes:hover {
44
Removed:
width: 6%;
47
Added:
width: 4%;
45
48
transition: 0.2s;
46
49
}
47
50
app/static/styles/yes.css
@@ -1,54 +1,100 @@
1
Added:
/* Main page components. */
1
2
.main {
2
3
height: 100%;
3
Removed:
right: 6%;
4
Removed:
left: 0;
5
Removed:
position: absolute;
6
Removed:
z-index: 1;
7
Removed:
background: linear-gradient(to top, var(--secondary-color), var(--primary-color)) fixed;
4
Added:
position: relative;
5
Added:
z-index: 0;
6
Added:
overflow: hidden;
8
7
}
9
8
10
Removed:
.tab-home {
9
Added:
/* Feeds. */
10
Added:
.feed-message {
11
11
height: 100%;
12
Removed:
width: 3%;
13
Removed:
float: right;
12
Added:
width: 30%;
14
13
position: relative;
15
Removed:
z-index: 0;
16
Removed:
background: var(--home);
14
Added:
float: left;
15
Added:
overflow: auto;
17
16
}
17
Added:
.feed-post {
18
Added:
height: 100%;
19
Added:
width: 30%;
20
Added:
position: relative;
21
Added:
float: left;
22
Added:
overflow: auto;
23
Added:
}
24
Added:
.feed-ads {
25
Added:
height: 100%;
26
Added:
width: 20%;
27
Added:
position: relative;
28
Added:
float: left;
29
Added:
overflow: auto;
30
Added:
}
18
31
32
Added:
/* Tabs. */
19
33
.tab-no {
20
34
height: 100%;
21
35
width: 3%;
22
36
float: right;
23
37
position: relative;
24
Removed:
z-index: -1;
25
38
background: var(--no);
26
39
}
27
Removed:
28
Removed:
.tab-home:hover ~ .main {
29
Removed:
right: 9%;
30
Removed:
transition: 0.2s;
40
Added:
.tab-home {
41
Added:
height: 100%;
42
Added:
width: 3%;
43
Added:
float: right;
44
Added:
position: relative;
45
Added:
background: var(--home);
31
46
}
32
Removed:
33
47
.tab-home:hover {
34
Removed:
width: 6%;
48
Added:
width: 4%;
35
49
transition: 0.2s;
36
50
}
37
Removed:
38
Removed:
.tab-no:hover ~ .main {
39
Removed:
right: 9%;
51
Added:
.tab-no:hover ~ .tab-home {
52
Added:
width: 5%;
40
53
transition: 0.2s;
41
54
}
42
Removed:
43
55
.tab-no:hover {
44
Removed:
width: 6%;
56
Added:
width: 4%;
45
57
transition: 0.2s;
46
58
}
47
59
48
Removed:
.post {
60
Added:
/* Messages. */
61
Added:
.message {
49
62
background: white;
50
63
border-radius: 14px;
51
64
padding: 1rem;
52
Removed:
margin: 1rem;
53
Removed:
width: 20%;
65
Added:
margin: 0.5rem;
66
Added:
}
67
Added:
.message:hover {
68
Added:
background: linear-gradient(to left, var(--no) 50%, var(--yes) 50%);
69
Added:
cursor: pointer;
70
Added:
transition: 0.8s;
71
Added:
color: white;
72
Added:
}
73
Added:
74
Added:
/* News. */
75
Added:
.news {
76
Added:
background: white;
77
Added:
border-radius: 14px;
78
Added:
padding: 1rem;
79
Added:
margin: 0.5rem;
80
Added:
}
81
Added:
.news:hover {
82
Added:
background: linear-gradient(to left, var(--no) 50%, var(--yes) 50%);
83
Added:
cursor: pointer;
84
Added:
transition: 0.8s;
85
Added:
color: white;
86
Added:
}
87
Added:
88
Added:
/* Ads. */
89
Added:
.ad {
90
Added:
background: white;
91
Added:
border-radius: 14px;
92
Added:
padding: 1rem;
93
Added:
margin: 0.5rem;
94
Added:
}
95
Added:
.ad:hover {
96
Added:
background: linear-gradient(to left, var(--no) 50%, var(--yes) 50%);
97
Added:
cursor: pointer;
98
Added:
transition: 0.8s;
99
Added:
color: white;
54
100
}
app/templates/home.html
@@ -2,7 +2,6 @@
2
2
<link rel= "stylesheet" type= "text/css" href= "{{ url_for('static',filename='styles/home.css') }}">
3
3
4
4
{% extends "base.html" %}
5
Removed:
6
5
{% block content %}
7
6
8
7
<div>
@@ -19,6 +18,5 @@
19
18
{% endfor %}
20
19
</div>
21
20
</div>
22
Removed:
23
21
24
22
{% endblock content %}
app/templates/no.html
@@ -9,13 +9,9 @@
9
9
<a href="{{ url_for('home') }}" class="tab-home"></a>
10
10
11
11
<div class="main">
12
Removed:
{% for post in posts %}
13
Removed:
<div class="post">
14
Removed:
<h1>{{post.author}}</h1>
15
Removed:
<h2>{{post.date}}</h2>
16
Removed:
<p>{{post.content}}</p>
17
Removed:
</div>
18
Removed:
{% endfor %}
12
Added:
<p>
13
Added:
Tell me, no
14
Added:
</p>
19
15
</div>
20
16
</div>
21
17
app/templates/yes.html
@@ -9,7 +9,54 @@
9
9
<a href="{{ url_for('home') }}" class="tab-home"></a>
10
10
11
11
<div class="main">
12
Removed:
<p> yes, no?</p>
12
Added:
13
Added:
<div class="feed-message">
14
Added:
{% for message in messages %}
15
Added:
<div class="message">
16
Added:
<h1>{{message.author}}</h1>
17
Added:
<h2>{{message.date}}</h2>
18
Added:
<p>{{message.content}}</p>
19
Added:
</div>
20
Added:
{% endfor %}
21
Added:
</div>
22
Added:
23
Added:
<div class="feed-post">
24
Added:
{% for news in news %}
25
Added:
<div class="news">
26
Added:
<h1>{{news.author}}</h1>
27
Added:
<h2>{{news.date}}</h2>
28
Added:
<p>{{news.content}}</p>
29
Added:
</div>
30
Added:
{% endfor %}
31
Added:
</div>
32
Added:
33
Added:
<div class="feed-ads">
34
Added:
<div class="ad">
35
Added:
Buy my sourdough, ah
36
Added:
</div>
37
Added:
<div class="ad">
38
Added:
Check out this sponsored link, ere.
39
Added:
</div>
40
Added:
<div class="ad">
41
Added:
Another random ad (from a high-paying sponsor hopefully)
42
Added:
</div>
43
Added:
<div class="ad">
44
Added:
Ah I literally don't have any other placeholder ideas for ads.
45
Added:
</div>
46
Added:
<div class="ad">
47
Added:
Buy my sourdough, ah
48
Added:
</div>
49
Added:
<div class="ad">
50
Added:
Check out this sponsored link, ere.
51
Added:
</div>
52
Added:
<div class="ad">
53
Added:
Another random ad (from a high-paying sponsor hopefully)
54
Added:
</div>
55
Added:
<div class="ad">
56
Added:
Ah I literally don't have any other placeholder ideas for ads.
57
Added:
</div>
58
Added:
</div>
59
Added:
</div>
13
60
</div>
14
61
</div>
15
62