added pagination to index page, light styling
This commit is contained in:
parent
4afa1e94ac
commit
fd022023b5
5 changed files with 46 additions and 15 deletions
8
uwsgi.ini
Normal file
8
uwsgi.ini
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
[uwsgi]
|
||||||
|
master=true
|
||||||
|
processes=4
|
||||||
|
threads=2
|
||||||
|
socket=/tmp/uwsgi.sock
|
||||||
|
chmod-socket=666
|
||||||
|
module=woodwind:wsgi
|
||||||
|
pidfile=/tmp/woodwind.pid
|
|
@ -21,11 +21,16 @@ body {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
main {
|
header, main {
|
||||||
max-width: 600px;
|
max-width: 600px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
header {
|
||||||
|
margin-bottom: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
article {
|
article {
|
||||||
margin-bottom: 2em;
|
margin-bottom: 2em;
|
||||||
box-shadow: $box-shadow;
|
box-shadow: $box-shadow;
|
||||||
|
@ -36,7 +41,7 @@ article {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
header {
|
&> header {
|
||||||
img {
|
img {
|
||||||
max-width: 64px;
|
max-width: 64px;
|
||||||
max-height: 64px;
|
max-height: 64px;
|
||||||
|
@ -44,8 +49,13 @@ article {
|
||||||
float: left;
|
float: left;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
color: $armadillo;
|
color: $lunar-green;
|
||||||
border-bottom: 1px solid $armadillo;
|
border-bottom: 1px solid $sirocco;
|
||||||
|
margin-bottom: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
footer {
|
||||||
|
margin-top: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
|
|
|
@ -7,7 +7,8 @@
|
||||||
{% block head %}{% endblock %}
|
{% block head %}{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<main>
|
|
||||||
|
<header>
|
||||||
{% if current_user.is_authenticated() %}
|
{% if current_user.is_authenticated() %}
|
||||||
<div class="logged-in">{{ current_user.domain }}</div>
|
<div class="logged-in">{{ current_user.domain }}</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
@ -16,9 +17,13 @@
|
||||||
<button type="submit">Login</button>
|
<button type="submit">Login</button>
|
||||||
</form>
|
</form>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% block header %}{% endblock %}
|
||||||
{% for message in get_flashed_messages() %}
|
{% for message in get_flashed_messages() %}
|
||||||
<div class="flash">{{ message | safe }}</div>
|
<div class="flash">{{ message | safe }}</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main>
|
||||||
{% block body %}{% endblock %}
|
{% block body %}{% endblock %}
|
||||||
</main>
|
</main>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
{% extends "base.jinja2" %}
|
{% extends "base.jinja2" %}
|
||||||
{% block body %}
|
{% block header %}
|
||||||
|
<form action="{{ url_for('.subscribe') }}" method="POST">
|
||||||
<form action="{{ url_for('.subscribe') }}" method="POST">
|
|
||||||
<input type="text" id="origin" name="origin" placeholder="Feed URL" />
|
<input type="text" id="origin" name="origin" placeholder="Feed URL" />
|
||||||
<button type="submit" id="subscribe">Subscribe</button>
|
<button type="submit" id="subscribe">Subscribe</button>
|
||||||
</form>
|
</form>
|
||||||
|
{% endblock header %}
|
||||||
|
{% block body %}
|
||||||
|
|
||||||
|
|
||||||
{% for entry in entries %}
|
{% for entry in entries %}
|
||||||
<article>
|
<article>
|
||||||
|
@ -25,9 +27,8 @@
|
||||||
{{ entry.content_cleaned() }}
|
{{ entry.content_cleaned() }}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div>
|
<footer>
|
||||||
<a href="{{ entry.permalink }}">{{ entry.published }}</a>
|
<a href="{{ entry.permalink }}">{{ entry.published }}</a>
|
||||||
</div>
|
|
||||||
|
|
||||||
<form action="{{ current_user.micropub_endpoint }}" method="POST">
|
<form action="{{ current_user.micropub_endpoint }}" method="POST">
|
||||||
<input type="hidden" name="access_token" value="{{current_user.access_token}}"/>
|
<input type="hidden" name="access_token" value="{{current_user.access_token}}"/>
|
||||||
|
@ -36,6 +37,8 @@
|
||||||
<button type="submit">Like</button>
|
<button type="submit">Like</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
</footer>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
<form action="{{ current_user.micropub_endpoint }}" method="POST">
|
<form action="{{ current_user.micropub_endpoint }}" method="POST">
|
||||||
<input type="hidden" name="access_token" value="{{current_user.access_token}}"/>
|
<input type="hidden" name="access_token" value="{{current_user.access_token}}"/>
|
||||||
|
@ -48,4 +51,6 @@
|
||||||
|
|
||||||
</article>
|
</article>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
<a href="{{ url_for(request.endpoint, page=page+1)}}">Older</a>
|
||||||
{% endblock body %}
|
{% endblock body %}
|
||||||
|
|
|
@ -15,14 +15,17 @@ ui = flask.Blueprint('ui', __name__)
|
||||||
|
|
||||||
@ui.route('/')
|
@ui.route('/')
|
||||||
def index():
|
def index():
|
||||||
|
page = int(flask.request.args.get('page', 1))
|
||||||
if flask_login.current_user.is_authenticated():
|
if flask_login.current_user.is_authenticated():
|
||||||
feed_ids = [f.id for f in flask_login.current_user.feeds]
|
per_page = flask.current_app.config.get('PER_PAGE', 30)
|
||||||
entries = Entry.query.filter(
|
offset = (page - 1) * per_page
|
||||||
Entry.feed_id.in_(feed_ids)).order_by(
|
feed_ids = set(f.id for f in flask_login.current_user.feeds)
|
||||||
Entry.published.desc()).limit(100).all()
|
entries = Entry.query.filter(Entry.feed_id.in_(feed_ids))\
|
||||||
|
.order_by(Entry.published.desc())\
|
||||||
|
.offset(offset).limit(per_page).all()
|
||||||
else:
|
else:
|
||||||
entries = []
|
entries = []
|
||||||
return flask.render_template('feed.jinja2', entries=entries)
|
return flask.render_template('feed.jinja2', entries=entries, page=page)
|
||||||
|
|
||||||
|
|
||||||
@ui.route('/install')
|
@ui.route('/install')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue