[Rt-commit] rt branch, 5.0/fix-inline-edit-duplicate-ids, created. rt-5.0.0alpha1-162-g44ff3cf762

? sunnavy sunnavy at bestpractical.com
Thu May 7 16:38:32 EDT 2020


The branch, 5.0/fix-inline-edit-duplicate-ids has been created
        at  44ff3cf762a84e2584137c776d20e2071fbc6da4 (commit)

- Log -----------------------------------------------------------------
commit 1e763933451acc11230d0c113ba1cb47f401c1f5
Author: michel <michel at bestpractical.com>
Date:   Fri May 1 16:35:04 2020 +0200

    Remove duplicate "Owner" select id introduced by inline edit in search results

diff --git a/share/html/Elements/SelectOwnerDropdown b/share/html/Elements/SelectOwnerDropdown
index b685df8bd3..4951bd8511 100644
--- a/share/html/Elements/SelectOwnerDropdown
+++ b/share/html/Elements/SelectOwnerDropdown
@@ -45,7 +45,7 @@
 %# those contributions and any derivatives thereof.
 %#
 %# END BPS TAGGED BLOCK }}}
-<select name="<%$Name%>" id="<%$Name%>" class="selectpicker form-control">
+<select name="<%$Name%>" class="selectpicker form-control">
 %if ($DefaultValue) {
 <option value=""<% !$Default ? qq[ selected="selected"] : '' |n %>><%$DefaultLabel |n%></option>
 %}

commit 59ed04763e1843bb77e909f354fb8f7dc7b5827e
Author: michel <michel at bestpractical.com>
Date:   Fri May 1 16:36:03 2020 +0200

    Remove duplicate SLA id introduced by inline edit in search results

diff --git a/share/html/Elements/SelectSLA b/share/html/Elements/SelectSLA
index e4759901df..1540ddc62d 100644
--- a/share/html/Elements/SelectSLA
+++ b/share/html/Elements/SelectSLA
@@ -45,7 +45,7 @@
 %# those contributions and any derivatives thereof.
 %#
 %# END BPS TAGGED BLOCK }}}
-<select name="<%$Name%>" id="<%$Name%>" class="form-control selectpicker">
+<select name="<%$Name%>" class="form-control selectpicker">
 % if ($DefaultValue) {
 <option value=""<% !$Default ? qq[ selected="selected"] : '' |n %>><%$DefaultLabel |n%></option>
 % }

commit aed59e5600df0ad3095d4126a34f0052211b2012
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu May 7 15:13:18 2020 +0800

    Remove duplicate TimeUnit id introduced by inline edit in search results

diff --git a/share/html/Elements/SelectTimeUnits b/share/html/Elements/SelectTimeUnits
index bbda067ad7..e33085d447 100644
--- a/share/html/Elements/SelectTimeUnits
+++ b/share/html/Elements/SelectTimeUnits
@@ -45,7 +45,7 @@
 %# those contributions and any derivatives thereof.
 %#
 %# END BPS TAGGED BLOCK }}}
-<select class="selectpicker form-control TimeUnits" id="<% $Name %>" name="<% $Name %>">
+<select class="selectpicker form-control TimeUnits" name="<% $Name %>">
 <option value="minutes" <% $Default eq 'minutes' ? 'selected="selected"' : '' |n%>>
     <% loc('Minutes') %>
 </option>

commit 44ff3cf762a84e2584137c776d20e2071fbc6da4
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu May 7 15:00:26 2020 +0800

    Migrate owner autocomplete to the general autocomplete
    
    The initial reason is to remove the duplicate "Owner" id in search
    results when InlineEdit is enabled.
    
    Previous owner autocomplete had a simple client cache mechanism, but the
    general autcomplete feature doesn't have that yet. We can come back to
    this if there is a performance issue in the future.

diff --git a/share/html/Elements/SelectOwnerAutocomplete b/share/html/Elements/SelectOwnerAutocomplete
index b47b5c750f..2861c755ba 100644
--- a/share/html/Elements/SelectOwnerAutocomplete
+++ b/share/html/Elements/SelectOwnerAutocomplete
@@ -67,36 +67,6 @@ if ( $Default and not $Default =~ /\D/ ) {
 
 # Map to a string of RT::Ticket-1|RT::Queue-5|...
 my $limit = join '|', map { join '-', ref($_), ($_->id || '') } @$Objects;
-
-my $query = $m->comp('/Elements/QueryString',
-    return  => $ValueAttribute,
-    limit   => $limit,
-);
 </%INIT>
 
-<input type="text" name="<%$Name%>" id="<%$Name%>" value="<% $value %>" class="form-control" />
-<script type="text/javascript">
-    jQuery(function() {
-        var cache = {};
-        jQuery("#"+<% $Name |n,j%>).autocomplete({
-            minLength: 2,
-            source: function(request, response) {
-                if ( request.term in cache ) {
-                    response( cache[ request.term ] );
-                }
-                else {
-                    jQuery.ajax({
-                        url: RT.Config.WebPath + "/Helpers/Autocomplete/Owners?"+<% $query|n,j %>,
-                        dataType: "json",
-                        data: request,
-                        success: function( data ) {
-                            cache[ request.term ] = data;
-                            response( data );
-                        }
-                    });
-                }
-            }
-        });
-    });
-</script>
-
+<input type="text" name="<%$Name%>" value="<% $value %>" data-autocomplete="Owners" data-autocomplete-return="<% $ValueAttribute %>" data-autocomplete-limit="<% $limit %>" class="form-control" />
diff --git a/share/static/js/autocomplete.js b/share/static/js/autocomplete.js
index dae90ba9eb..c56ea33218 100644
--- a/share/static/js/autocomplete.js
+++ b/share/static/js/autocomplete.js
@@ -3,6 +3,7 @@ if (!window.RT.Autocomplete) window.RT.Autocomplete = {}
 
 window.RT.Autocomplete.Classes = {
     Users: 'user',
+    Owners: 'owner',
     Groups: 'group',
     Tickets: 'tickets',
     Queues: 'queues',
@@ -129,6 +130,9 @@ window.RT.Autocomplete.bind = function(from) {
             options.minLength = 2;
             options.delay = 2;
         }
+        else if (what == 'Owners') {
+            options.minLength = 2;
+        }
 
         if (input.is('[data-autocomplete-privileged]')) {
             queryargs.push("privileged=1");
@@ -197,6 +201,11 @@ window.RT.Autocomplete.bind = function(from) {
             queryargs.push("exclude="+exclude);
         }
 
+        var limit = input.attr("data-autocomplete-limit");
+        if (limit) {
+            queryargs.push("limit="+limit);
+        }
+
         if (queryargs.length)
             options.source += "?" + queryargs.join("&");
 

-----------------------------------------------------------------------


More information about the rt-commit mailing list