[copr] master: Enable marking legal flags as resolved (761921f)

bkabrda at fedoraproject.org bkabrda at fedoraproject.org
Tue Apr 2 13:24:16 UTC 2013


Repository : http://git.fedorahosted.org/cgit/copr.git

On branch  : master

>---------------------------------------------------------------

commit 761921f2f026c9991da659bc325e0892771089d1
Author: Bohuslav Kabrda <bkabrda at redhat.com>
Date:   Tue Apr 2 15:23:45 2013 +0200

    Enable marking legal flags as resolved


>---------------------------------------------------------------

 coprs_frontend/coprs/static/copr.css               |    6 ++++++
 .../coprs/templates/admin/legal-flag.html          |    6 +++++-
 .../coprs/views/admin_ns/admin_general.py          |   12 ++++++++++++
 3 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/coprs_frontend/coprs/static/copr.css b/coprs_frontend/coprs/static/copr.css
index a1fa40e..dcc68d0 100644
--- a/coprs_frontend/coprs/static/copr.css
+++ b/coprs_frontend/coprs/static/copr.css
@@ -328,6 +328,12 @@ div.legal-flag div.message {
   font-size: 1em;
 }
 
+div.legal-flag form {
+  display: inline;
+  text-align: right;
+  float: right;
+}
+
 hr {
   margin-top: 25px;
   margin-bottom: 25px;
diff --git a/coprs_frontend/coprs/templates/admin/legal-flag.html b/coprs_frontend/coprs/templates/admin/legal-flag.html
index f7252c2..4cce6e5 100644
--- a/coprs_frontend/coprs/templates/admin/legal-flag.html
+++ b/coprs_frontend/coprs/templates/admin/legal-flag.html
@@ -15,11 +15,15 @@
         {% else %}
           {{ flag.old_value }} - copr was deleted
         {% endif %}
-        | <a href="">Resolve</a>
+	<form method="post" action="{{ url_for('admin_ns.legal_flag_resolve', action_id=flag.id) }}">
+            <input type="submit" value="Resolve">
+          </form>
       </div>
       <div class="message">
         {{ flag.message }}
       </div>
     </div>
+  {% else %}
+    <h2>No coprs marked for legal review</h2>
   {% endfor %}
 {% endblock %}
diff --git a/coprs_frontend/coprs/views/admin_ns/admin_general.py b/coprs_frontend/coprs/views/admin_ns/admin_general.py
index c1b6146..d094b36 100644
--- a/coprs_frontend/coprs/views/admin_ns/admin_general.py
+++ b/coprs_frontend/coprs/views/admin_ns/admin_general.py
@@ -1,5 +1,8 @@
+import time
+
 import flask
 
+from coprs import db
 from coprs import helpers
 from coprs import models
 
@@ -33,3 +36,12 @@ def legal_flag():
 
     return flask.render_template('admin/legal-flag.html',
                                  legal_flags=legal_flags)
+
+ at admin_ns.route('/legal-flag/<int:action_id>/resolve/', methods=['POST'])
+ at login_required(role=helpers.RoleEnum('admin'))
+def legal_flag_resolve(action_id):
+    action = models.Action.query.filter(models.Action.id==action_id).\
+                                 update({'ended_on': int(time.time())})
+    db.session.commit()
+    flask.flash('Legal flag resolved')
+    return flask.redirect(flask.url_for('admin_ns.legal_flag'))



More information about the copr-devel mailing list