-
Notifications
You must be signed in to change notification settings - Fork 18
Simplifies Ajax on both the JS and PHP sides. #103
Conversation
Also fixes several other WPCS-related issues.
While this is ready to be reviewed, it's not quite ready to be merged. It still needs at least 2 things:
I've got some other things to attend to, I'll get to those as soon as I can. |
@audrasjb Can you please review the way I did the strings in |
js/wp-autoupdates.js
Outdated
} | ||
|
||
wp.a11y.speak( 'enable' === action ? wp_autoupdates.enabled : wp_autoupdates.disabled, 'polite' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
polite
is redundant, as it's the default value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@audrasjb What are your thoughts here?
Personally, I think it is sometimes useful to be explicit with params, even when using the default value...and think this is one of those cases.
js/wp-autoupdates.js
Outdated
} else { | ||
parent.find( '.auto-updates-error' ).removeClass( 'hidden' ).addClass( 'notice error' ).find( 'p' ).text( response.data.error ); | ||
wp.a11y.speak( response.data.error, 'polite' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
polite
is redundant, as it's the default value.
js/wp-autoupdates.js
Outdated
.fail( function( response ) { | ||
parent.find( '.auto-updates-error' ).removeClass( 'hidden' ).addClass( 'notice error' ).find( 'p' ).text( wp_autoupdates.auto_update_error ); | ||
wp.a11y.speak( wp_autoupdates.auto_update_error, 'polite' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
polite
is redundant, as it's the default value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking this is ready to merge with couple of tiny changes/improvements. Can be refined more while or after the core patch if needed.
I'm just about done with replacing |
…JS with @DaTa attributes. Also corrects a few more coding standards issues.
@azaozz I think it can be merged now, and any other changes that are necessary can be done in a separate PR. |
…f data(). Also moves the .update-link click handler to the JS file instead loading that script inline.
Fixes #102, #94
This simplifies Ajax:
enable/disable
handlers into a singletoggle
handlerHTML injection
. that is, the markup for all "states" is output from PHP when the screen is originally rendered and the JS basically just shows/hides the relevant parts depending on whether it isenabling
ordisabling
It also addresses the "unexpected/quite annoying jump/shift" when the Ajax is processing, as reported in #94. It does that with the proposed solution in #94 (comment)
Also fixes several other WPCS-related issues and an a11y problem where
@aria-label
wasn't correct in one place.If this gets accepted, then we can close #99.