[112583] users/elelay/PortsAutoComplete/portsautocomplete

elelay at macports.org elelay at macports.org
Sun Oct 27 04:06:51 PDT 2013


Revision: 112583
          https://trac.macports.org/changeset/112583
Author:   elelay at macports.org
Date:     2013-10-27 04:06:51 -0700 (Sun, 27 Oct 2013)
Log Message:
-----------
- refetch port names if no match
- enabled and working for existing tickets

Modified Paths:
--------------
    users/elelay/PortsAutoComplete/portsautocomplete/htdocs/js/autocomplete.js
    users/elelay/PortsAutoComplete/portsautocomplete/htdocs/js/autocomplete_ticket_port.js
    users/elelay/PortsAutoComplete/portsautocomplete/portsautocomplete.py

Modified: users/elelay/PortsAutoComplete/portsautocomplete/htdocs/js/autocomplete.js
===================================================================
--- users/elelay/PortsAutoComplete/portsautocomplete/htdocs/js/autocomplete.js	2013-10-27 10:32:25 UTC (rev 112582)
+++ users/elelay/PortsAutoComplete/portsautocomplete/htdocs/js/autocomplete.js	2013-10-27 11:06:51 UTC (rev 112583)
@@ -592,7 +592,10 @@
 								csub[csub.length] = x;
 							}
 						});
-						return csub;
+						if(csub.length > 0){
+							return csub;
+						}
+						/* else data will be refetched */
 					}
 				}
 			}

Modified: users/elelay/PortsAutoComplete/portsautocomplete/htdocs/js/autocomplete_ticket_port.js
===================================================================
--- users/elelay/PortsAutoComplete/portsautocomplete/htdocs/js/autocomplete_ticket_port.js	2013-10-27 10:32:25 UTC (rev 112582)
+++ users/elelay/PortsAutoComplete/portsautocomplete/htdocs/js/autocomplete_ticket_port.js	2013-10-27 11:06:51 UTC (rev 112583)
@@ -19,9 +19,18 @@
 function update_maintainers(data,value){
 	if(value != null && value.length > 1 && value[1] != ""){
 		var firstmaintainer = value[1];
-		var existingowner = $("#action_reassign_reassign_owner").val();
+		/* must be fetched from the summary table, not the 'reassign to'
+		   field because reassign to contains logged in user when the current
+		   owner is macports-tickets
+		 */
+		var existingowner = $("td[headers=h_owner]>a").text().trim();
 		var existingcc = $("#field-cc").val() == "" ? Array() : $("#field-cc").val().split(",\\s*");
-		if(existingowner != "" && existingowner != firstmaintainer){
+		/*
+		 * clear the owner if multiple port
+		 */
+		if(existingowner != ""
+			&& existingowner != "macports-tickets at lists.macosforge.org"
+			&& existingowner != firstmaintainer){
 			existingcc.push(existingowner);
 			existingcc.push(firstmaintainer);
 			$("#action_reassign_reassign_owner").val(function(){
@@ -40,6 +49,8 @@
 		$("#field-cc").val(function() {
 				return existingcc.join(", ");
 		});
+		/* choose 'reassign to' */
+		$("#action_reassign").attr('checked', 'checked');
 	}
 }
 

Modified: users/elelay/PortsAutoComplete/portsautocomplete/portsautocomplete.py
===================================================================
--- users/elelay/PortsAutoComplete/portsautocomplete/portsautocomplete.py	2013-10-27 10:32:25 UTC (rev 112582)
+++ users/elelay/PortsAutoComplete/portsautocomplete/portsautocomplete.py	2013-10-27 11:06:51 UTC (rev 112583)
@@ -84,7 +84,7 @@
         query = req.args.get('q', '').lower()
         limit = 100
         try:
-        	limit = min(100,int(req.args.get('limit','1000')))
+        	limit = min(limit,int(req.args.get('limit','1000')))
         except ValueError:
         	pass
         
@@ -152,9 +152,8 @@
             add_script(req, '%s/js/format_item.js' % self.prefix)
             if req.path_info.rstrip() == '/newticket':
                 add_script(req, '%s/js/autocomplete_newticket_port.js' % self.prefix)
-            # script not working yet
-            # else:
-            #    add_script(req, '%s/js/autocomplete_ticket_port.js' % self.prefix)
+            else:
+                add_script(req, '%s/js/autocomplete_ticket_port.js' % self.prefix)
         return (template, data, content_type)
 
     def pre_process_request(self, req, handler):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20131027/532d6d0e/attachment-0001.html>


More information about the macports-changes mailing list