diff --git a/smash/__init__.py b/smash/__init__.py
index 3d9a9b1..85d19dd 100644
--- a/smash/__init__.py
+++ b/smash/__init__.py
@@ -1,6 +1,6 @@
import os
from flask import Flask, g
-from flask.ext.sqlalchemy import SQLAlchemy
+from flask_sqlalchemy import SQLAlchemy
from . import config, log
diff --git a/smash/static/css/custom.css b/smash/static/css/custom.css
index ef5e9c9..f66abef 100644
--- a/smash/static/css/custom.css
+++ b/smash/static/css/custom.css
@@ -96,14 +96,26 @@ html, body {
}
.quote-link {
- color: #03A9F4;
+ color: #424242;
font-weight: bold;
+ padding-left: 8px;
}
.quote {
font-family: 'Inconsolata', monospace;
}
+.quote-header {
+ background-color: #b3e5fc;
+ border-bottom: 1px solid;
+ border-color: #4fc3f7;
+ margin-bottom: 2px;
+}
+
+.quote-date {
+ padding-right: 8px;
+}
+
.rate-positive {
color: #4caf50;
}
@@ -134,3 +146,8 @@ html, body {
.badge {
background-color: #03A9F4;
}
+
+.btn-mod {
+ padding: 2px 8px;
+ border-radius: 0px;
+}
diff --git a/smash/templates/latest.html b/smash/templates/latest.html
index eb15d24..7549ede 100644
--- a/smash/templates/latest.html
+++ b/smash/templates/latest.html
@@ -3,8 +3,21 @@
{% if quotes %}
{% for quote in quotes %}
-#{{ quote.id }}
-+ ({{quote.rating}}) -
+
+
+{% if session.authorized %}
+
+{% endif %}
+
@@ -12,9 +25,13 @@
{% endfor %}
diff --git a/smash/templates/queue.html b/smash/templates/queue.html
index 924b1d2..d45a8a8 100644
--- a/smash/templates/queue.html
+++ b/smash/templates/queue.html
@@ -4,19 +4,21 @@
{% if quotes %}
{% for quote in quotes %}
#{{ quote.id }}
-+ ({{quote.rating}}) -
-
-
{{ quote.content|safe }}
-
++ ({{quote.rating}}) -
+
+
{{ quote.content|safe }}
+
+
+
Tags:
diff --git a/smash/views.py b/smash/views.py
index 9c886ba..39f6cce 100644
--- a/smash/views.py
+++ b/smash/views.py
@@ -13,6 +13,14 @@ def timestamp():
return datetime.datetime.now().strftime("%H:%M:%S %d/%m/%y")
+def message(level, msg):
+ return render_template(
+ "message.html",
+ alertclass=level,
+ message=msg
+ )
+
+
@app.before_request
def before_request():
g.appname = conf.config['APPNAME']
@@ -62,21 +70,13 @@ def latest():
quotes=quotes
)
else:
- return render_template(
- "message.html",
- alertclass="alert-warning",
- message="No quotes in the database. "
- )
+ return message("alert-warning", "No quotes in the database.")
@app.route('/queue')
def queue():
if not session.get('authorized'):
- return render_template(
- "message.html",
- alertclass="alert-danger",
- message="You are not authorized to view this page."
- )
+ return message("alert-danger", "You are not authorized to view this page.")
quotes = Quote.query.filter_by(approved=False).order_by(Quote.id).all()
@@ -91,43 +91,27 @@ def queue():
quotes=quotes
)
else:
- return render_template(
- "message.html",
- alertclass="alert-warning",
- message="No quotes in the database. "
- )
+ return message("alert-warning", "No quotes in the database.")
@app.route('/moderate', methods=['POST'])
def moderate():
if not session.get('authorized'):
- return render_template(
- "message.html",
- alertclass="alert-danger",
- message="You are not authorized to perform this action."
- )
-
+ return message("alert-danger", "You are not authorized to perform this action.")
if request.form['submit'] == "Approve":
quote = Quote.query.filter_by(id=request.form['quoteid']).first()
quote.approved = True
db.session.commit()
- return render_template(
- "message.html",
- alertclass="alert-success",
- message="Quote approved."
- )
+ return message("alert-success", "Quote approved.")
+
elif request.form['submit'] == "Delete":
quote = Quote.query.filter_by(id=request.form['quoteid']).first()
db.session.delete(quote)
db.session.commit()
- return render_template(
- "message.html",
- alertclass="alert-success",
- message="Quote deleted."
- )
+ return message("alert-success", "Quote deleted.")
abort(501)