Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Made the issues table not look like ass.

  • Loading branch information...
commit 043b9b7c14fb8a71a70708462f80f650abb3d9fc 1 parent 04b975b
@mayhem authored
View
0  feedback/misc/__init__.py
No changes.
View
18 feedback/misc/utc.py
@@ -0,0 +1,18 @@
+from datetime import tzinfo, timedelta, datetime
+
+ZERO = timedelta(0)
+HOUR = timedelta(hours=1)
+
+# A UTC class.
+
+class UTC(tzinfo):
+ """UTC"""
+
+ def utcoffset(self, dt):
+ return ZERO
+
+ def tzname(self, dt):
+ return "UTC"
+
+ def dst(self, dt):
+ return ZERO
View
9 feedback/model/issue.py
@@ -1,7 +1,8 @@
# -*- coding: utf-8 -*-
-from datetime import datetime
+from datetime import datetime, timedelta
from flaskext.sqlalchemy import SQLAlchemy
from feedback.feedback import db
+from feedback.misc.utc import UTC
from feedback.model import user
class Issue(db.Model):
@@ -17,7 +18,11 @@ class Issue(db.Model):
def __init__(self):
self.is_open = True
- self.created = datetime.now()
+ self.created = datetime.utcnow()
+
+ def expires(self):
+ expires = self.created + timedelta(14)
+ return expires.strftime("%Y-%m-%d %H:%M utc")
def __repr__(self):
return '<Issue %d>' % self.id
View
10 feedback/static/feedback.css
@@ -0,0 +1,10 @@
+body{
+ font-size: 12pt;
+}
+body a{
+ font-size: 12pt;
+}
+.issues_table {
+ width: 100%;
+ margin-top: 20px;
+}
View
38 feedback/templates/index
@@ -1,17 +1,29 @@
{% extends 'layout' %}
{% block body %}
-<table>
-{% for issue in issues %}
- <tr>
- <td>{{ issue.id }}</td>
- <td>{{ issue.title }}</td>
- <td>{{ issue.tickets }} </td>
- <td>{{ issue.created }} </td>
- </tr>
-{% else %}
- <p>There are no issues to be decided.</p>
-{% endfor %}
-</table>
-<p><a href="issue/create">Create a new issue</a></p>
+<div class="container-fluid">
+ <div class="row-fluid">
+ <div class="span2">&nbsp;</div>
+ <div class="span8">
+ <p><a href="issue/create">Create a new issue</a></p>
+ <table class="issues_table table">
+ <thead>
+ <th>id</th>
+ <th>title</th>
+ <th>expires</th>
+ </thead>
+ {% for issue in issues %}
+ <tr>
+ <td>{{ issue.id }}</td>
+ <td><a href="/issue/{{ issue.id }}">{{ issue.title }}</a></td>
+ <td>{{ issue.expires() }} </td>
+ </tr>
+ {% else %}
+ <p>There are no issues to be decided.</p>
+ {% endfor %}
+ </table>
+ </div>
+ <div class="span2">&nbsp;</div>
+ </div>
+</div>
{% endblock %}
View
14 feedback/templates/issue/view
@@ -0,0 +1,14 @@
+{% extends 'layout' %}
+{% block body %}
+<div class="container">
+ <div class="row-fluid">
+ <div class="span2">&nbsp;</div>
+ <div class="span8 " style="background: #eee">
+ {{ render_field(form.title) }}
+ {{ render_field(form.description) }}
+ {{ render_field(form.tickets) }}
+ </div>
+ <div class="span2">&nbsp;</div>
+ </div>
+<div>
+{% endblock %}
View
1  feedback/templates/layout
@@ -5,6 +5,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='bootstrap.css') }}">
+ <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='feedback.css') }}">
<style type="text/css">
body {
padding-top: 60px;
View
7 feedback/view/issue.py
@@ -12,6 +12,7 @@ def create_issue():
id = int(request.form.get("id") or '0')
if id:
issue = Issue.query.filter_by(id=int(id)).first()
+ issue.title = form.title.data
issue.description = form.description.data
issue.tickets = form.tickets.data
else:
@@ -19,6 +20,7 @@ def create_issue():
issue.description = form.description.data
issue.tickets = form.tickets.data
issue.user_id = current_user.id
+ issue.title = form.title.data
db.session.add(issue)
db.session.commit()
@@ -26,3 +28,8 @@ def create_issue():
flash("Issue created.")
return redirect(url_for('create_issue'))
return render_template("issue/create", form=form, title="Feedback: Create issue")
+
+@app.route('/issue/<int:id>')
+def view_issue(id):
+ issue = Issue.query.filter_by(id=int(id)).first()
+ return render_template("issue/view", issue=issue, title="Feedback: issue %s" % issue.title)

0 comments on commit 043b9b7

Please sign in to comment.
Something went wrong with that request. Please try again.