Making WordPress.org

Ticket #2894: camptix-add-i18n-flag-labels.diff

File camptix-add-i18n-flag-labels.diff, 2.5 KB (added by dd32, 9 years ago)
  • wordcamp.org/public_html/wp-content/plugins/camptix-admin-flags/addons/admin-flags.php

    diff --git wordcamp.org/public_html/wp-content/plugins/camptix-admin-flags/addons/admin-flags.php wordcamp.org/public_html/wp-content/plugins/camptix-admin-flags/addons/admin-flags.php
    index 89165594..71bd0f48 100644
    class CampTix_Admin_Flags_Addon extends CampTix_Addon { 
    325401                                data-command="{{data.command}}"
    326402                                class="tix-toggle-flag">
    327403
    328                                 {{data.command}}    <?php // todo use i18n var ?>
     404                                {{data.command_label}}
    329405                        </a>
    330406                </script>
    331407
    class CampTix_Admin_Flags_Addon extends CampTix_Addon { 
    382458                        ( function( $ ) {
    383459                                $( '#posts-filter' ).on( 'click', 'a.tix-toggle-flag', function( event ) {
    384460                                        var itemTemplate,
    385                                                 item       = $( this ).parent(),
    386                                                 attendeeID = $( this ).data( 'attendee-id' ),
    387                                                 key        = $( this ).data( 'key' ),
    388                                                 command    = $( this ).data( 'command' ),
    389                                                 label      = $( item ).find( '.tix-admin-flag-label' ).text(),
    390                                                 nonce      = $( this ).data( 'nonce' );
     461                                                item          = $( this ).parent(),
     462                                                attendeeID    = $( this ).data( 'attendee-id' ),
     463                                                key           = $( this ).data( 'key' ),
     464                                                command       = $( this ).data( 'command' ),
     465                                                command_label = $( this ).text().trim(),
     466                                                label         = $( item ).find( '.tix-admin-flag-label' ).text(),
     467                                                nonce         = $( this ).data( 'nonce' );
    391468
    392469                                        event.preventDefault();
    393470
    class CampTix_Admin_Flags_Addon extends CampTix_Addon { 
    411488                                                        if ( response.hasOwnProperty( 'success' ) && true === response.success ) {
    412489                                                                if ( 'enable' == command ) {
    413490                                                                        command = 'disable';
     491                                                                        command_label = <?php echo wp_json_encode( __( 'Disable', 'camptix' ) ); ?>;
    414492                                                                } else if ( 'disable' == command ) {
    415493                                                                        command = 'enable';
     494                                                                        command_label = <?php echo wp_json_encode( __( 'Enable', 'camptix' ) ); ?>;
    416495                                                                }
    417496                                                        }
    418497
    419498                                                        itemTemplate = _.template( $( '#tmpl-tix-admin-flag-toggle' ).html(), null, camptix.template_options );
    420499                                                        item.html( itemTemplate( {
    421500                                                                attendee_id: attendeeID,
    422                                                                 key:         key,
    423                                                                 command:     command,
    424                                                                 label:       label,
    425                                                                 nonce:       nonce
     501                                                                key:           key,
     502                                                                command:       command,
     503                                                                command_label: command_label,
     504                                                                label:         label,
     505                                                                nonce:         nonce
    426506                                                        } ) );
    427507                                                }
    428508                                        );