From f9f2d55359ddbdd7e72c8a873a02fbebf10bfa78 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Nov 13 2017 15:32:35 +0000 Subject: Add a modal at the bottom of the issues list to add milestones With this, from the list of issues one can now directly add milestones (if they are admin of course). This will then redirect them back to the first page of the issue list. Fixes #2472 Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/templates/issues.html b/pagure/templates/issues.html index b8c5841..c7924b1 100644 --- a/pagure/templates/issues.html +++ b/pagure/templates/issues.html @@ -328,6 +328,10 @@ data-toggle="modal" data-target="#report_modal"> Save report + + {% endif %} {{ pagination_link('page', g.page, total_page) }} @@ -394,7 +416,13 @@ $(document).ready(function() { _b.hide(); _s.hide(); } + }); + $('.extend-form').click(function(e) { + const tgt = $(this).attr('data-target'); + let form = $(tgt + ' > div:last-child').clone(); + form.find('input[type=text], textarea').val(''); + $(tgt).append(form); }); }); diff --git a/pagure/templates/settings.html b/pagure/templates/settings.html index 4b0b569..af0d74e 100644 --- a/pagure/templates/settings.html +++ b/pagure/templates/settings.html @@ -709,67 +709,7 @@
-
-
- Roadmap -
-
-

- Each issue can be assigned to a milestone. This way it is - possible to create a roadmap for your project. Below you can create - the milestones and optionally set dates for them. -

-
-
- {{ tag_form.csrf_token }} -
-
-
- Milestone -
-
- Date (optional) -
-
-
- {% for milestone in repo.milestones or [""] | sort %} -
-
- -
-
- -
-
- {% endfor %} -
- -
-
- -
-
-
-
-
+ {% include 'settings_milestones.html' %}
diff --git a/pagure/templates/settings_milestones.html b/pagure/templates/settings_milestones.html new file mode 100644 index 0000000..2e3e8f7 --- /dev/null +++ b/pagure/templates/settings_milestones.html @@ -0,0 +1,63 @@ + + +
+
+ Roadmap +
+
+

+ Each issue can be assigned to a milestone. This way it is + possible to create a roadmap for your project. Below you can create + the milestones and optionally set dates for them. +

+
+
+ {{ tag_form.csrf_token }} +
+
+
+ Milestone +
+
+ Date (optional) +
+
+
+ {% for milestone in repo.milestones or [""] | sort %} +
+
+ +
+
+ +
+
+ {% endfor %} +
+ +
+
+ +
+
+
+
+
diff --git a/pagure/ui/repo.py b/pagure/ui/repo.py index 0329cdb..fe211ba 100644 --- a/pagure/ui/repo.py +++ b/pagure/ui/repo.py @@ -1373,6 +1373,7 @@ def update_milestones(repo, username=None, namespace=None): error = False if form.validate_on_submit(): + redirect = flask.request.args.get('from') milestones = [ w.strip() for w in flask.request.form.getlist('milestones') ] @@ -1422,6 +1423,11 @@ def update_milestones(repo, username=None, namespace=None): SESSION.rollback() flask.flash(str(err), 'error') + if redirect == 'issues': + return flask.redirect(flask.url_for( + 'view_issues', username=username, repo=repo.name, + namespace=namespace)) + return flask.redirect(flask.url_for( 'view_settings', username=username, repo=repo.name, namespace=namespace))