Add functional previews, change line endings to Unix. Fixes #2
This commit is contained in:
parent
601a45c8ae
commit
29151553cc
2 changed files with 322 additions and 308 deletions
|
@ -17,11 +17,13 @@
|
||||||
{% for quote in quotes %}
|
{% for quote in quotes %}
|
||||||
{% if quote.approved %}
|
{% if quote.approved %}
|
||||||
<div class="quote-header">
|
<div class="quote-header">
|
||||||
|
{% if quote.id %}
|
||||||
<a class="quote-link" href="/quote/{{ quote.id }}">#{{ quote.id }}</a>
|
<a class="quote-link" href="/quote/{{ quote.id }}">#{{ quote.id }}</a>
|
||||||
|
{% endif %}
|
||||||
<a class="rate-positive">+</a> ({{quote.rating}}) <a class="rate-negative">-</a>
|
<a class="rate-positive">+</a> ({{quote.rating}}) <a class="rate-negative">-</a>
|
||||||
<div class="pull-right quote-date">{{ quote.time }}</div>
|
<div class="pull-right quote-date">{{ quote.time }}</div>
|
||||||
|
|
||||||
{% if session.authorized %}
|
{% if session.authorized and quote.id %}
|
||||||
<form class="mod-form" action="/moderate" name="moderate" method="post">
|
<form class="mod-form" action="/moderate" name="moderate" method="post">
|
||||||
<input type="hidden" name="quoteid" value={{quote.id}} />
|
<input type="hidden" name="quoteid" value={{quote.id}} />
|
||||||
<button type="submit" name="submit" class="btn btn-danger btn-sm btn-mod" value="Delete">Delete</button>
|
<button type="submit" name="submit" class="btn btn-danger btn-sm btn-mod" value="Delete">Delete</button>
|
||||||
|
|
|
@ -258,7 +258,19 @@ def add_new():
|
||||||
)
|
)
|
||||||
|
|
||||||
elif request.form['submit'] == "Preview":
|
elif request.form['submit'] == "Preview":
|
||||||
return str(request.form)
|
preview = Quote(request.form['newquote'], request.remote_addr, timestamp())
|
||||||
|
preview_tags = request.form["tags"].split(',')
|
||||||
|
preview.approved = True
|
||||||
|
preview.tags = [Tag(tag) for tag in preview_tags]
|
||||||
|
|
||||||
|
return render_template(
|
||||||
|
"latest.html",
|
||||||
|
title="Quote preview",
|
||||||
|
quotes=[preview,],
|
||||||
|
numpages=1,
|
||||||
|
curpage=0,
|
||||||
|
page_type="quote"
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
abort(501)
|
abort(501)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue