-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0cf5745
commit 0761578
Showing
2 changed files
with
115 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* global document, gpToolbox, setTimeout, wp */ | ||
|
||
jQuery( document ).ready( function( $ ) { | ||
// Set array of Translation Sets. | ||
var translationSets = []; | ||
|
||
// Check if user is has GlotPress Admin previleges. | ||
var glotpressAdmin = gpToolbox.admin; | ||
|
||
var cp-project-id = 1; | ||
|
||
// Check if user is has GlotPress Admin previleges. | ||
var gpUrlProject = gpToolbox.gp_url_project; | ||
|
||
/** | ||
* Delete Translations from a Translation Set with a specific status. | ||
* | ||
* @param {string} projectPath : Path ot the GP_Project. | ||
* @param {string} locale : Locale of the GP_Translation_Set. | ||
* @param {string} slug : Slug of the GP_Translation_Set. | ||
* @param {string} status : Status of the GP_Translation. | ||
*/ | ||
function deleteTranslations( projectPath, locale, slug, status ) { | ||
var button = $( 'table.gp-table.translation-sets tr[data-locale="' + locale + '"][data-slug="' + slug + '"] td:first-child button.gp-convert-pt-ao90-update-button' ); | ||
console.log( 'Clicked to delete translations on project "' + projectPath + '" locale "' + locale + '/' + slug + '"' + ' and status "' + status + '"' ); | ||
|
||
$.ajax( { | ||
|
||
url: gpToolbox.ajaxurl, | ||
type: 'POST', | ||
data: { | ||
action: 'delete_translations', | ||
projectPath: projectPath, | ||
locale: locale, | ||
slug: slug, | ||
status: status, | ||
nonce: gpToolbox.nonce, | ||
}, | ||
beforeSend: function() { | ||
console.log( 'Ajax request is starting...' ); | ||
}, | ||
|
||
} ).done( function( response, textStatus, jqXHR ) { | ||
console.log( 'Ajax request has been completed (' + textStatus + '). Status: ' + jqXHR.status + ' ' + jqXHR.statusText ); | ||
console.log( response ); | ||
console.log( textStatus ); | ||
console.log( jqXHR ); | ||
} ).fail( function( jqXHR, textStatus ) { | ||
// Show the Error notice. | ||
console.log( 'Ajax request has failed (' + textStatus + '). Status: ' + jqXHR.status + ' ' + jqXHR.statusText ); | ||
} ).always( function() { | ||
console.log( 'Ajax end.' ); | ||
} ); | ||
} | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters