allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject allura git commit: [#6353] allow all standard ticket fields (incl. private) to be specified in URL for new tickets
Date Wed, 25 Apr 2018 16:49:49 GMT
Repository: allura
Updated Branches:
  refs/heads/db/6353 [created] fc13e8104


[#6353] allow all standard ticket fields (incl. private) to be specified in URL for new tickets

Custom fields would need extra work to get working.


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/fc13e810
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/fc13e810
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/fc13e810

Branch: refs/heads/db/6353
Commit: fc13e8104165afd439b8a8b5732155e85e35c21f
Parents: 911d1ba
Author: Dave Brondsema <dave@brondsema.net>
Authored: Wed Apr 25 12:49:22 2018 -0400
Committer: Dave Brondsema <dave@brondsema.net>
Committed: Wed Apr 25 12:49:22 2018 -0400

----------------------------------------------------------------------
 .../forgetracker/templates/tracker/new_ticket.html      |  3 +--
 ForgeTracker/forgetracker/tests/functional/test_root.py | 12 ++++++++++++
 ForgeTracker/forgetracker/tracker_main.py               |  6 ++----
 3 files changed, 15 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/fc13e810/ForgeTracker/forgetracker/templates/tracker/new_ticket.html
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/templates/tracker/new_ticket.html b/ForgeTracker/forgetracker/templates/tracker/new_ticket.html
index 24141a4..e586a1c 100644
--- a/ForgeTracker/forgetracker/templates/tracker/new_ticket.html
+++ b/ForgeTracker/forgetracker/templates/tracker/new_ticket.html
@@ -25,8 +25,7 @@
 {% block edit_box %}
 <div class="editbox">
   <div class="form_holder">
-      {{c.ticket_form.display(action=action, value=dict(description=description,
-                              summary=summary, labels=labels), help_msg=help_msg)}}
+      {{c.ticket_form.display(action=action, value=url_params, help_msg=help_msg)}}
   </div>
 </div>
 {% endblock %}

http://git-wip-us.apache.org/repos/asf/allura/blob/fc13e810/ForgeTracker/forgetracker/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tests/functional/test_root.py b/ForgeTracker/forgetracker/tests/functional/test_root.py
index 5f0fb1c..db51573 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -364,6 +364,18 @@ class TestFunctionalController(TrackerTestController):
         assert 'test new ticket form' in response
         assert 'test new ticket form description' in response
 
+    def test_new_ticket_prepop_from_url(self):
+        response = self.app.get('/bugs/new/?summary=very buggy&description=descr&labels=label1,label2&private=true'
+                                '&assigned_to=test-user&_milestone=2.0&status=pending')
+        form = self._find_new_ticket_form(response)
+        assert_equal(form['ticket_form.summary'].value, 'very buggy')
+        assert_equal(form['ticket_form.description'].value, 'descr')
+        assert_equal(form['ticket_form.labels'].value, 'label1,label2')
+        assert_equal(form['ticket_form.assigned_to'].value, 'test-user')
+        assert_equal(form['ticket_form._milestone'].value, '2.0')
+        assert_equal(form['ticket_form.status'].value, 'pending')
+        assert_equal(form['ticket_form.private'].checked, True)
+
     def test_mass_edit(self):
         self.new_ticket(summary='First Ticket').follow()
         self.new_ticket(summary='Second Ticket').follow()

http://git-wip-us.apache.org/repos/asf/allura/blob/fc13e810/ForgeTracker/forgetracker/tracker_main.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tracker_main.py b/ForgeTracker/forgetracker/tracker_main.py
index 869eae7..2ed6b2c 100644
--- a/ForgeTracker/forgetracker/tracker_main.py
+++ b/ForgeTracker/forgetracker/tracker_main.py
@@ -897,14 +897,12 @@ class RootController(BaseController, FeedController):
 
     @with_trailing_slash
     @expose('jinja:forgetracker:templates/tracker/new_ticket.html')
-    def new(self, description=None, summary=None, labels=None, **kw):
+    def new(self, **kw):
         require_access(c.app, 'create')
         self.rate_limit(TM.Ticket, 'Ticket creation', redir='..')
         c.ticket_form = W.ticket_form
         help_msg = c.app.config.options.get('TicketHelpNew', '').strip()
-        return dict(action=c.app.config.url() + 'save_ticket',
-                    help_msg=help_msg,
-                    description=description, summary=summary, labels=labels)
+        return dict(action=c.app.config.url() + 'save_ticket', help_msg=help_msg, url_params=kw)
 
     @expose('jinja:allura:templates/markdown_syntax.html')
     def markdown_syntax(self, **kw):


Mime
View raw message