-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added selected connection count #1020
Conversation
I have few ESLint errors and I already tried to resolve by installing ESLint and Prettier ESLint extension but still nothing works so If anyone can take a look then it will be appreciated. |
@roshniahuja I've pushed 22a5031 which fixes the linting errors. Getting the lints set up in your IDE can be luck as much as anything else. If you use VS Code, I can share my extensions with you if you reach out via Slack. |
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.
A couple of inline notes about consistency with layout/spacing within the brackets.
I'm wondering if it would be better to use the string Selected connections (%d)
to ensure the strings are translatable in to all language formats.
The HTML could become:
<header class="with-selected">
<span class="selected-connections-text"><?php esc_html_e( 'Selected connections', 'distributor' ); ?></span>
<button class="button button-link selectno-connections unavailable"><?php esc_html_e( 'Clear', 'distributor' ); ?></button>
</header>
And the text in selected-connections-text
replaced in full via the JavaScript. @ravinderk, do you have an opinion on what would be best?
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.
This looks great, thank you!
One minor note about translator comments for _n
but otherwise it looks good.
assets/js/push.js
Outdated
@@ -580,7 +581,19 @@ jQuery( window ).on( 'load', () => { | |||
deleteNode.parentNode.removeChild( deleteNode ); | |||
|
|||
delete selectedConnections[ type + id ]; | |||
|
|||
selectedText = sprintf( | |||
/* translators: 1) Selected connection content singular name. 2) Selected connection content plural name. */ |
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.
/* translators: 1) Selected connection content singular name. 2) Selected connection content plural name. */ | |
/* translators: %d: Number of selected connections. */ |
For _n
translator notes are a little odd, the comment applies to both strings as the placeholders need to be identical.
assets/js/push.js
Outdated
@@ -602,6 +615,19 @@ jQuery( window ).on( 'load', () => { | |||
selectedConnections[ type + id ] = dtConnections[ type + id ]; | |||
|
|||
const element = event.currentTarget.cloneNode( true ); | |||
selectedText = sprintf( | |||
/* translators: 1) Selected connection content singular name. 2) Selected connection content plural name. */ |
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.
/* translators: 1) Selected connection content singular name. 2) Selected connection content plural name. */ | |
/* translators: %d: Number of selected connections. */ |
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.
Comment Updated.
assets/js/push.js
Outdated
@@ -660,6 +686,19 @@ jQuery( window ).on( 'load', () => { | |||
|
|||
element.appendChild( removeLink ); | |||
element.classList = 'added-connection'; | |||
selectedText = sprintf( | |||
/* translators: 1) Selected connection content singular name. 2) Selected connection content plural name. */ |
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.
/* translators: 1) Selected connection content singular name. 2) Selected connection content plural name. */ | |
/* translators: %d: Number of selected connections. */ |
assets/js/push.js
Outdated
@@ -691,6 +730,19 @@ jQuery( window ).on( 'load', () => { | |||
); | |||
|
|||
delete selectedConnections[ type + id ]; | |||
selectedText = sprintf( | |||
/* translators: 1) Selected connection content singular name. 2) Selected connection content plural name. */ |
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.
/* translators: 1) Selected connection content singular name. 2) Selected connection content plural name. */ | |
/* translators: %d: Number of selected connections. */ |
assets/js/push.js
Outdated
@@ -721,7 +773,18 @@ jQuery( window ).on( 'load', () => { | |||
const id = event.currentTarget.getAttribute( 'data-connection-id' ); | |||
|
|||
delete selectedConnections[ type + id ]; | |||
|
|||
selectedText = sprintf( | |||
/* translators: 1) Selected connection content singular name. 2) Selected connection content plural name. */ |
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.
/* translators: 1) Selected connection content singular name. 2) Selected connection content plural name. */ | |
/* translators: %d: Number of selected connections. */ |
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.
Looks good to me, thank you!
Fixes for issue #592
Description of the Change
Issue mentioned URL - #592
Added selected connection count
Closes
How to test the Change
To test this feature - Need to select connection from dropdown and it will increase count in Selected connection
Changelog Entry
Credits
Props @roshniahuja
Checklist: