[Flask] Aggregate your news and vote for the content you care about.
Placeholder content and CSS style sheets.
Changed files
app/placeholder_messages.py
@@ -17,4 +17,23 @@
17
17
'Dec. 26th, 2019',
18
18
'content':
19
19
"Ah, I'm creating a new website with a friend from college, how about you?"
20
Added:
}, {
21
Added:
'author': 'BChon',
22
Added:
'date': 'Jan. 26th, 2019',
23
Added:
'content': "yo wassap"
24
Added:
}, {
25
Added:
'author': 'Blendoit',
26
Added:
'date': 'Dec. 26th, 2019',
27
Added:
'content': "Ah why aren't you replying"
28
Added:
}, {
29
Added:
'author': 'vaqarsyed',
30
Added:
'date': 'Jan. 14th, 2019',
31
Added:
'content': "Hrr, another day on the grind #slatt"
32
Added:
}, {
33
Added:
'author':
34
Added:
'christinafarhat',
35
Added:
'date':
36
Added:
'Dec. 26th, 2019',
37
Added:
'content':
38
Added:
"I'm just using the first name that comes to mind at this point."
20
39
}]
app/placeholder_news.py
@@ -3,9 +3,90 @@
3
3
'date': 'Dec. 26th, 2019',
4
4
'content': "Breaking news: the squad is in shambles."
5
5
}, {
6
Added:
'author':
7
Added:
'Blendoit',
8
Added:
'date':
9
Added:
'Dec. 25th, 2019',
10
Added:
'content':
11
Added:
"Ah, this is a public personal update.\n It's pretty long, because this enables testing layouts that adapt to posts with a lot of content. Do we want the content to wrap around? Should we implement a content clipping feature?"
12
Added:
}, {
13
Added:
'author': 'Country_V',
14
Added:
'date': 'Dec. 24th, 2019',
15
Added:
'content': "This is a second public personal update."
16
Added:
}, {
17
Added:
'author': 'CNN',
18
Added:
'date': 'Dec. 26th, 2019',
19
Added:
'content': "Breaking news: the squad is in shambles."
20
Added:
}, {
6
21
'author': 'Blendoit',
7
22
'date': 'Dec. 25th, 2019',
8
23
'content': "Ah, this is a public personal update."
24
Added:
}, {
25
Added:
'author': 'Country_V',
26
Added:
'date': 'Dec. 24th, 2019',
27
Added:
'content': "This is a second public personal update."
28
Added:
}, {
29
Added:
'author': 'CNN',
30
Added:
'date': 'Dec. 26th, 2019',
31
Added:
'content': "Breaking news: the squad is in shambles."
32
Added:
}, {
33
Added:
'author': 'Blendoit',
34
Added:
'date': 'Dec. 25th, 2019',
35
Added:
'content': "Ah, this is a public personal update."
36
Added:
}, {
37
Added:
'author': 'Country_V',
38
Added:
'date': 'Dec. 24th, 2019',
39
Added:
'content': "This is a second public personal update."
40
Added:
}, {
41
Added:
'author': 'CNN',
42
Added:
'date': 'Dec. 26th, 2019',
43
Added:
'content': "Breaking news: the squad is in shambles."
44
Added:
}, {
45
Added:
'author':
46
Added:
'Blendoit',
47
Added:
'date':
48
Added:
'Dec. 25th, 2019',
49
Added:
'content':
50
Added:
"Ah, this is a public personal update.\n It's pretty long, because this enables testing layouts that adapt to posts with a lot of content. Do we want the content to wrap around? Should we implement a content clipping feature?"
51
Added:
}, {
52
Added:
'author': 'CNN',
53
Added:
'date': 'Dec. 26th, 2019',
54
Added:
'content': "Breaking news: the squad is in shambles."
55
Added:
}, {
56
Added:
'author':
57
Added:
'Blendoit',
58
Added:
'date':
59
Added:
'Dec. 25th, 2019',
60
Added:
'content':
61
Added:
"Ah, this is a public personal update.\n It's pretty long, because this enables testing layouts that adapt to posts with a lot of content. Do we want the content to wrap around? Should we implement a content clipping feature?"
62
Added:
}, {
63
Added:
'author': 'Country_V',
64
Added:
'date': 'Dec. 24th, 2019',
65
Added:
'content': "This is a second public personal update."
66
Added:
}, {
67
Added:
'author': 'CNN',
68
Added:
'date': 'Dec. 26th, 2019',
69
Added:
'content': "Breaking news: the squad is in shambles."
70
Added:
}, {
71
Added:
'author': 'Blendoit',
72
Added:
'date': 'Dec. 25th, 2019',
73
Added:
'content': "Ah, this is a public personal update."
74
Added:
}, {
75
Added:
'author': 'Country_V',
76
Added:
'date': 'Dec. 24th, 2019',
77
Added:
'content': "This is a second public personal update."
78
Added:
}, {
79
Added:
'author': 'CNN',
80
Added:
'date': 'Dec. 26th, 2019',
81
Added:
'content': "Breaking news: the squad is in shambles."
82
Added:
}, {
83
Added:
'author': 'Blendoit',
84
Added:
'date': 'Dec. 25th, 2019',
85
Added:
'content': "Ah, this is a public personal update."
86
Added:
}, {
87
Added:
'author': 'Country_V',
88
Added:
'date': 'Dec. 24th, 2019',
89
Added:
'content': "This is a second public personal update."
9
90
}, {
10
91
'author': 'Country_V',
11
92
'date': 'Dec. 24th, 2019',
app/placeholder_posts.py
@@ -0,0 +1,16 @@
1
Added:
posts = [{
2
Added:
'author':
3
Added:
'Marius',
4
Added:
'date':
5
Added:
'Dec. 26th, 2019',
6
Added:
'content':
7
Added:
"this is a test where I write a message that isn't too short, it isn't too long, it's just the right size."
8
Added:
}, {
9
Added:
'author': 'Achille',
10
Added:
'date': 'Dec. 25th, 2019',
11
Added:
'content': "this is a second test!"
12
Added:
}, {
13
Added:
'author': 'Jeanne',
14
Added:
'date': 'Dec. 24th, 2019',
15
Added:
'content': "this is a third test!"
16
Added:
}]
app/routes.py
@@ -1,33 +1,18 @@
1
1
from flask import Flask, render_template, flash, redirect, url_for
2
2
from forms import RegistrationForm, LoginForm
3
Added:
from placeholder_posts import posts
3
4
from placeholder_news import news
4
5
from placeholder_messages import messages
5
6
6
7
app = Flask(__name__)
7
8
app.config['SECRET_KEY'] = 'foobarblendoitfoobar!'
8
9
9
Removed:
posts = [{
10
Removed:
'author':
11
Removed:
'Marius',
12
Removed:
'date':
13
Removed:
'Dec. 26th, 2019',
14
Removed:
'content':
15
Removed:
"this is a test where I write a message that isn't too short, it isn't too long, it's just the right size."
16
Removed:
}, {
17
Removed:
'author': 'Achille',
18
Removed:
'date': 'Dec. 25th, 2019',
19
Removed:
'content': "this is a second test!"
20
Removed:
}, {
21
Removed:
'author': 'Jeanne',
22
Removed:
'date': 'Dec. 24th, 2019',
23
Removed:
'content': "this is a third test!"
24
Removed:
}]
25
10
26
Removed:
27
11
@app.route("/")
28
12
@app.route("/home")
29
13
def home():
30
Removed:
return render_template('home.html', posts=posts)
14
Added:
home_posts = posts + news + messages
15
Added:
return render_template('home.html', posts=home_posts)
31
16
32
17
33
18
@app.route("/yes")
@@ -37,7 +22,8 @@
37
22
38
23
@app.route("/no")
39
24
def no():
40
Removed:
return render_template("no.html")
25
Added:
archives = posts + news + messages
26
Added:
return render_template("no.html", archive=archives)
41
27
42
28
43
29
@app.route("/register", methods=['GET', 'POST'])
app/static/styles/home.css
@@ -1,17 +1,27 @@
1
1
.main {
2
2
height: 100%;
3
3
position: absolute;
4
Removed:
z-index: 1;
4
Added:
z-index: 0;
5
5
left: 3%;
6
6
right: 3%;
7
Added:
overflow: hidden;
7
8
}
8
9
10
Added:
.feed-post {
11
Added:
height: 100%;
12
Added:
padding: 1px;
13
Added:
display: flex;
14
Added:
position: relative;
15
Added:
flex-wrap: wrap;
16
Added:
overflow: auto;
17
Added:
justify-content: space-around;
18
Added:
}
19
Added:
9
20
.tab-yes {
10
21
height: 100%;
11
22
width: 3%;
12
23
float: left;
13
24
position: fixed;
14
Removed:
z-index: -1;
15
25
left: 0;
16
26
background: var(--yes);
17
27
}
@@ -20,7 +30,6 @@
20
30
width: 3%;
21
31
float: right;
22
32
position: fixed;
23
Removed:
z-index: -1;
24
33
right: 0;
25
34
background: var(--no);
26
35
}
@@ -46,11 +55,13 @@
46
55
}
47
56
48
57
.post {
58
Added:
max-height: 20%;
59
Added:
max-width: 30%;
49
60
background: white;
50
61
border-radius: 14px;
51
62
padding: 1rem;
52
63
margin: 1rem;
53
Removed:
width: 20%;
64
Added:
overflow: hidden;
54
65
}
55
66
56
67
.post:hover {
@@ -58,4 +69,5 @@
58
69
cursor: pointer;
59
70
transition: 0.8s;
60
71
color: white;
72
Added:
overflow: auto;
61
73
}
app/static/styles/no.css
@@ -1,8 +1,9 @@
1
1
.main {
2
2
height: 100%;
3
Removed:
position: absolute;
4
Removed:
z-index: 1;
3
Added:
position: fixed;
4
Added:
z-index: 0;
5
5
left: 7%;
6
Added:
overflow: auto;
6
7
}
7
8
8
9
.tab-yes {
@@ -48,10 +49,25 @@
48
49
transition: 0.2s;
49
50
}
50
51
51
Removed:
.post {
52
Added:
/* Archive. */
53
Added:
.feed-archive {
54
Added:
width: 100%;
55
Added:
display: flex;
56
Added:
position: relative;
57
Added:
flex-wrap: wrap;
58
Added:
justify-content: space-around;
59
Added:
}
60
Added:
61
Added:
.archive {
52
62
background: white;
63
Added:
position: relative;
53
64
border-radius: 14px;
54
65
padding: 1rem;
55
Removed:
margin: 1rem;
56
Removed:
width: 20%;
66
Added:
margin: 0.5rem;
67
Added:
}
68
Added:
.archive:hover {
69
Added:
background: linear-gradient(to left, var(--no) 50%, var(--yes) 50%);
70
Added:
cursor: pointer;
71
Added:
transition: 0.8s;
72
Added:
color: white;
57
73
}
app/static/styles/yes.css
@@ -1,4 +1,4 @@
1
Removed:
/* Main page components. */
1
Added:
/* Main page area. */
2
2
.main {
3
3
height: 100%;
4
4
position: relative;
@@ -9,23 +9,26 @@
9
9
/* Feeds. */
10
10
.feed-message {
11
11
height: 100%;
12
Removed:
width: 30%;
12
Added:
width: 25%;
13
13
position: relative;
14
14
float: left;
15
15
overflow: auto;
16
16
}
17
Removed:
.feed-post {
17
Added:
.feed-news {
18
18
height: 100%;
19
Removed:
width: 30%;
19
Added:
width: 55%;
20
Added:
display: flex;
20
21
position: relative;
21
22
float: left;
23
Added:
flex-wrap: wrap;
22
24
overflow: auto;
25
Added:
justify-content: space-between;
23
26
}
24
27
.feed-ads {
25
28
height: 100%;
26
29
width: 20%;
27
30
position: relative;
28
Removed:
float: left;
31
Added:
float: right;
29
32
overflow: auto;
30
33
}
31
34
@@ -73,16 +76,21 @@
73
76
74
77
/* News. */
75
78
.news {
79
Added:
max-height: 10%;
80
Added:
max-width: 50%;
76
81
background: white;
82
Added:
position: relative;
77
83
border-radius: 14px;
78
84
padding: 1rem;
79
85
margin: 0.5rem;
86
Added:
overflow: hidden;
80
87
}
81
88
.news:hover {
82
89
background: linear-gradient(to left, var(--no) 50%, var(--yes) 50%);
83
90
cursor: pointer;
84
91
transition: 0.8s;
85
92
color: white;
93
Added:
overflow: auto;
86
94
}
87
95
88
96
/* Ads. */
app/templates/home.html
@@ -9,13 +9,15 @@
9
9
<a href="{{ url_for('no') }}" class="tab-no"></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>
12
Added:
<div class="feed-post">
13
Added:
{% for post in posts %}
14
Added:
<div class="post">
15
Added:
<h1>{{post.author}}</h1>
16
Added:
<h2>{{post.date}}</h2>
17
Added:
<p>{{post.content}}</p>
18
Added:
</div>
19
Added:
{% endfor %}
17
20
</div>
18
Removed:
{% endfor %}
19
21
</div>
20
22
</div>
21
23
app/templates/no.html
@@ -9,11 +9,16 @@
9
9
<a href="{{ url_for('home') }}" class="tab-home"></a>
10
10
11
11
<div class="main">
12
Removed:
<p>
13
Removed:
Tell me, no
14
Removed:
</p>
12
Added:
<div class="feed-archive">
13
Added:
{% for archive in archive %}
14
Added:
<div class="archive">
15
Added:
<h1>{{archive.author}}</h1>
16
Added:
<h2>{{archive.date}}</h2>
17
Added:
<p>{{archive.content}}</p>
18
Added:
</div>
19
Added:
{% endfor %}
20
Added:
</div>
15
21
</div>
16
22
</div>
17
Removed:
18
23
19
24
{% endblock content %}
app/templates/yes.html
@@ -20,7 +20,7 @@
20
20
{% endfor %}
21
21
</div>
22
22
23
Removed:
<div class="feed-post">
23
Added:
<div class="feed-news">
24
24
{% for news in news %}
25
25
<div class="news">
26
26
<h1>{{news.author}}</h1>