[copr] master: Style editing, make it use the detail template as a parent (924c673)
bkabrda at fedoraproject.org
bkabrda at fedoraproject.org
Mon Jan 21 11:12:53 UTC 2013
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 924c673217de8cffe11650e661f5b01e7db0ef09
Author: Bohuslav Kabrda <bkabrda at redhat.com>
Date: Mon Jan 21 08:38:44 2013 +0100
Style editing, make it use the detail template as a parent
>---------------------------------------------------------------
.../coprs/templates/coprs/{ => detail}/edit.html | 5 ++---
.../coprs/views/coprs_ns/coprs_general.py | 9 +++++----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/coprs_frontend/coprs/templates/coprs/edit.html b/coprs_frontend/coprs/templates/coprs/detail/edit.html
similarity index 80%
rename from coprs_frontend/coprs/templates/coprs/edit.html
rename to coprs_frontend/coprs/templates/coprs/detail/edit.html
index 0eff4c9..8068435 100644
--- a/coprs_frontend/coprs/templates/coprs/edit.html
+++ b/coprs_frontend/coprs/templates/coprs/detail/edit.html
@@ -1,11 +1,10 @@
-{% extends "layout.html" %}
+{% extends "coprs/detail.html" %}
{% block title %}Editing {{ copr.name }}{% endblock %}
{% block header %}Editing {{ copr.name }} Copr{% endblock %}
{% from "coprs/_coprs_forms.html" import copr_form, copr_permissions_form with context %}
-{% block body %}
+{% block detail_body %}
- <h2>{{ copr.name }}</h2>
{{ copr_form(form, view = 'coprs_ns.copr_update', copr = copr) }}
{% endblock %}
diff --git a/coprs_frontend/coprs/views/coprs_ns/coprs_general.py b/coprs_frontend/coprs/views/coprs_ns/coprs_general.py
index 027845b..c9c3838 100644
--- a/coprs_frontend/coprs/views/coprs_ns/coprs_general.py
+++ b/coprs_frontend/coprs/views/coprs_ns/coprs_general.py
@@ -140,15 +140,16 @@ def copr_builds(username, coprname, build_form = None):
@coprs_ns.route('/detail/<username>/<coprname>/edit/')
@login_required
-def copr_edit(username, coprname):
+def copr_edit(username, coprname, form=None):
query = coprs_logic.CoprsLogic.get(flask.g.user, username, coprname)
copr = query.first()
if not copr:
return page_not_found('Copr with name {0} does not exist.'.format(coprname))
- form = forms.CoprFormFactory.create_form_cls(copr.mock_chroots)(obj=copr)
+ if not form:
+ form = forms.CoprFormFactory.create_form_cls(copr.mock_chroots)(obj=copr)
- return flask.render_template('coprs/edit.html',
+ return flask.render_template('coprs/detail/edit.html',
copr=copr,
form=form)
@@ -174,7 +175,7 @@ def copr_update(username, coprname):
flask.flash('Copr was updated successfully.')
return flask.redirect(flask.url_for('coprs_ns.copr_detail', username = username, coprname = form.name.data))
else:
- return flask.render_template('coprs/edit.html', copr = copr, form = form)
+ return copr_edit(username, coprname, form)
@coprs_ns.route('/detail/<username>/<coprname>/permissions_applier_change/', methods = ['POST'])
More information about the copr-devel
mailing list