Re: Missing feature in actions.js (Django 3.2 and later)

2022-02-03 Thread akiyoko
Thanks, Adam.
I have created a ticket and a PR.

Ticket
https://code.djangoproject.com/ticket/33491
PR
https://github.com/django/django/pull/15395

However, since the JS code I wrote is a bit hachy, any other ideas?

Akihito Yokose
2022年2月4日金曜日 7:46:56 UTC+9 Adam Johnson:

> Hi Akihito
>
> Looking at the PR ( https://github.com/django/django/pull/12820 ) and 
> ticket for that commit, it looks like purely an oversight that this feature 
> was removed. Since you've done much of the research already, would you be 
> able to make a PR? It should be possible to rewrite those lines of code in 
> vanilla JS.
>
> Adam
>
> On Thu, Feb 3, 2022 at 10:53 AM akiyoko  wrote:
>
>> Hi everyone,
>>
>> On the admin site, I've found a feature that existed in Django 2.2 but 
>> was lost with the update to Django 3.2.
>>
>> In Django 2.2, if you clicked the "No, take me back" button on the delete 
>> confirmation page, the background color of the checked rows would remain 
>> highlighted and the action-counter display would remain counted up on the 
>> change list page. However, in Django 3.2, the background color of the 
>> selected row is not highlighted and the action-counter display is "0 of X 
>> selected".
>>
>> Based on my investigation, I'm guessing that the problem is caused by the 
>> following fix to the JavaScript on the admin site that accompanies the 
>> update to Django 3.2.
>>
>> https://github.com/django/django/commit/30e59705fc3e3e9e8370b965af794ad6173bf92b
>>
>> The direct cause is that the following process in 
>> django/contrib/admin/static/admin/js/actions.js was removed in that fix.
>>
>> ~~~
>> // Show counter by default
>> $(options.counterContainer).show();
>> // Check state of checkboxes and reinit state if needed
>> $(this).filter(":checked").each(function(i) {
>> $(this).parent().parent().toggleClass(options.selectedClass);
>> updateCounter();
>> if ($(options.acrossInput).val() === 1) {
>> showClear();
>> }
>> });
>> ~~~
>>
>> In addition, it seems that the "checked" property of all elements in the 
>> "actionsEls" is now always false due to the change in the way the DOM load 
>> completion event is fired. We may need to take that into account when 
>> fixing.
>>
>> Thanks in advance,
>>
>>
>> Akihito Yokose
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django developers (Contributions to Django itself)" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-develop...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-developers/dacf2948-66b1-4e64-a30e-84e418bd0d8bn%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/b4e1359a-7a73-41a1-80f6-b42844fecd86n%40googlegroups.com.


Re: Missing feature in actions.js (Django 3.2 and later)

2022-02-03 Thread 'Adam Johnson' via Django developers (Contributions to Django itself)
Hi Akihito

Looking at the PR ( https://github.com/django/django/pull/12820 ) and
ticket for that commit, it looks like purely an oversight that this feature
was removed. Since you've done much of the research already, would you be
able to make a PR? It should be possible to rewrite those lines of code in
vanilla JS.

Adam

On Thu, Feb 3, 2022 at 10:53 AM akiyoko  wrote:

> Hi everyone,
>
> On the admin site, I've found a feature that existed in Django 2.2 but was
> lost with the update to Django 3.2.
>
> In Django 2.2, if you clicked the "No, take me back" button on the delete
> confirmation page, the background color of the checked rows would remain
> highlighted and the action-counter display would remain counted up on the
> change list page. However, in Django 3.2, the background color of the
> selected row is not highlighted and the action-counter display is "0 of X
> selected".
>
> Based on my investigation, I'm guessing that the problem is caused by the
> following fix to the JavaScript on the admin site that accompanies the
> update to Django 3.2.
>
> https://github.com/django/django/commit/30e59705fc3e3e9e8370b965af794ad6173bf92b
>
> The direct cause is that the following process in
> django/contrib/admin/static/admin/js/actions.js was removed in that fix.
>
> ~~~
> // Show counter by default
> $(options.counterContainer).show();
> // Check state of checkboxes and reinit state if needed
> $(this).filter(":checked").each(function(i) {
> $(this).parent().parent().toggleClass(options.selectedClass);
> updateCounter();
> if ($(options.acrossInput).val() === 1) {
> showClear();
> }
> });
> ~~~
>
> In addition, it seems that the "checked" property of all elements in the
> "actionsEls" is now always false due to the change in the way the DOM load
> completion event is fired. We may need to take that into account when
> fixing.
>
> Thanks in advance,
>
>
> Akihito Yokose
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/dacf2948-66b1-4e64-a30e-84e418bd0d8bn%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAMyDDM03bEWwbpX94fqRsDAu1G7E_BRjvusLB9nhRXDVgVoJGw%40mail.gmail.com.


Missing feature in actions.js (Django 3.2 and later)

2022-02-03 Thread akiyoko
Hi everyone,

On the admin site, I've found a feature that existed in Django 2.2 but was 
lost with the update to Django 3.2.

In Django 2.2, if you clicked the "No, take me back" button on the delete 
confirmation page, the background color of the checked rows would remain 
highlighted and the action-counter display would remain counted up on the 
change list page. However, in Django 3.2, the background color of the 
selected row is not highlighted and the action-counter display is "0 of X 
selected".

Based on my investigation, I'm guessing that the problem is caused by the 
following fix to the JavaScript on the admin site that accompanies the 
update to Django 3.2.
https://github.com/django/django/commit/30e59705fc3e3e9e8370b965af794ad6173bf92b

The direct cause is that the following process in 
django/contrib/admin/static/admin/js/actions.js was removed in that fix.

~~~
// Show counter by default
$(options.counterContainer).show();
// Check state of checkboxes and reinit state if needed
$(this).filter(":checked").each(function(i) {
$(this).parent().parent().toggleClass(options.selectedClass);
updateCounter();
if ($(options.acrossInput).val() === 1) {
showClear();
}
});
~~~

In addition, it seems that the "checked" property of all elements in the 
"actionsEls" is now always false due to the change in the way the DOM load 
completion event is fired. We may need to take that into account when 
fixing.

Thanks in advance,


Akihito Yokose

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/dacf2948-66b1-4e64-a30e-84e418bd0d8bn%40googlegroups.com.