You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bloodhound.apache.org by da...@apache.org on 2016/10/09 13:31:27 UTC

svn commit: r1763978 - in /bloodhound/branches/bep_0011_batch_create_tickets/bloodhound_theme/bhtheme: htdocs/js/batchcreate.js theme.py

Author: dammina
Date: Sun Oct  9 13:31:26 2016
New Revision: 1763978

URL: http://svn.apache.org/viewvc?rev=1763978&view=rev
Log:
add product information to the tabular view

Modified:
    bloodhound/branches/bep_0011_batch_create_tickets/bloodhound_theme/bhtheme/htdocs/js/batchcreate.js
    bloodhound/branches/bep_0011_batch_create_tickets/bloodhound_theme/bhtheme/theme.py

Modified: bloodhound/branches/bep_0011_batch_create_tickets/bloodhound_theme/bhtheme/htdocs/js/batchcreate.js
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0011_batch_create_tickets/bloodhound_theme/bhtheme/htdocs/js/batchcreate.js?rev=1763978&r1=1763977&r2=1763978&view=diff
==============================================================================
--- bloodhound/branches/bep_0011_batch_create_tickets/bloodhound_theme/bhtheme/htdocs/js/batchcreate.js (original)
+++ bloodhound/branches/bep_0011_batch_create_tickets/bloodhound_theme/bhtheme/htdocs/js/batchcreate.js Sun Oct  9 13:31:26 2016
@@ -22,14 +22,13 @@
  The wiki macro will send the relevant details to create the empty ticket table within the wiki.
  Then this function will generate the empty ticket table containing appropriate number of rows to enter ticket data.
  */
-function emptyTable(numOfRows, products, milestones, components, href, token, unique_key) {
+function emptyTable(numOfRows, product, milestones, components, href, token, unique_key) {
 
   var created_rows = numOfRows;
   var form_token = token.split(";")[0].split("=")[1];
-  href = href + "/bct";
 
   var headers = {
-    "ticket": "", "summary": "Summary", "description": "Description", "product": "Product",
+    "ticket": "", "summary": "Summary", "description": "Description",
     "priority": "Priority", "milestone": "Milestone", "component": "Component"
   };
   var priorities = ["blocker", "critical", "major", "minor", "trivial"];
@@ -139,21 +138,6 @@ function emptyTable(numOfRows, products,
           }).html(priorities[priority]).appendTo(input_priority);
         }
 
