Permalink
Browse files

Improve the styling and fix bugs around editing issues

  • Loading branch information...
mayhem committed Mar 19, 2012
1 parent e7bbed4 commit 406d2166cd93fc100e778eb51d5c0927efbe85fc
Showing with 38 additions and 4 deletions.
  1. +1 −0 feedback/form/issue.py
  2. +10 −0 feedback/static/feedback.css
  3. +3 −1 feedback/templates/index
  4. +14 −3 feedback/templates/issue/main
  5. +10 −0 feedback/view/issue.py
View
@@ -6,3 +6,4 @@ class CreateIssueForm(Form):
title = TextField('title', [validators.Length(min=0, max=128)])
description = TextAreaField('description', [validators.Length(min=0, max=16384)])
tickets = TextField('related tickets', [validators.Length(min=0, max=1024)])
+ expires = TextField('expires')
@@ -21,3 +21,13 @@ body a{
background-color: #fdd;
border-radius: 1em;
}
+.issue_form_item {
+ width: 100%;
+}
+.issue_form_textfield {
+ width: 100%;
+ height: 12em;
+}
+.lefthand_link {
+ text-align: right;
+}
View
@@ -5,7 +5,9 @@
<div class="row-fluid">
<div class="span2">&nbsp;</div>
<div class="span8">
- <p><a href="issue/create">Create a new issue</a></p>
+ <div class="lefthand_link">
+ <a href="issue/create">Create a new issue</a>
+ </div>
<table class="issues_table table">
<thead>
<th>id</th>
@@ -22,7 +22,7 @@
{% if action=='view' %}
{{ issue.title }}
{% else %}
- {{ render_field(form.title) }}
+ {{ render_field(form.title, class="issue_form_item") }}
{% endif %}
</div>
<div class="span2">&nbsp;</div>
@@ -33,7 +33,7 @@
{% if action=='view' %}
{{ issue.description }}
{% else %}
- {{ render_field(form.description) }}
+ {{ render_field(form.description, class="issue_form_textfield") }}
{% endif %}
</div>
<div class="span2">&nbsp;</div>
@@ -44,7 +44,18 @@
{% if action=='view' %}
{{ issue.tickets }}
{% else %}
- {{ render_field(form.tickets) }}
+ {{ render_field(form.tickets, class="issue_form_item") }}
+ {% endif %}
+ </div>
+ <div class="span2">&nbsp;</div>
+ </div>
+ <div class="row-fluid">
+ <div class="span2 issue_title">expires</div>
+ <div class="span8 issue_text">
+ {% if action=='view' %}
+ {{ issue.expires() }}
+ {% else %}
+ {{ form.expires.data }}
{% endif %}
</div>
<div class="span2">&nbsp;</div>
View
@@ -36,23 +36,33 @@ def edit_issue(id):
if id:
issue = Issue.query.filter_by(id=int(id)).first()
+ if not issue:
+ flash("there is no issue %d" % id)
+ return redirect(url_for('index'))
form.id.data = issue.id
form.description.data = issue.description
form.tickets.data = issue.tickets
form.user_id.data = issue.user_id
form.title.data = issue.title
+ form.expires.data = issue.expires()
return render_template("issue/main", form=form, title="Feedback: Edit issue", action="edit")
return render_template("issue/main", form=form, title="Feedback: Create issue", action="edit")
@app.route('/issue/<int:id>')
def view_issue(id):
issue = Issue.query.filter_by(id=int(id)).first()
+ if not issue:
+ flash("there is no issue %d" % id)
+ return redirect(url_for('index'))
return render_template("issue/main", issue=issue, title="Feedback: issue %s" % issue.title, action="view")
@app.route('/issue/<int:id>/delete', methods=['GET', 'POST'])
def delete_issue(id):
issue = Issue.query.filter_by(id=id).first()
+ if not issue:
+ flash("there is no issue %d" % id)
+ return redirect(url_for('index'))
if request.method == 'POST':
db.session.delete(issue)
db.session.commit()

0 comments on commit 406d216

Please sign in to comment.