Quick Search
Review Request #2199 — Created March 14, 2011 and submitted
Wrote an autocomplete wrapper in common.js. This quick search searches for users, groups and review requests. The autocomplete widget was modified to accommodate the feature where clicking on a suggestion would open the object's URL in a new window. The compressed version of the autocomplete widget is included. Added the documentation for the search resource as well. I also removed ui.autocomplete in reviews.css to common.css. Added the js scripts that autocomplete needs in base.html and removed duplicate js files from other html templates.
A lot of manual testing with as many different cases I could think of using different group display names & names, user username/first name/last name, and review request ID/summaries. Caught quite a few bugs through this. Not sure if this is all I should be doing. Am I suppose to be writing some tests as well?
CR
- Diff:
-
Revision 2 (+191 -142)
-
-
-
-
-
-
Indentation should be 4 spaces. This looks like 8 or a tab. Make sure everything's using spaces only.
-
Brace should be on the same line as the if statement. Same with the following if statements. Also, you can just do data.username (same with the others)
-
-
-
-
eval is too dangerous. I don't think you should need it anyway. My understanding was that data would be a javascript object anyway.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Indentation is wrong. I don't know that clickURLChange is right now. The makeItem should be registering this. See below for some fixes that need to be made for makeItem though.
-
{ on the same line as the function. At this point I'm not going to point them out. I suggest going through your change and making sure they're all correct. Same with the indentation changes. One important thing: This file should never know how it's going to be used. This handler for makeItem should be overridable through options, just like some of the other functions, and the version for the search field should provide the implementation here. The default implementation should do exactly what the old default implementation did.
-
data.summary You should go through and fix all remaining occurrences. Also, comment should be in the body.
-
-
-
-
-
-
-
CR
- Change Summary:
-
For the file ui.autocomplete.js, on line 431, I'm not sure why the indentation is wrong there. The first time when I post reviewed, the indentation problem is not there. I took another look at the file, and made some other changes to that file and re-committed it making sure there is no indentation problem. I have no idea why it's like that.
- Diff:
-
Revision 3 (+180 -147)
-
The indentation is because some of it is using tabstops and some is using spaces. Make sure there are no tabstops in the code at all, and that all indentation is done via spaces.
CR
- Change Summary:
-
Fixed an indentation problem with ui.autocomplete.js and made another compressed version of that as well.
- Diff:
-
Revision 4 (+180 -147)
-
Okay, I just applied the patch to my tree and tried it out, and I have some usability comments: The drop-down text currently has "Review Request Summary (id)" - If the summary is too long on any given review request, the text will overlap the (id) and will be ugly and impossible to read. We should make the drop-down for this box wider and give it a limit on the width of the text (overflow: clipped) so it never overlaps. - There's a "Press tab to auto-complete" item, which works, but fills in the text of the search box with the summary. I'm not sure how useful that really is. - If you hit enter after entering a review request number, even though you saw it in the drop-down, the search results will be empty. The request in bug 1842 (going directly to the review request) seems nice.
CR
- Change Summary:
-
- Implemented bug 1842 where searching a valid review request ID will redirect to the review request - Chopped off long summaries and made drop down box wider - Got rid of "Press tab to autocomplete" although the tab button still works - Removed all the tab spaces in ui.autocomplete
- Diff:
-
Revision 5 (+920 -890)
-
Okay, one last user interaction niggle: When I type in the ID of a review request, the drop-down immediately focuses the single item, which means when I press "enter" on the keyboard, instead of searching for that ID, it fills the entry with the text of the drop-down. I'd prefer it if it didn't focus any items, so that unless I press the down arrow on the keyboard, it won't fill anything into the text box that I didn't type.
CR
- Change Summary:
-
Change quick search so that no item is focused by default. Please let me know if there is anything else I can change. Thanks!
- Diff:
-
Revision 6 (+921 -890)