Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Cleaning up template layout

  • Loading branch information...
commit e7bbed45e7456cb256e2cc3d6fb0fc01627b5dc2 1 parent 13bfc12
@mayhem authored
View
1  .gitignore
@@ -1,2 +1,3 @@
feedback.db
*.pyc
+*.swp
View
4 feedback/static/feedback.css
@@ -16,8 +16,8 @@ body a{
margin-bottom: 12px;
}
.flashes {
- margin-right: 20%;
- margin-left: 20%;
+ margin: 0 20% 0 20%;
+ padding-botton: 5px;
background-color: #fdd;
border-radius: 1em;
}
View
16 feedback/templates/issue/delete
@@ -0,0 +1,16 @@
+{% extends 'layout' %}
+{% block body %}
+<div class="container">
+ <div class="row-fluid">
+ <div class="span2 issue_title">issue</div>
+ <div class="span8 issue_text">
+ <p>Are you sure you want to delete issue {{ issue.id }} "{{ issue.title }}"?</p>
+ <form method="POST" action="/issue/{{ issue.id }}/delete">
+ <a href="/">cancel</a>
+ <button type="submit">yes, delete this issue</button>
+ </form>
+ </div>
+ <div class="span2">&nbsp;</div>
+ </div>
+<div>
+{% endblock %}
View
0  feedback/templates/issue → feedback/templates/issue/main
File renamed without changes
View
19 feedback/view/issue.py
@@ -5,6 +5,8 @@
from feedback.feedback import db
from flaskext.login import current_user
+# TODO: Catch database errors
+
@app.route('/issue/create', methods=['GET', 'POST'])
def create_issue():
return edit_issue(0)
@@ -39,11 +41,22 @@ def edit_issue(id):
form.tickets.data = issue.tickets
form.user_id.data = issue.user_id
form.title.data = issue.title
- return render_template("issue", form=form, title="Feedback: Edit issue", action="edit")
+ return render_template("issue/main", form=form, title="Feedback: Edit issue", action="edit")
- return render_template("issue", form=form, title="Feedback: Create 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()
- return render_template("issue", issue=issue, title="Feedback: issue %s" % issue.title, action="view")
+ 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 request.method == 'POST':
+ db.session.delete(issue)
+ db.session.commit()
+ flash("issue %d deleted" % id)
+ return redirect(url_for('index'))
+
+ return render_template("issue/delete", title="Feedback: Delete issue", issue=issue)
Please sign in to comment.
Something went wrong with that request. Please try again.