Making WordPress.org

Changeset 12003

Timestamp:
08/01/2022 10:47:56 AM (2 years ago)
Author:
amieiro
Message:

Translate: Update from remote repo

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/gp-translation-helpers.php

    r11837 r12003  
    3535require_once __DIR__ . '/includes/class-gp-notifications.php';
    3636require_once __DIR__ . '/includes/class-wporg-notifications.php';
     37
    3738
    3839add_action( 'gp_init', array( 'GP_Translation_Helpers', 'init' ) );
    3940add_action( 'gp_init', array( 'WPorg_GlotPress_Notifications', 'init' ) );    // todo: include this class in a different plugin.
     41
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/helpers-assets/templates/translation-discussion-comments.php

    r11999 r12003  
    6060    </ul><!-- .discussion-list -->
    6161    <?php
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
    6283    add_action(
    6384        'comment_form_logged_in_after',
    64         function () use ( $locale_slug ) {
    65             $language_question = '';
    66 
    67             if ( $locale_slug ) {
    68                 $gp_locale = GP_Locales::by_slug( $locale_slug );
    69                 if ( $gp_locale ) {
    70                     $language_question = '<option value="question">Question about translating to ' . esc_html( $gp_locale->english_name ) . '</option>';
    71                 }
    72             }
     85        function () use ( $locale_slug, $options ) {
     86            /**
     87             * Filters the options.
     88             *
     89             * @param string $options     The options for the select element.
     90             * @param string $locale_slug The slug of the current locale.
     91             *
     92             *@since 0.0.2
     93             */
     94            $options = apply_filters( 'gp_discussion_new_comment_options', $options, $locale_slug );
    7395
    7496            echo '<p class="comment-form-topic">
    75                     <label for="comment_topic">Topic <span class="required" aria-hidden="true">*</span> (required)</label>
    76                     <select required name="comment_topic" id="comment_topic">
    77                         <option value="">Select topic</option>
    78                         <option value="typo">Typo in the English text</option>
    79                         <option value="context">Where does this string appear? (more context)</option>' .
    80                         wp_kses( $language_question, array( 'option' => array( 'value' => true ) ) ) .
    81                     '</select>
    82                 </p>';
     97                    <label for="comment_topic">Topic <span class="required" aria-hidden="true">*</span> (required)</label> ' .
     98                        wp_kses(
     99                            $options,
     100                            array(
     101                                'select'   =>
     102                                           array(
     103                                               'required' => true,
     104                                               'name'     => true,
     105                                               'id'       => true,
     106                                           ),
     107                                'optgroup' =>
     108                                        array(
     109                                            'label' => true,
     110                                        ),
     111                                'option'   =>
     112                                        array(
     113                                            'value' => true,
     114                                        ),
     115                            )
     116                        ) .
     117                '</p>';
    83118        },
    84119        10,
     
    104139                'cancel_reply_link'   => '<span></span>',
    105140                'format'              => 'html5',
    106                 'class_submit' => 'button is-primary',
     141                'class_submit' => 'button is-primary',
    107142                'comment_notes_after' => implode(
    108143                    "\n",
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/helpers/helper-translation-discussion.php

    r11999 r12003  
    700700     * Throws an exception with an error message if the original id is incorrect.
    701701     *
    702      * Used as callback to validate the original_id passed on rejecting a string with feedback
     702     * Used as callback to validate the original_id passed on ting a string with feedback
    703703     *
    704704     * @since 0.0.2
    705705     *
    706      * @param int|string $original_id   The id of the original for the rejected translation.
     706     * @param int|string $original_id   The id of the original for the ted translation.
    707707     *
    708708     * @return int|string
     
    719719
    720720    /**
    721      * Return an array of allowed rejection reasons and explanation of each reason.
     721     * Return an array of allowed reasons and explanation of each reason.
    722722     *
    723723     * @since 0.0.2
     
    725725     * @return array
    726726     */
    727     public static function get_reject_reasons(): array {
     727    public static function get_t_reasons(): array {
    728728        return array(
    729729            'style'       => array(
     
    824824    $comment_translation_id = get_comment_meta( $comment->comment_ID, 'translation_id', true );
    825825
    826     $reject_reason = get_comment_meta( $comment->comment_ID, 'reject_reason', true );
     826    $t_reason = get_comment_meta( $comment->comment_ID, 'reject_reason', true );
    827827
    828828    $classes = array( 'comment-locale-' . $comment_locale );
    829     if ( ! empty( $reject_reason ) ) {
     829    if ( ! empty( $t_reason ) ) {
    830830        $classes[] = 'rejection-feedback';
    831831        $classes[] = 'rejection-feedback-' . $comment_locale;
     
    876876            }
    877877
    878             if ( $reject_reason ) :
     878            if ( $t_reason ) :
    879879                ?>
    880                 The translation <?php gth_print_translation( $comment_translation_id, $args ); ?> was rejected with <a href="<?php echo esc_url( $linked_comment ); ?>"><?php esc_html_e( 'a reason that is being discussed here' ); ?></a>.
     880                The translation <?php gth_print_translation( $comment_translation_id, $args ); ?> is being discussed here' ); ?></a>.
    881881            <?php else : ?>
    882882                <a href="<?php echo esc_url( $linked_comment ); ?>"><?php esc_html_e( 'Please continue the discussion here' ); ?></a>
     
    884884        <?php else : ?>
    885885            <?php comment_text(); ?>
    886             <?php if ( $reject_reason ) : ?>
     886            <?php if ( $t_reason ) : ?>
    887887            <p>
    888                 <?php echo esc_html( _n( 'Rejection Reason: ', 'Rejection Reasons: ', count( $reject_reason ) ) ); ?>
     888                <?php echo esc_html( _n( 't_reason ) ) ); ?>
    889889                <?php
    890                 $number_of_items = count( $reject_reason );
     890                $number_of_items = count( $t_reason );
    891891                $counter         = 0;
    892                 $reject_reasons  = Helper_Translation_Discussion::get_reject_reasons();
    893                 foreach ( $reject_reason as $reason ) {
     892                $t_reasons();
     893                foreach ( $t_reason as $reason ) {
    894894                    echo wp_kses(
    895895                        sprintf(
    896                         /* translators: 1: Title with the explanation of the reject reason , 2: The reject reason */
     896                        /* translators: 1: Title with the explanation of the t reason */
    897897                            __( '<span title="%1$s" class="tooltip">%2$s</span> <span class="tooltip dashicons dashicons-info" title="%1$s"></span>', 'glotpress' ),
    898                             $reject_reasons[ $reason ]['explanation'],
    899                             $reject_reasons[ $reason ]['name'],
     898                            $t_reasons[ $reason ]['explanation'],
     899                            $t_reasons[ $reason ]['name'],
    900900                        ),
    901901                        array(
     
    957957            if ( ! $is_linking_comment ) :
    958958                if ( $comment_translation_id && $comment_translation_id !== $current_translation_id ) {
    959                     gth_print_translation( $comment_translation_id, $args, empty( $reject_reason ) ? 'Translation: ' : 'Translation  (Rejected): ' );
     959                    gth_print_translation( $comment_translation_id, $args, : ' );
    960960                }
    961961
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/includes/class-gp-notifications.php

    r11992 r12003  
    367367     */
    368368    public static function get_email_body( WP_Comment $comment, array $comment_meta ): string {
    369         $post     = get_post( $comment->comment_post_ID );
    370         $project  = self::get_project_from_post( $post );
    371         $original = self::get_original( $comment );
    372         $output   = '';
     369        $post            = get_post( $comment->comment_post_ID );
     370        $project         = self::get_project_from_post( $post );
     371        $original        = self::get_original( $comment );
     372        $url             = GP_Route_Translation_Helpers::get_permalink( $project->path, $original->id );
     373        $link_to_comment = $url . '#comment-' . $comment->comment_ID;
     374        $output          = '';
    373375        /**
    374376         * Filters the content of the email at the beginning of the function that gets its content.
     
    383385        $output .= esc_html__( 'Hi there,', 'glotpress' );
    384386        $output .= '<br><br>';
    385         $url     = GP_Route_Translation_Helpers::get_permalink( $project->path, $original->id );
    386387        $output .= wp_kses(
    387388            /* translators: The discussion URL where the user can find the comment. */
    388             sprintf( __( 'There is a new comment in a <a href="%1$s">GlotPress discussion</a> that may be of interest to you.', 'glotpress' ), $url ),
     389            sprintf( __( 'There is a ),
    389390            array(
    390391                'a' => array( 'href' => array() ),
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/includes/class-gp-translation-helpers.php

    r11999 r12003  
    6161        add_action( 'rest_after_insert_comment', array( 'GP_Notifications', 'init' ), 10, 3 );
    6262        add_action( 'transition_comment_status', array( 'GP_Notifications', 'on_comment_status_change' ), 10, 3 );
    63         add_action( 'gp_pre_tmpl_load', array( $this, 'register_reject_feedback_js' ), 10, 2 );
    64         add_action( 'wp_ajax_reject_with_feedback', array( $this, 'reject_with_feedback' ) );
     63        add_action( 'gp_pre_tmpl_load', array( $this, 'register_t_feedback_js' ), 10, 2 );
     64        add_action( 'wp_ajax_t_with_feedback' ) );
    6565        add_action( 'wp_ajax_optout_discussion_notifications', array( $this, 'optout_discussion_notifications' ) );
    6666
     
    358358     * @return void
    359359     */
    360     public function register_reject_feedback_js( $template, $translation_set ) {
     360    public function register_t_feedback_js( $template, $translation_set ) {
    361361
    362362        if ( 'translations' !== $template ) {
     
    364364        }
    365365
    366         wp_register_script( 'gp-reject-feedback-js', plugins_url( '/../js/reject-feedback.js', __FILE__ ), array( 'jquery', 'gp-common', 'gp-editor', 'thickbox' ), '20220726' );
    367         gp_enqueue_script( 'gp-reject-feedback-js' );
     366        wp_register_script( 'gp-t-feedback-js', plugins_url( '/../js/reject-feedback.js', __FILE__ ), array( 'jquery', 'gp-common', 'gp-editor', 'thickbox' ), '20220726' );
     367        gp_enqueue_script( 'gp-t-feedback-js' );
    368368
    369369        wp_localize_script(
    370             'gp-reject-feedback-js',
    371             '$gp_reject_feedback_settings',
     370            'gp-t-feedback-js',
     371            '$gp_t_feedback_settings',
    372372            array(
    373                 'url'            => admin_url( 'admin-ajax.php' ),
    374                 'nonce'          => wp_create_nonce( 'gp_reject_feedback' ),
    375                 'locale_slug'    => $translation_set['locale_slug'],
    376                 'reject_reasons' => Helper_Translation_Discussion::get_reject_reasons(),
     373                'url'            => admin_url( 'admin-ajax.php' ),
     374                'nonce'          t_feedback' ),
     375                'locale_slug'    => $translation_set['locale_slug'],
     376                't_reasons(),
    377377            )
    378378        );
     
    380380
    381381    /**
    382      * Is called from the AJAX request in reject-feedback.js to submit a rejection feedback.
     382     * Is called from the AJAX request in reject-feedback.js to submit a feedback.
    383383     *
    384384     * @since 0.0.2
     
    386386     * @return void
    387387     */
    388     public function reject_with_feedback() {
    389         check_ajax_referer( 'gp_reject_feedback', 'nonce' );
     388    public function t_with_feedback() {
     389        check_ajax_referer( 'gp_t_feedback', 'nonce' );
    390390
    391391        $helper_discussion    = new Helper_Translation_Discussion();
     
    393393        $translation_id_array = ! empty( $_POST['data']['translation_id'] ) ? array_map( array( $helper_discussion, 'sanitize_translation_id' ), $_POST['data']['translation_id'] ) : null;
    394394        $original_id_array    = ! empty( $_POST['data']['original_id'] ) ? array_map( array( $helper_discussion, 'sanitize_original_id' ), $_POST['data']['original_id'] ) : null;
    395         $reject_reason        = ! empty( $_POST['data']['reason'] ) ? $_POST['data']['reason'] : array( 'other' );
    396         $all_reject_reasons   = array_keys( Helper_Translation_Discussion::get_reject_reasons() );
    397         $reject_reason        = array_filter(
    398             $reject_reason,
    399             function( $reason ) use ( $all_reject_reasons ) {
    400                 return in_array( $reason, $all_reject_reasons );
    401             }
    402         );
    403         $reject_comment       = sanitize_text_field( $_POST['data']['comment'] );
    404 
    405         if ( ! $locale_slug || ! $translation_id_array || ! $original_id_array || ( ! $reject_reason && ! $reject_comment ) ) {
     395        $       = ! empty( $_POST['data']['reason'] ) ? $_POST['data']['reason'] : array( 'other' );
     396        $all_t_reasons() );
     397        $       = array_filter(
     398            $t_reason,
     399            function( $reason ) use ( $all_t_reasons ) {
     400                return in_array( $reason, $all_t_reasons );
     401            }
     402        );
     403        $       = sanitize_text_field( $_POST['data']['comment'] );
     404
     405        if ( ! $locale_slug || ! $translation_id_array || ! $original_id_array || ( ! $comment ) ) {
    406406            wp_send_json_error();
    407407        }
     
    412412
    413413        // Post comment on discussion page for the first string
    414         $first_comment_id = $this->insert_reject_comment( $reject_comment, $first_original_id, $reject_reason, $first_translation_id, $locale_slug, $_SERVER );
     414        $first_comment_id = $this->insert_t_reason, $first_translation_id, $locale_slug, $_SERVER );
    415415
    416416        if ( ! empty( $original_id_array ) && ! empty( $translation_id_array ) ) {
    417417            // For other strings post link to the comment.
    418             $reject_comment = get_comment_link( $first_comment_id );
     418            $comment = get_comment_link( $first_comment_id );
    419419            foreach ( $original_id_array as $index => $single_original_id ) {
    420                 $comment_id = $this->insert_reject_comment( $reject_comment, $single_original_id, $reject_reason, $translation_id_array[ $index ], $locale_slug, $_SERVER );
     420                $comment_id = $this->insert_t_reason, $translation_id_array[ $index ], $locale_slug, $_SERVER );
    421421                $comment    = get_comment( $comment_id );
    422422                GP_Notifications::add_related_comment( $comment );
     
    464464
    465465    /**
    466      * Inserts rejection feedback as WordPress comment
    467      *
     466     * Inserts feedback as WordPress comment.
     467     *
     468     *  @param string $comment        Feedback entered by reviewer.
     469     *  @param int    $original_id    ID of the original where the comment will be added.
     470     *  @param array  $reason         Reason(s) for comment.
     471     *  @param string $translation_id ID of the commented translation.
     472     *  @param string $locale_slug    Locale of the commented translation.
     473     *  @param array  $server         The $_SERVER array
     474     *
     475     * @return false|int
    468476     * @since 0.0.2
    469      *
    470      *  @param string $reject_comment Feedback entered by reviewer.
    471      *  @param int    $original_id ID of the original where the comment will be added.
    472      *  @param array  $reject_reason Reason(s) for rejection.
    473      *  @param string $translation_id ID of the rejected translation.
    474      *  @param string $locale_slug    Locale of the rejected translation.
    475      *  @param array  $server         The $_SERVER array
    476      *
    477      * @return false|int
    478      */
    479     private function insert_reject_comment( $reject_comment, $original_id, $reject_reason, $translation_id, $locale_slug, $server ) {
     477     */
     478    private function insert_comment( $comment, $original_id, $reason, $translation_id, $locale_slug, $server ) {
    480479        $post_id = Helper_Translation_Discussion::get_or_create_shadow_post_id( $original_id );
    481480        $user    = wp_get_current_user();
     
    487486                'comment_author_url'   => $user->user_url,
    488487                'comment_author_IP'    => sanitize_text_field( $server['REMOTE_ADDR'] ),
    489                 'comment_content'      => $reject_comment,
     488                'comment_content'      => $comment,
    490489                'comment_agent'        => sanitize_text_field( $server['HTTP_USER_AGENT'] ),
    491490                'user_id'              => $user->ID,
    492491                'comment_meta'         => array(
    493                     'reject_reason'  => $reject_reason,
     492                    'reject_reason'  => $reason,
    494493                    'translation_id' => $translation_id,
    495494                    'locale'         => $locale_slug,
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/includes/class-wporg-notifications.php

    r11921 r12003  
    298298     */
    299299    public static function get_email_body( WP_Comment $comment, ?array $comment_meta ): ?string {
    300         $project  = self::get_project_from_post_id( $comment->comment_post_ID );
    301         $original = self::get_original( $comment->comment_post_ID );
    302         $output   = esc_html__( 'Hi:' );
    303         $output  .= '<br><br>';
    304         $output  .= esc_html__( 'There is a new comment in a discussion of the WordPress translation system that may be of interest to you.' );
    305         $output  .= '<br>';
    306         $output  .= esc_html__( 'It would be nice if you have some time to review this comment and reply to it if needed.' );
    307         $output  .= '<br><br>';
    308         $url      = GP_Route_Translation_Helpers::get_permalink( $project->path, $original->id );
    309         $output  .= '- <strong>' . esc_html__( 'Discussion URL: ' ) . '</strong><a href="' . $url . '">' . $url . '</a><br>';
     300        $project         = self::get_project_from_post_id( $comment->comment_post_ID );
     301        $original        = self::get_original( $comment->comment_post_ID );
     302        $url             = GP_Route_Translation_Helpers::get_permalink( $project->path, $original->id );
     303        $link_to_comment = $url . '#comment-' . $comment->comment_ID;
     304        $output          = esc_html__( 'Hi:' );
     305        $output         .= '<br><br>';
     306        $output         .= wp_kses(
     307            /* translators: The comment URL where the user can find the comment. */
     308            sprintf( __( 'There is a <a href="%1$s">new comment in a discussion</a> of the WordPress translation system that may be of interest to you.', 'glotpress' ), $link_to_comment ),
     309            array(
     310                'a' => array( 'href' => array() ),
     311            )
     312        ) . '<br>';
     313        $output .= esc_html__( 'It would be nice if you have some time to review this comment and reply to it if needed.' );
     314        $output .= '<br><br>';
     315        $output .= '- <strong>' . esc_html__( 'Discussion URL: ' ) . '</strong><a href="' . $url . '">' . $url . '</a><br>';
    310316        if ( array_key_exists( 'locale', $comment_meta ) && ( ! empty( $comment_meta['locale'][0] ) ) ) {
    311317            $output .= '- <strong>' . esc_html__( 'Locale: ' ) . '</strong>' . esc_html( $comment_meta['locale'][0] ) . '<br>';
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/js/reject-feedback.js

    r11999 r12003  
    1 /* global $gp, $gp_reject_feedback_settings, document, tb_show */
     1/* global $gp, $gp_t_feedback_settings, document, tb_show */
    22( function( $, $gp ) {
    33    $( document ).ready(
     
    5959            $( 'body' ).on( 'click', '#modal-reject-btn', function( e ) {
    6060                var comment = '';
    61                 var rejectReason = [];
    62                 var rejectData = {};
     61                var tReason = [];
     62                var tData = {};
    6363                var form = $( this ).closest( 'form' );
    6464
    6565                form.find( 'input[name="modal_feedback_reason"]:checked' ).each(
    6666                    function() {
    67                         rejectReason.push( this.value );
     67                        tReason.push( this.value );
    6868                    }
    6969                );
     
    7171                comment = form.find( 'textarea[name="modal_feedback_comment"]' ).val();
    7272
    73                 if ( ( ! comment.trim().length && ! rejectReason.length ) || ( ! translationIds.length || ! originalIds.length ) ) {
     73                if ( ( ! comment.trim().length && ! tReason.length ) || ( ! translationIds.length || ! originalIds.length ) ) {
    7474                    $( 'form.filters-toolbar.bulk-actions, form#bulk-actions-toolbar-top' ).submit();
    7575                }
    7676
    77                 rejectData.locale_slug = $gp_reject_feedback_settings.locale_slug;
    78                 rejectData.reason = rejectReason;
    79                 rejectData.comment = comment;
    80                 rejectData.original_id = originalIds;
    81                 rejectData.translation_id = translationIds;
    82                 rejectData.is_bulk_reject = true;
    83                 rejectWithFeedback( rejectData );
     77                t_feedback_settings.locale_slug;
     78                tReason;
     79                tData.comment = comment;
     80                tData.original_id = originalIds;
     81                tData.translation_id = translationIds;
     82                tData.is_bulk_reject = true;
     83                );
    8484                e.preventDefault();
    8585            } );
     
    9191    );
    9292
     93
     94
     95
     96
     97
     98
     99
     100
    93101    $gp.editor.hooks.set_status_rejected = function() {
    94         var button = $( this );
    95         var rejectData = {};
    96         var rejectReason = [];
     102        setStatus( $( this ), 'rejected' );
     103    };
     104
     105    function setStatus( that, status ) {
     106        var button = $( that );
     107        var feedbackData = {};
     108        var commentReason = [];
    97109        var comment = '';
    98110        var div = button.closest( 'div.meta' );
     
    100112        div.find( 'input[name="feedback_reason"]:checked' ).each(
    101113            function() {
    102                 rejectReason.push( this.value );
     114                tReason.push( this.value );
    103115            }
    104116        );
     
    106118        comment = div.find( 'textarea[name="feedback_comment"]' ).val();
    107119
    108         if ( ! comment.trim().length && ! rejectReason.length ) {
    109             $gp.editor.set_status( button, 'rejected' );
     120        if ( ! comment.trim().length && ! tReason.length ) {
     121            $gp.editor.set_status( button, );
    110122            return;
    111123        }
    112124
    113         rejectData.locale_slug = $gp_reject_feedback_settings.locale_slug;
    114         rejectData.reason = rejectReason;
    115         rejectData.comment = comment;
    116         rejectData.original_id = [ $gp.editor.current.original_id ];
    117         rejectData.translation_id = [ $gp.editor.current.translation_id ];
     125        t_feedback_settings.locale_slug;
     126        tReason;
     127        Data.comment = comment;
     128        Data.original_id = [ $gp.editor.current.original_id ];
     129        Data.translation_id = [ $gp.editor.current.translation_id ];
    118130
    119         rejectWithFeedback( rejectData, button );
    120     };
     131        );
     132    }
    121133
    122     function rejectWithFeedback( rejectData, button ) {
     134    function ) {
    123135        var data = {};
    124136        var div = {};
     
    128140
    129141        data = {
    130             action: 'reject_with_feedback',
    131             data: rejectData,
     142            action: 't_with_feedback',
     143            data: Data,
    132144
    133             _ajax_nonce: $gp_reject_feedback_settings.nonce,
     145            _ajax_nonce: $gp_t_feedback_settings.nonce,
    134146        };
    135147
     
    138150                type: 'POST',
    139151
    140                 url: $gp_reject_feedback_settings.url,
     152                url: $gp_t_feedback_settings.url,
    141153                data: data,
    142154            }
    143155        ).done(
    144156            function() {
    145                 if ( rejectData.is_bulk_reject ) {
     157                if ( Data.is_bulk_reject ) {
    146158                    $( 'form.filters-toolbar.bulk-actions, form#bulk-actions-toolbar-top' ).submit();
    147159                } else {
    148                     $gp.editor.set_status( button, 'rejected' );
     160                    $gp.editor.set_status( button, );
    149161                    div.find( 'input[name="feedback_reason"]' ).prop( 'checked', false );
    150162                    div.find( 'textarea[name="feedback_comment"]' ).val( '' );
     
    164176
    165177    function getReasonList( ) {
    166         var rejectReasons = $gp_reject_feedback_settings.reject_reasons;
    167         var rejectList = '';
     178        var t_reasons;
     179        var tList = '';
    168180        var prefix = '';
    169181        var suffix = '';
     
    171183
    172184        // eslint-disable-next-line vars-on-top
    173         for ( var reason in rejectReasons ) {
    174             prefix = '<div class="modal-item"><label class="tooltip" title="' + rejectReasons[ reason ].explanation + '">';
    175             suffix = '</label> <span class="tooltip dashicons dashicons-info" title="' + rejectReasons[ reason ].explanation + '"></span></div>';
     185        for ( var reason in tReasons ) {
     186            prefix = '<div class="modal-item"><label class="tooltip" title="' + tReasons[ reason ].explanation + '">';
     187            suffix = '</label> <span class="tooltip dashicons dashicons-info" title="' + tReasons[ reason ].explanation + '"></span></div>';
    176188            inputName = 'modal_feedback_reason';
    177             rejectList += prefix + '<input type="checkbox" name="' + inputName + '" value="' + reason + '" /> ' + rejectReasons[ reason ].name + suffix;
     189            tReasons[ reason ].name + suffix;
    178190        }
    179         return rejectList;
     191        return tList;
    180192    }
    181193}( jQuery, $gp )
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/templates/translation-row-editor-meta-feedback.php

    r11999 r12003  
    88            <h3 class="feedback-reason-title"><?php esc_html_e( 'Type (Optional)', 'glotpress' ); ?></h3>
    99            <ul class="feedback-reason-list">
    10                 <?php
    11                 $reject_reasons = Helper_Translation_Discussion::get_reject_reasons();
    12                 foreach ( $reject_reasons as $key => $reason ) :
    13                     ?>
     10            <?php
     11                $t_reasons();
     12            t_reasons as $key => $reason ) :
     13                ?>
    1414                    <li>
    1515                        <label class="tooltip" title="<?php echo esc_attr( $reason['explanation'] ); ?>"><input type="checkbox" name="feedback_reason" value="<?php echo esc_attr( $key ); ?>" /><?php echo esc_html( $reason['name'] ); ?></label><span class="tooltip dashicons dashicons-info" title="<?php echo esc_attr( $reason['explanation'] ); ?>"></span>
Note: See TracChangeset for help on using the changeset viewer.