-      } else if (header == "product") {
-
-        td = $('<td>').appendTo(tr_rows);
-        var field_product = $('<select/>', {
-          'id': 'field-product' + unique_key + '-' + i,
-          'name': 'field_product' + i,
-          'class': 'product'
-        }).appendTo(td);
-
-        for (var product in products) {
-          $('<option/>', {
-            'value': (products[product])[0]
-          }).html((products[product])[1]).appendTo(field_product);
-        }
-
       } else if (header == "milestone") {
 
         td = $('<td>').appendTo(tr_rows);
@@ -274,9 +258,9 @@ function submit_btn_action(unique_key) {
 
       var div = $('<div/>').appendTo(contentDiv);
 
-      var h5 = $('<h5/>', {
-        'class': 'span12'
-      }).html("Created Tickets").appendTo(div);
+      $('<div/>', {
+        'class': 'numrows'
+      }).html('(' + ticket.tickets.length + ' total rows.)').appendTo(div);
 
       var table = $('<table/>', {
         'class': 'table table-condensed tickets'
@@ -291,15 +275,19 @@ function submit_btn_action(unique_key) {
 
       for (var json_ticket in ticket.tickets) {
         var tr = $('<tr/>').appendTo(table);
-        var tkt = JSON.parse(json_ticket);
+        var tkt = JSON.parse(ticket.tickets[json_ticket]);
         for (var j = 0; j < 6; j++) {
           var td = $('<td/>').appendTo(tr);
-          if (j < 2) {
+          if (j == 0) {
+            if (json_ticket == 0) {
+             td.html(tkt.product)
+            }
+          } else if (j < 3) {
             $('<a/>', {
               'href': tkt.url
-            }).html(j == 0 ? '#' + tkt.id : tkt.summary).appendTo(td);
+            }).html(j == 1 ? "#" + tkt.id : tkt.summary).appendTo(td);
           } else {
-            td.html(j == 2 ? tkt.product : (j == 3 ? tkt.status : (j == 4 ? tkt.milestone : tkt.component)));
+            td.html(j == 3 ? tkt.status : (j == 4 ? tkt.milestone : tkt.component))
           }
         }
       }
@@ -413,7 +401,7 @@ function remove_row_btn_action(numOfRows
 function display_created_tickets(tickets, unique_key) {
 
   var headers = {
-    "ticket": "Ticket", "summary": "Summary", "product": "Product", "status": "Status",
+    "product": "", "ticket": "Ticket", "summary": "Summary", "status": "Status",
     "milestone": "Milestone", "component": "Component"
   };
 
@@ -441,14 +429,16 @@ function display_created_tickets(tickets
 
     for (var j = 0; j < 6; j++) {
       var td = $('<td/>');
-      if (j < 2) {
-
+      if (j == 0) {
+        if (index == 0) {
+          td.html(tkt.product)
+        }
+      } else if (j < 3) {
         $('<a/>', {
           'href': tkt.url
-        }).html(j == 0 ? "#" + tkt.id : tkt.summary).appendTo(td);
-      }
-      else {
-        td.html(j == 2 ? tkt.product : (j == 3 ? tkt.status : (j == 4 ? tkt.milestone : tkt.component)))
+        }).html(j == 1 ? "#" + tkt.id : tkt.summary).appendTo(td);
+      } else {
+        td.html(j == 3 ? tkt.status : (j == 4 ? tkt.milestone : tkt.component))
       }
       td.appendTo(tr)
     }

Modified: bloodhound/branches/bep_0011_batch_create_tickets/bloodhound_theme/bhtheme/theme.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0011_batch_create_tickets/bloodhound_theme/bhtheme/theme.py?rev=1763978&r1=1763977&r2=1763978&view=diff
==============================================================================
--- bloodhound/branches/bep_0011_batch_create_tickets/bloodhound_theme/bhtheme/theme.py (original)
+++ bloodhound/branches/bep_0011_batch_create_tickets/bloodhound_theme/bhtheme/theme.py Sun Oct  9 13:31:26 2016
@@ -771,8 +771,6 @@ class BatchCreateTicketsMacro(WikiMacroB
             # generate the required data to be parsed to the js functions too create the empty ticket table.
 
             product_id = str(self.env.product.resource.id)
-            product_name = self.env.db_query(
-                "SELECT * FROM bloodhound_product WHERE prefix=%s", (product_id,))
             milestones = self.env.db_query(
                 "SELECT * FROM milestone WHERE product=%s", (product_id,))
             components = self.env.db_query(
@@ -788,9 +786,9 @@ class BatchCreateTicketsMacro(WikiMacroB
                             src=str(self.rqst.href.chrome('theme/js/batchcreate.js'))),
                         tag.script(
                             # pass the relevant arguments to the js function as JSON parameters.
-                            "emptyTable(" + to_json(str(self.rows)) + "," + to_json(product_name) + "," +
+                            "emptyTable(" + to_json(str(self.rows)) + "," + to_json(self.env.product._data['name']) + "," +
                             to_json(milestones) + "," + to_json(components) + "," +
-                            to_json(self.rqst.href()) + "," +
+                            to_json(self.rqst.href() + "/bct") + "," +
                             to_json(str(self.rqst.environ["HTTP_COOKIE"])) + "," +
                             to_json(random_string) + ")",
                             id="js-caller" + random_string,
@@ -983,7 +981,7 @@ class BatchCreateTicketsMacro(WikiMacroB
     def batch_create(self, req, attributes={}, notify=False):
         """ Create batch of tickets, returning created tickets.
         """
-        num_of_tkts = attributes.__len__() / 6
+        num_of_tkts = attributes.__len__() / 5
         created_tickets = []
         loop_condition = True
         i = -1
@@ -1015,7 +1013,6 @@ class BatchCreateTicketsMacro(WikiMacroB
             description = attributes.pop('description' + str(i))
             status = 'new'
             summary = attributes.pop('summary' + str(i))
-            product = attributes.pop('product' + str(i))
             priority = attributes.pop('priority' + str(i))
             milestone = attributes.pop('milestone' + str(i))
             component = attributes.pop('component' + str(i))
@@ -1027,7 +1024,7 @@ class BatchCreateTicketsMacro(WikiMacroB
             t['reporter'] = req.authname
             t['status'] = status
             t['resolution'] = ''
-            t['product'] = product
+            t['product'] = self.env.product._data['prefix']
             t['priority'] = priority
             t['milestone'] = milestone
             t['component'] = component
@@ -1136,7 +1133,7 @@ class CreatedTicketsMacro(WikiMacroBase)
                             src=str(self.rqst.href.chrome('theme/js/batchcreate.js'))),
                         tag.script(
                             'display_created_tickets(' + to_json(display_tickets_list) + ',' +
-                            to_json(random_string) + ')',
+                            to_json(random_string) + ',' + to_json(self.env.product._data['name']) + ')',
                             id='js-caller' + random_string,
                             type='text/javascript'),
                         class_='input-group-btn'),