Opened 13 years ago
Last modified 13 months ago
#9643 assigned enhancement
Add default sorting to CC selector plugin
Reported by: | grimmdude | Owned by: | Dirk Stöcker |
---|---|---|---|
Priority: | normal | Component: | CcSelectorPlugin |
Severity: | trivial | Keywords: | list sort |
Cc: | Trac Release: | 0.12 |
Description
If there are many developers the cc list can get quite long. By simply adding the sorted() function in templates/cc_selector.html on line 31 the names will be alphabetized.
for="d in sorted(cc_developers)"
Attachments (4)
Change History (11)
comment:1 Changed 13 years ago by
Type: | defect → enhancement |
---|
comment:2 follow-up: 3 Changed 13 years ago by
Keywords: | list sort added |
---|
Changed 13 years ago by
Attachment: | 20111230_ccsel_sort_0.png added |
---|
Cc list sort: inital state, same for the suggested sort code (does nothing here)
Changed 13 years ago by
Attachment: | 20111230_ccsel_sort_1.png added |
---|
Cc list sort: key=lambda dev: dev[1]
Changed 13 years ago by
Attachment: | 20111230_ccsel_sort_2.png added |
---|
Cc list sort: key=lambda dev: dev[2]
Changed 13 years ago by
Attachment: | 20111230_ccsel_sort_10.png added |
---|
Cc list sort: surrogate key as suggested in my comment:1
comment:3 Changed 13 years ago by
Replying to hasienda:
While the result is certainly not perfect ...
Hit by a typo, please see correct link here: the result
comment:4 Changed 13 years ago by
Thanks very much for your quick and detailed response. I don't know much about the different trac environment versions, but my original solution does work for me. I'm using Trac 0.12
Your fix works good for me as well, so it seems to be the best solution for cross version compatibility. Personally I don't use caps in any of my developer names, but I completely agree that it support for them should be added for people who do.
If you really want to get robust with it you can add a sorting header that, when clicked, reverses the sorting. I can see this being useful for very long lists. I know most users probably don't have lists that long though, but still a nice feature.
Thanks again! -G
comment:5 Changed 8 years ago by
Owner: | Steffen Hoffmann deleted |
---|
comment:6 Changed 13 months ago by
Owner: | set to Dirk Stöcker |
---|---|
Status: | new → assigned |
I like simple solutions, nice attempt.
But my test of your code on
trunk
failed (no noticable change). I use a multi-purpose test environment driven by custom trac-0.13dev here.Nevertheless I was curious enough to dig deeper into it. I made the code more explicit about what values to use:
This works since Python2.4, and I could get results for order by user(s full name) and email too. All results show the problem with a simple order on one single field. Because we display username, if user's full name isn't available, it's just too easy. We'll need an equal surrogate key to adapt to the display order, right?
Additionally IMHO the sort should be case-insensitive, because the upper letters forming a separate group looks less intuitive. So my best guess after some fiddling with this is:
While the result is certainly not perfect in some respect (i.e. order of upper and lower letters per letter), it's an enhancement beyond the current code indeed.
Could you confirm, please? And of course, more suggestions welcome.