Opened 2 years ago

Closed 22 months ago

#19924 closed Bug (fixed)

Some jQuery selectors in actions.js use hardcoded values instead of pulling from options.

Reported by: anonymous Owned by: nobody
Component: contrib.admin Version: master
Severity: Normal Keywords: javascript
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: yes UI/UX: no

Description

This is equivalent to first_name = "Django"; last_name = "Reinhardt"; full_name = "Django Reinhardt";

If you specified custom options like I just did, you'll discover that the interactivity breaks because those selectors stop matching.

Attachments (1)

0001-fixed-selectors-in-actions.js-did-not-use-options.patch (1.7 KB) - added by crccheck 2 years ago.
sketch of the change to be made

Download all attachments as: .zip

Change History (5)

Changed 2 years ago by crccheck

sketch of the change to be made

comment:1 Changed 2 years ago by crccheck

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Well, that description I provided pretty much sucks. Here's another one:

If you're using a custom change_list.html admin template, where you have markup for the actions that differs from the default, but still want to use the existing actions.js javascript, it won't work. The "Select All" question won't click and neither will the "Clear" button. In my case, I renamed the "clear" class because it conflicted with an existing class that did clear:both and the clear button stopped working. There's no reason for this to happen though, because you can tell the javascript what selectors to look for. It just so happens that those buttons ignore what you say.

Here's the branch I'm working in:

https://github.com/crccheck/django/compare/ticket_19924

Trac doesn't have an option for it, but there's a minified version that needs to be built too, and I don't know how that's done in this project.

On a tangential note, I'd rather not be forced to put an anchor tag inside those buttons, but that's a separate issue and a separate ticket if there's interest.

comment:2 Changed 2 years ago by jacob

  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 23 months ago by polmuz

  • Component changed from contrib.auth to contrib.admin
  • Patch needs improvement set

I reviewed the code and it looks good.

Here are the instructions to compile the javascript for django https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/submitting-patches/#javascript-patches

I think if you add that and you create a pull request this could be merged.

comment:4 Changed 22 months ago by Tim Graham <timograham@…>

  • Resolution set to fixed
  • Status changed from new to closed

In 4523fcd60101124a307bd4026296337087b66884:

Fixed #19924 -- Fixed selectors in actions.js that did not use options.

Note: See TracTickets for help on using tickets.
Back to Top