Changeset 6006 for sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/templates/consistency.php
- Timestamp:
- 10/07/2017 01:23:36 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/templates/consistency.php
r3117 r6006 11 11 12 12 13 <form action="" method="get" class="consistency-form"> 14 <p> 15 <input type="text" name="search" required value="<?php echo gp_esc_attr_with_entities( $search ); ?>" class="consistency-form-search" placeholder="Enter original to search for…"> 16 <?php 17 $options = []; 18 $options[''] = 'Select a locale'; 19 $options = array_merge( $options, $sets ); 20 echo gp_select( 'set', $options, $set, [ 'class' => 'consistency-form-locale', 'required' => 'required' ] ); 21 ?> 22 <button type="submit" class="consistency-form-submit">Search</button> 13 <form action="/consistency" method="get" class="consistency-form"> 14 <p class="consistency-fields"> 15 <span class="consistency-field"> 16 <label for="original">Original</label> 17 <input id="original" type="text" name="search" required value="<?php echo gp_esc_attr_with_entities( $search ); ?>" class="consistency-form-search" placeholder="Enter original to search for…"> 18 </span> 19 20 <span class="consistency-field"> 21 <label for="set">Locale</label> 22 <?php 23 $locale_options = [ 24 '' => 'Select a locale', 25 ]; 26 $locale_options = array_merge( $locale_options, $sets ); 27 echo gp_select( 28 'set', 29 $locale_options, 30 $set, 31 [ 32 'class' => 'consistency-form-locale', 33 'required' => 'required', 34 ] 35 ); 36 ?> 37 </span> 38 39 <span class="consistency-field"> 40 <label for="project">Project</label> 41 <?php 42 $project_options = [ 43 '' => 'All Projects', 44 ]; 45 $project_options = $project_options + $projects; 46 echo gp_select( 47 'project', 48 $project_options, 49 $project, 50 [ 51 'class' => 'consistency-form-project', 52 ] 53 ); 54 ?> 55 </span> 23 56 </p> 24 57 25 <p class="consistency-form-filters">58 <p> 26 59 <label> 27 60 <input type="checkbox" name="search_case_sensitive" value="1"<?php checked( $search_case_sensitive ); ?>> … … 30 63 </p> 31 64 65 <p> 66 <button type="submit" class="consistency-form-submit">Analyze</button> 67 </p> 32 68 </form> 33 69 … … 38 74 } elseif ( $performed_search && $results ) { 39 75 $translations_unique_count = count( $translations_unique ); 40 if ( 1 === $translations_unique_count ) { 76 $has_different_translations = $translations_unique_count > 1; 77 if ( ! $has_different_translations ) { 41 78 echo '<p class="notice">All originals have the same translations</p>'; 42 79 } else { 43 echo '<div class="notice wporg-notice-warning"><p>There are ' . $translations_unique_count . ' different translations. <a id="toggle-translations-unique" href="#show">View</a></p>';80 echo '<div id="translations-overview" class="notice wporg-notice-warning"><p>There are ' . $translations_unique_count . ' different translations. <a id="toggle-translations-unique" href="#show">View</a></p>'; 44 81 echo '<ul class="translations-unique hidden">'; 45 82 foreach ( $translations_unique as $translation ) { 46 83 printf( 47 '<li data-id="%s">%s</li>',48 md5( $translation),49 str_replace( ' ', '<span class="space"> </span>', esc_translation($translation ) )84 '<li>%s <a href="#%s">↓</a></li>', 85 str_replace( ' ', '<span class="space"> </span>', esc_translation( $translation ) ), 86 esc_attr( sanitize_title( 't-' . $translation ) ) 50 87 ); 51 88 } … … 62 99 <tbody> 63 100 <?php 101 $previous_translation = ''; 102 64 103 foreach ( $results as $result ) { 65 104 $project_name = $result->project_name; … … 76 115 ' <span class="context">%s</span>', 77 116 esc_translation( $result->original_context ) 117 ); 118 } 119 120 if ( $has_different_translations && $previous_translation !== $result->translation ) { 121 $previous_translation = $result->translation; 122 printf( 123 '<tr id="%s" class="new-translation"><td colspan="2"><strong>%s</strong> <a href="#translations-overview">↑</a></td></tr>', 124 esc_attr( sanitize_title( 't-' . $result->translation ) ), 125 esc_translation( $result->translation ) 78 126 ); 79 127 }
Note: See TracChangeset
for help on using the changeset viewer.