Opened 9 years ago
Last modified 9 years ago
#12169 closed enhancement
Replace suggest.js with jQuery autocomplete — at Version 10
Reported by: | Ryan J Ollos | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Milestone: | 1.2 |
Component: | version control/changeset view | Version: | |
Severity: | normal | Keywords: | suggest.js anydiff jquery-ui bitesized |
Cc: | walty8@… | Branch: | |
Release Notes: |
Replaced |
||
API Changes: |
The deprecated |
||
Internal Changes: |
Description (last modified by )
suggest.js
was deprecated in [11081] / #7355, to be replaced with jQuery autocomplete. The only use of suggest.js
is:
Change History (12)
by , 9 years ago
Attachment: | T12169_suggest_autocomplete.diff added |
---|
follow-up: 3 comment:1 by , 9 years ago
comment:2 by , 9 years ago
Description: | modified (diff) |
---|
comment:3 by , 9 years ago
Replying to psuter:
At least, three things:
- We should keep parameter naming for compatibilities (
q
→term
) - Use
to_json()
instead ofJSONEncoder.encode
- It would be good to rename variable
elem
since the variable is a list of path, e.g.paths
comment:4 by , 9 years ago
Cc: | added |
---|
by , 9 years ago
Attachment: | 12169-suggest-autocomplete.v2.patch added |
---|
comment:5 by , 9 years ago
Basically the same patch as psuter
, just modified the 3 places mentioned by jomae
.
For the query string problem ( term
→ q
), there is actually no easy way to do that except providing a source
function. The reference is here: SO:10791968.
comment:6 by , 9 years ago
Milestone: | next-dev-1.1.x → 1.2 |
---|---|
Owner: | set to |
Status: | new → assigned |
The changes look good to me. I added some minor modification in log:rjollos.git:t12169_suggest_js_replacement. I'll test in additional browsers tomorrow.
comment:7 by , 9 years ago
What are the use cases for keeping compatibility in parameter naming? [5097dc7b/rjollos.git] will keep the server-side API backward compatible. It wouldn't cover the use-case of implementing an IRequestFilter
for modifying the xhr request. I'm always in favor of backwards compatibility, but it doesn't seem worthwhile to add a more complex solution unless we have a concrete use case. This change is being made in a major release, so API changes are acceptable even though we want to minimize them.
comment:8 by , 9 years ago
No use-cases for me. However, no way to make sure of that all plugins and users except Trac core don't use q
parameter in the AnyDiffModule
.
The server-side API backward compatibilities in [5097dc7b/rjollos.git] looks good to me.
comment:9 by , 9 years ago
Another suggestions:
- It would be good to use
window.location.pathname
rather than hard-codeddiff
url.- $("#anydiff input[name$='_path']").autocomplete({source: "diff"}); + $("#anydiff input[name$='_path']").autocomplete({source: window.location.pathname});
.encode('utf-8')
is redundant sinceto_json()
always returnsstr
instance. In Trac 1.0.x with Python 2.5,to_json()
returnsstr
orunicode
instance.- content = to_json(paths).encode('utf-8') + content = to_json(paths)
comment:10 by , 9 years ago
suggest.js
displays directory entries in bold. I've added similar behavior in rjollos.git:t12169_suggest_js_replacement.1. Overriding _renderItem
required that jQuery UI be upgraded (#11019). The changes will require much more extensive testing than I've done so far.
Just in case this safes anyone some time:
suggest.js
on diff. (Available via Browse Source → View changes… button)