Index: /sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-discussions/css/translation-discussions.css =================================================================== --- /sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-discussions/css/translation-discussions.css (revision 8987) +++ /sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-discussions/css/translation-discussions.css (revision 8987) @@ -0,0 +1,67 @@ +.feedback-modal .wporg-translate-modal__frame { + max-width: 500px; +} + +.feedback-modal .wporg-translate-modal__content { + display: block; +} + +.feedback-modal textarea { + max-width: 100%; + min-height: 100px; + padding: 10px; + margin: 0 0 15px 0; + border-top: 1px solid; + border-bottom: 1px solid; + border-color: #e2e4e7; + background: #fff; + outline: none; +} + +.feedback-modal textarea:focus { + box-shadow: 0 0 2px 1px #33b3db; +} + +.feedback__actions { + text-align: right; +} + +.feedback-modal .feedback__action-submit { + font-size: 15px; + height: 35px; + line-height: 1; + background: #0085ba; + border-color: #0073aa #006799 #006799; + box-shadow: 0 1px 0 #006799; + color: #fff; + text-decoration: none; + text-shadow: 0 -1px 1px #006799, 1px 0 1px #006799, 0 1px 1px #006799, -1px 0 1px #006799; +} + + +.feedback-modal .feedback__action-submit:hover { + background: #008ec2; + border-color: #006799; + color: #fff; +} + +.feedback-modal .feedback__action-submit:focus { + background: #008ec2; + border-color: #006799; + box-shadow: 0 1px 0 #0073aa, 0 0 2px 1px #33b3db; + color: #fff; +} + +.feedback-modal ul.feedback__reasons { + list-style: none; + padding: 0; + margin: 0 0 15px 0; + column-count: 2; +} + + +@media (min-width: 600px) { + .feedback-modal ul.feedback__reasons { + column-count: 3; + } +} Index: /sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-discussions/inc/class-plugin.php =================================================================== --- /sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-discussions/inc/class-plugin.php (revision 8986) +++ /sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-discussions/inc/class-plugin.php (revision 8987) @@ -43,4 +43,41 @@ add_action( 'wporg_translate_meta', [ $this, 'show_discussion_meta' ] ); + add_action( 'gp_pre_tmpl_load', [ $this, 'pre_tmpl_load' ], 10, 2 ); + } + + /** + * Enqueue custom styles and scripts. + */ + public function pre_tmpl_load( $template, $args ) { + if ( 'translations' !== $template || ! is_user_logged_in() ) { + return; + } + + $blog_id = $this->get_blog_id( $args['locale_slug'] ); + if ( ! $blog_id ) { + return; + } + + wp_register_style( + 'gp-translation-discussions', + plugins_url( 'css/translation-discussions.css', PLUGIN_FILE ), + [], + '20190506' + ); + gp_enqueue_style( 'gp-translation-discussions' ); + + wp_register_script( + 'gp-translation-discussions', + plugins_url( '/js/translation-discussions.js', PLUGIN_FILE ), + [ 'gp-editor' ], + '20190510' + ); + + wp_localize_script( 'gp-translation-discussions', 'WPORG_TRANSLATION_DISCUSSION', [ + 'nonce' => wp_create_nonce( 'wp_rest' ), + 'endpoint' => get_rest_url( $blog_id ), + ] ); + + gp_enqueue_script( 'gp-translation-discussions' ); } @@ -52,13 +89,87 @@ public function show_discussion_meta( $entry ) { $set = GP::$translation_set->get( $entry->translation_set_id ); - $blog_id = $this->get_blog_id($set->locale ); + $blog_id = $this->get_blog_id( $set->locale ); if ( ! $blog_id ) { return; } - $rest_url = get_rest_url( $blog_id ); - - - echo 'đź“ť'; + + $reject_reasons = [ + 'style-guide' => 'Style Guide', + 'glossary' => 'Glossary', + 'grammar' => 'Grammar', + 'punctuation' => 'Punctuation', + 'branding' => 'Branding', + 'typos' => 'Typos', + ]; + + ?> +