Making WordPress.org


Ignore:
Timestamp:
09/15/2022 03:13:17 PM (4 years ago)
Author:
amieiro
Message:

Translate. Add new status in the gp-translation-helpers plugin

File:
1 edited

Legend:

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

    r12014 r12063  
    6868                gp_enqueue_style( 'thickbox' );
    6969
    70                 wp_register_style( 'gp-discussion-css', plugins_url( '/../css/discussion.css', __FILE__ ), array(), '20220801' );
     70                wp_register_style(
     71                        'gp-discussion-css',
     72                        plugins_url( 'css/discussion.css', __DIR__ ),
     73                        array(),
     74                        filemtime( plugin_dir_path( __DIR__ ) . 'css/discussion.css' )
     75                );
    7176                gp_enqueue_style( 'gp-discussion-css' );
    7277
     
    7681                        'gp_tmpl_load_locations',
    7782                        function( $locations, $template, $args, $template_path ) {
    78                                 if ( 'translation-row-editor-meta-status' === $template ) {
     83                                if ( 'translation-row-editor-meta-status' === $template || 'locale-projects' === $template ) {
    7984                                        array_unshift( $locations, dirname( dirname( __FILE__ ) ) . '/templates/gp-templates-overrides/' );
    8085                                } else {
     
    190195                );
    191196
    192                 wp_register_style( 'gp-translation-helpers-css', plugins_url( 'css/translation-helpers.css', __DIR__ ), '', '20220801' ); // todo: add the version as global element.
     197                wp_register_style(
     198                        'gp-translation-helpers-css',
     199                        plugins_url( 'css/translation-helpers.css', __DIR__ ),
     200                        array(),
     201                        filemtime( plugin_dir_path( __DIR__ ) . 'css/translation-helpers.css' )
     202                );
    193203                gp_enqueue_style( 'gp-translation-helpers-css' );
    194204
    195                 wp_register_script( 'gp-translation-helpers', plugins_url( '/js/translation-helpers.js', __DIR__ ), array( 'gp-editor' ), '20220801', true );
     205                wp_register_script(
     206                        'gp-translation-helpers',
     207                        plugins_url( 'js/translation-helpers.js', __DIR__ ),
     208                        array( 'gp-editor' ),
     209                        filemtime( plugin_dir_path( __DIR__ ) . 'js/translation-helpers.js' ),
     210                        true
     211                );
    196212                gp_enqueue_scripts( array( 'gp-translation-helpers' ) );
    197213
     
    312328                GP::$router->prepend( "/$project/-get-translation-helpers/$id", array( 'GP_Route_Translation_Helpers', 'ajax_translation_helpers' ), 'get' );
    313329                GP::$router->prepend( "/$project/$locale/$dir/-get-translation-helpers/$id", array( 'GP_Route_Translation_Helpers', 'ajax_translation_helpers_locale' ), 'get' );
     330                GP::$router->prepend( "/locale/$locale/$dir/discussions/?", array( 'GP_Route_Translation_Helpers', 'discussions_dashboard' ), 'get' );
    314331        }
    315332
     
    364381                }
    365382
    366                 wp_register_script( 'gp-comment-feedback-js', plugins_url( '/../js/reject-feedback.js', __FILE__ ), array( 'jquery', 'gp-common', 'gp-editor', 'thickbox' ), '20220812' );
     383                wp_register_script(
     384                        'gp-comment-feedback-js',
     385                        plugins_url( 'js/reject-feedback.js', __DIR__ ),
     386                        array( 'jquery', 'gp-common', 'gp-editor', 'thickbox' ),
     387                        filemtime( plugin_dir_path( __DIR__ ) . 'js/reject-feedback.js' )
     388                );
    367389                gp_enqueue_script( 'gp-comment-feedback-js' );
    368390
     
    403425                $comment              = sanitize_text_field( $_POST['data']['comment'] );
    404426
    405                 if ( ! $locale_slug || ! $translation_id_array || ! $original_id_array || ( ! $comment_reason && ! $comment ) ) {
    406                         wp_send_json_error();
     427                if ( ! $locale_slug ) {
     428                        wp_send_json_error( 'Oops! Locale slug missing' );
     429                }
     430                if ( ! $translation_id_array ) {
     431                        wp_send_json_error( 'Oops! Translation ID missing' );
     432                }
     433                if ( ! $original_id_array ) {
     434                        wp_send_json_error( 'Oops! Original ID missing' );
     435                }
     436                if ( ! $comment_reason && ! $comment ) {
     437                        wp_send_json_error( 'Oops! No comment and reason found' );
    407438                }
    408439
Note: See TracChangeset for help on using the changeset viewer.