Skip to content

Commit

Permalink
Fix bulk copy from original
Browse files Browse the repository at this point in the history
Fix: Fix bulk copy from original to comply with the latest GP Translation Helpers on W.org

Fixes: #396
  • Loading branch information
vlad-timotei committed Oct 19, 2022
1 parent 9725bd6 commit 8617983
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#2.0.10

* Fix: Fix bulk copy from original to comply with the latest GP Translation Helpers on W.org [Fixes #396]
# 2.0.9

* Fix: Fixes to comply with the w.org Beta Testing program [Fixes #391]
Expand Down
14 changes: 12 additions & 2 deletions js/glotdict-bulk.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,23 @@ jQuery( '.bulk-action' ).append( jQuery( '<option>', {
text: 'Copy From Original',
} ) );

const gd_checked_rows = [];

jQuery( 'tbody th.checkbox input' ).on( 'change', function() {
if ( jQuery( this ).is( ':checked' ) ) {
gd_checked_rows.push( jQuery( this ) );
} else {
gd_checked_rows.splice( gd_checked_rows.indexOf( jQuery( this ) ), 1 );
}
} );

jQuery( '.bulk-actions' ).on( 'click', '.button', ( e ) => {
if ( 'copy-from-original' === jQuery( '.bulk-action option:selected' ).val() ) {
let copied_count = 0;
let timeout = 0;
$gp.editor.hide(); // Avoid validation on open editors that are empty.
jQuery( 'tbody th.checkbox input:checked' ).each( function() {
const checkbox = jQuery( this );
gd_checked_rows.forEach( el => {
const checkbox = jQuery( el );
const parent = checkbox.closest( 'tr' );
const row = parent.attr( 'row' );
if ( gd_get_setting( 'autosubmit_bulk_copy_from_original' ) ) {
Expand Down

0 comments on commit 8617983

Please sign in to comment.