2015-06-05 20:17:55 +00:00
/ * *
2017-05-19 22:12:53 +00:00
* DO NOT EDIT THIS FILE .
* See the following change record for more information ,
2017-05-23 14:30:14 +00:00
* https : //www.drupal.org/node/2815083
2017-05-19 22:12:53 +00:00
* @ preserve
* * /
2015-06-05 20:17:55 +00:00
2014-01-25 02:37:16 +00:00
( function ( $ , Drupal ) {
2014-01-27 21:41:32 +00:00
Drupal . behaviors . localeTranslateDirty = {
2017-05-19 22:12:53 +00:00
attach : function attach ( ) {
2015-10-13 22:37:56 +00:00
var $form = $ ( '#locale-translate-edit-form' ) . once ( 'localetranslatedirty' ) ;
2014-01-27 21:41:32 +00:00
if ( $form . length ) {
2015-04-19 12:01:55 +00:00
$form . one ( 'formUpdated.localeTranslateDirty' , 'table' , function ( ) {
2014-01-27 21:41:32 +00:00
var $marker = $ ( Drupal . theme ( 'localeTranslateChangedWarning' ) ) . hide ( ) ;
$ ( this ) . addClass ( 'changed' ) . before ( $marker ) ;
$marker . fadeIn ( 'slow' ) ;
} ) ;
2020-01-28 13:12:54 +00:00
2015-04-19 12:01:55 +00:00
$form . on ( 'formUpdated.localeTranslateDirty' , 'tr' , function ( ) {
2015-04-19 15:30:43 +00:00
var $row = $ ( this ) ;
var $rowToMark = $row . once ( 'localemark' ) ;
var marker = Drupal . theme ( 'localeTranslateChangedMarker' ) ;
2020-01-28 13:12:54 +00:00
2014-01-27 21:41:32 +00:00
$row . addClass ( 'changed' ) ;
2017-05-19 22:12:53 +00:00
2014-01-27 21:41:32 +00:00
if ( $rowToMark . length ) {
2015-09-09 15:00:24 +00:00
$rowToMark . find ( 'td:first-child .js-form-item' ) . append ( marker ) ;
2014-01-27 21:41:32 +00:00
}
} ) ;
}
} ,
2017-05-19 22:12:53 +00:00
detach : function detach ( context , settings , trigger ) {
2014-01-27 21:41:32 +00:00
if ( trigger === 'unload' ) {
2015-10-13 22:37:56 +00:00
var $form = $ ( '#locale-translate-edit-form' ) . removeOnce ( 'localetranslatedirty' ) ;
2014-01-27 21:41:32 +00:00
if ( $form . length ) {
2015-04-19 12:01:55 +00:00
$form . off ( 'formUpdated.localeTranslateDirty' ) ;
Issue #1452188 by Schnitzel, droplet, Sutharsan, Bojhan, Kristen Pol, Gábor Hojtsy, ershov.andrey, perusio, nod_, rvilar, andypost: Added New UI for string translation.
2012-06-15 10:01:31 +00:00
}
}
}
2014-01-27 21:41:32 +00:00
} ;
2020-01-28 13:12:54 +00:00
2014-01-27 21:41:32 +00:00
Drupal . behaviors . hideUpdateInformation = {
2017-05-19 22:12:53 +00:00
attach : function attach ( context , settings ) {
2014-01-27 21:41:32 +00:00
var $table = $ ( '#locale-translation-status-form' ) . once ( 'expand-updates' ) ;
if ( $table . length ) {
var $tbodies = $table . find ( 'tbody' ) ;
2020-01-28 13:12:54 +00:00
2014-01-27 21:41:32 +00:00
$tbodies . on ( 'click keydown' , '.description' , function ( e ) {
2017-05-19 22:12:53 +00:00
if ( e . keyCode && e . keyCode !== 13 && e . keyCode !== 32 ) {
2014-01-27 21:41:32 +00:00
return ;
}
e . preventDefault ( ) ;
var $tr = $ ( this ) . closest ( 'tr' ) ;
2020-01-28 13:12:54 +00:00
2014-01-27 21:41:32 +00:00
$tr . toggleClass ( 'expanded' ) ;
2020-01-28 13:12:54 +00:00
2015-01-15 11:12:54 +00:00
$tr . find ( '.locale-translation-update__prefix' ) . text ( function ( ) {
2014-01-27 21:41:32 +00:00
if ( $tr . hasClass ( 'expanded' ) ) {
return Drupal . t ( 'Hide description' ) ;
}
2017-07-06 06:21:40 +00:00
return Drupal . t ( 'Show description' ) ;
2014-01-27 21:41:32 +00:00
} ) ;
2012-12-19 22:11:34 +00:00
} ) ;
2014-01-27 21:41:32 +00:00
$table . find ( '.requirements, .links' ) . hide ( ) ;
}
2012-12-19 22:11:34 +00:00
}
2014-01-27 21:41:32 +00:00
} ;
2020-01-28 13:12:54 +00:00
2017-05-19 22:12:53 +00:00
$ . extend ( Drupal . theme , {
localeTranslateChangedMarker : function localeTranslateChangedMarker ( ) {
2020-01-28 13:12:54 +00:00
return '<abbr class="warning ajax-changed" title="' + Drupal . t ( 'Changed' ) + '">*</abbr>' ;
2014-01-27 21:41:32 +00:00
} ,
2017-05-19 22:12:53 +00:00
localeTranslateChangedWarning : function localeTranslateChangedWarning ( ) {
2020-01-28 13:12:54 +00:00
return '<div class="clearfix messages messages--warning">' + Drupal . theme ( 'localeTranslateChangedMarker' ) + ' ' + Drupal . t ( 'Changes made in this table will not be saved until the form is submitted.' ) + '</div>' ;
2014-01-27 21:41:32 +00:00
}
} ) ;
2017-05-19 22:12:53 +00:00
} ) ( jQuery , Drupal ) ;