Changeset 1684
- Timestamp:
- 06/23/2015 10:33:30 PM (9 years ago)
- Location:
- sites/trunk/translate.wordpress.org
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/translate.wordpress.org/includes/gp-plugins/wporg-routes/routes/locale.php
r1674 r1684 9 9 /** 10 10 * Prints all exisiting locales as cards. 11 *12 11 */ 13 12 public function get_locales() { … … 17 16 $locales[] = GP_Locales::by_slug( $locale ); 18 17 } 19 usort( $locales, array( $this, ' sort_locales') );18 usort( $locales, array( $this, '') ); 20 19 unset( $existing_locales ); 21 20 … … 34 33 35 34 /** 36 * Prints translation sets of a top level project.35 * Prints translation sets of a top level project. 37 36 * 38 37 * @param string $locale_slug Slug of the locale. 39 * @param string $ current_set_slugSlug of the translation set.40 * @param string $project_path Path of a project 41 */ 42 public function get_locale_projects( $locale_slug, $ current_set_slug = 'default', $project_path = 'wp' ) {38 * @param string $ Slug of the translation set. 39 * @param string $project_path Path of a project 40 */ 41 public function get_locale_projects( $locale_slug, $set_slug = 'default', $project_path = 'wp' ) { 43 42 $locale = GP_Locales::by_slug( $locale_slug ); 44 $sets = GP::$translation_set->by_locale( $locale_slug ); 45 usort( $sets, array( $this, 'sort_sets_by_project_id' ) ); 46 47 /*if ( $project_path ) { 48 $project = GP::$project->by_path( $project_path ); 49 50 if ( ! $project ) { 51 return $this->die_with_404(); 52 } 53 }*/ 54 55 $locale_projects = $projects_data = $projects = $parents = $set_slugs = $set_list = array(); 56 57 //TODO: switch to wp_list_pluck 58 foreach ( $sets as $key => $value ) { 59 $locale_projects[ $key ] = $value->project_id; 60 } 61 62 foreach ( $sets as $set ) { 63 $set_slugs[ $set->slug ] = $set; 64 65 if ( $current_set_slug != $set->slug ) { 66 continue; 67 } 68 69 // Store project data for later use 70 if ( isset( $projects[ $set->project_id ] ) ) { 71 $set_project = $projects[$set->project_id]; 72 } else { 73 $set_project = GP::$project->get( $set->project_id ); 74 $projects[$set->project_id] = $set_project; 75 } 76 77 // We only want to list active projects 78 if ( ! isset( $set_project->active ) || $set_project->active == false ) { 79 continue; 80 } 81 82 $parent_id = is_null( $set_project->parent_project_id ) ? $set_project->id : $set_project->parent_project_id; 83 84 // Store parent project data for later use 85 if ( isset( $projects[$parent_id] ) ) { 86 $parent_project = $projects[$parent_id]; 87 } else { 88 $parent_project = GP::$project->get( $parent_id ); 89 $projects[$parent_id] = $parent_project; 90 } 91 92 // Store parent id for 93 $parents[$set_project->id] = $parent_id; 94 95 if ( ! in_array( $set_project->parent_project_id, $locale_projects ) ) { 96 $projects_data[$parent_id][$set_project->id]['project'] = $set_project; 97 $projects_data[$parent_id][$set_project->id]['sets'][$set->id] = $this->set_data( $set, $set_project ); 98 $projects_data[$parent_id][$set_project->id]['totals'] = $this->set_data( $set, $set_project ); 99 100 if ( ! isset( $projects_data[$parent_id][$set_project->id]['project'] ) ) { 101 $projects_data[$parent_id][$set_project->id]['project'] = $set_project; 102 } 103 } else { 104 while ( ! in_array( $parent_id, array_keys( $projects_data ) ) && isset( $parents[$parent_id] ) ) { 105 $previous_parent = $parent_id; 106 $parent_id = $parents[$parent_id]; 107 } 108 109 //Orphan project - a sub project is set to active, while it's parent isn't 110 if ( ! isset( $projects_data[$parent_id] ) ) { 111 continue; 112 } 113 114 //For when root project has sets, and sub projects. 115 if ( ! isset( $previous_parent ) || ! isset( $projects_data[$parent_id][$previous_parent] ) ) { 116 $previous_parent = $parent_id; 117 } 118 119 $set_data = $projects_data[$parent_id][$previous_parent]['totals']; 120 $projects_data[$parent_id][$previous_parent]['sets'][$set->id] = $this->set_data( $set, $set_project ); 121 $projects_data[$parent_id][$previous_parent]['totals'] = $this->set_data( $set, $set_project, $set_data ); 122 } 123 } 124 125 if ( 'default' !== $current_set_slug && ! isset( $set_slugs[ $current_set_slug ] ) ) { 126 return $this->die_with_404(); 127 } 128 129 if ( $set_slugs ) { 130 // Make default the first item. 131 if ( ! empty( $set_slugs[ 'default' ] ) ) { 132 $default = $set_slugs[ 'default' ]; 133 unset( $set_slugs[ 'default' ] ); 134 array_unshift( $set_slugs, $default ); 135 } 136 137 foreach ( $set_slugs as $set ) { 138 if ( 'default' == $set->slug ) { 139 if ( 'default' != $current_set_slug ) { 140 $set_list[ $set->slug ] = gp_link_get( gp_url_join( '/languages', $locale->slug ), __( 'Default' ) ); 141 } else { 142 $set_list[ $set->slug ] = __( 'Default' ); 143 } 144 } else { 145 if ( $set->slug != $current_set_slug ) { 146 $set_list[ $set->slug ] = gp_link_get( gp_url_join('/languages', $locale->slug, $set->slug ), esc_html( $set->name ) ); 147 } else { 148 $set_list[ $set->slug ] = esc_html( $set->name ); 149 } 150 } 151 } 152 } 43 if ( ! $locale ) { 44 return $this->die_with_404(); 45 } 46 47 $project = GP::$project->by_path( $project_path ); 48 if ( ! $project ) { 49 return $this->die_with_404(); 50 } 51 52 $sub_projects = $this->get_active_sub_projects( $project ); 53 if ( ! $sub_projects ) { 54 return $this->die_with_404(); 55 } 56 57 usort( $sub_projects, array( $this, '_sort_name_callback' ) ); 58 59 $project_status = $project_icons = array(); 60 foreach ( $sub_projects as $key => $sub_project ) { 61 $status = $this->get_project_status( $sub_project, $locale_slug, $set_slug ); 62 if ( ! $status->sub_projects_count ) { 63 unset( $sub_projects[ $key ] ); 64 } 65 66 $project_status[ $sub_project->id ] = $status; 67 $project_icons[ $sub_project->id ] = $this->get_project_icon( $project, $sub_project ); 68 } 69 70 $contributors_count = wp_cache_get( 'contributors-count', 'wporg-translate' ); 71 if ( false === $contributors_count ) { 72 $contributors_count = array(); 73 } 74 75 $top_level_projects = GP::$project->top_level(); 76 usort( $top_level_projects, array( $this, '_sort_reverse_name_callback' ) ); 77 78 $variants = $this->get_locale_variants( $locale_slug, array_keys( $project_status ) ); 153 79 154 80 $this->tmpl( 'locale', get_defined_vars() ); 155 81 } 156 82 157 private function set_data( $set, $project, $set_data = null ) { 158 if ( ! $set_data ) { 159 $set_data = new stdClass; 160 161 $set_data->slug = $set->slug; 162 $set_data->project_path = $project->path; 163 $set_data->waiting_count = $set->waiting_count(); 164 $set_data->current_count = $set->current_count(); 165 $set_data->fuzzy_count = $set->fuzzy_count(); 166 $set_data->all_count = $set->all_count(); 167 } 168 else { 169 $set_data->waiting_count += $set->waiting_count(); 170 $set_data->current_count += $set->current_count(); 171 $set_data->fuzzy_count += $set->fuzzy_count(); 172 $set_data->all_count += $set->all_count(); 173 } 174 175 if ( ! isset( $set_data->name ) ) { 176 $set_data->name = $project->name; 177 } 178 179 return $set_data; 180 } 181 182 private function sort_locales( $a, $b ) { 83 /** 84 * Prints projects/translation sets of a sub project. 85 * 86 * @param string $locale_slug Slug of the locale. 87 * @param string $set_slug Slug of the translation set. 88 * @param string $project_path Path of a project. 89 * @param string $sub_project_path Path of a sub project. 90 */ 91 public function get_locale_project( $locale_slug, $set_slug, $project_path, $sub_project_path ) { 92 $locale = GP_Locales::by_slug( $locale_slug ); 93 if ( ! $locale ) { 94 return $this->die_with_404(); 95 } 96 97 $project = GP::$project->by_path( $project_path ); 98 if ( ! $project ) { 99 return $this->die_with_404(); 100 } 101 102 $sub_project = GP::$project->by_path( $project_path . '/' . $sub_project_path ); 103 if ( ! $sub_project ) { 104 return $this->die_with_404(); 105 } 106 107 $project_status = $this->get_project_status( $sub_project, $locale_slug, $set_slug ); 108 $sub_project_status = $this->get_project_status( $sub_project, $locale_slug, $set_slug, null, false ); 109 110 $project_icon = $this->get_project_icon( $project, $sub_project, 64 ); 111 112 $contributors_count = wp_cache_get( 'contributors-count', 'wporg-translate' ); 113 if ( false === $contributors_count ) { 114 $contributors_count = array(); 115 } 116 117 $sub_projects = $this->get_active_sub_projects( $sub_project, true ); 118 if ( $sub_projects ) { 119 $sub_project_statuses = array(); 120 foreach ( $sub_projects as $key => $_sub_project ) { 121 $status = $this->get_project_status( $_sub_project, $locale_slug, $set_slug ); 122 if ( ! $status->all_count ) { 123 unset( $sub_projects[ $key ] ); 124 } 125 126 $sub_project_statuses[ $_sub_project->id ] = $status; 127 } 128 129 $variants = $this->get_locale_variants( $locale_slug, array_keys( $sub_project_statuses ) ); 130 } else { 131 $variants = $this->get_locale_variants( $locale_slug, array( $sub_project->id ) ); 132 } 133 134 $this->tmpl( 'locale-project', get_defined_vars() ); 135 } 136 137 /** 138 * Returns markup for project icons. 139 * 140 * @param GP_Project $project A GlotPress project. 141 * @param GP_Project $sub_project A sub project of a GlotPress project. 142 * @param int $size Size of icon. 143 * @return string HTML markup of an icon. 144 */ 145 private function get_project_icon( $project, $sub_project, $size = 128 ) { 146 switch( $project->slug ) { 147 case 'wp': 148 return '<div class="wordpress-icon"><span class="dashicons dashicons-wordpress-alt"></span></div>'; 149 case 'bbpress': 150 case 'buddypress': 151 require_once WPORGPATH . 'extend/plugins-plugins/_plugin-icons.php'; 152 if ( function_exists( 'wporg_get_plugin_icon' ) ) { 153 return wporg_get_plugin_icon( $project->slug, $size ); 154 } 155 case 'wp-plugins': 156 require_once WPORGPATH . 'extend/plugins-plugins/_plugin-icons.php'; 157 if ( function_exists( 'wporg_get_plugin_icon' ) ) { 158 return wporg_get_plugin_icon( $sub_project->slug, $size ); 159 } 160 default: 161 return '<div class="default-icon"><span class="dashicons dashicons-translation"></span></div>'; 162 } 163 } 164 165 /** 166 * Retrieves non-default slugs of translation sets for a list of 167 * project IDs. 168 * 169 * @param string $locale Slug of a GlotPress locale. 170 * @param array $project_ids List of project IDs. 171 * @return array List of non-default slugs. 172 */ 173 private function get_locale_variants( $locale, $project_ids ) { 174 global $gpdb; 175 176 $table = GP::$translation_set->table; 177 $project_ids = implode( ',', $project_ids ); 178 $slugs = $gpdb->get_col( $gpdb->prepare( " 179 SELECT DISTINCT(slug), name 180 FROM $table 181 WHERE 182 project_id IN( $project_ids ) 183 AND locale = %s 184 ", $locale ) ); 185 186 return $slugs; 187 } 188 189 /** 190 * Calculates the status of a project. 191 * 192 * @param GP_Project $project The GlotPress project. 193 * @param string $locale Slug of GlotPress locale. 194 * @param string $set_slug Slug of the translation set. 195 * @param object $status The status object. 196 * @param bool $calc_sub_projects Whether sub projects should be calculated too. 197 * Default true. 198 * @return object The status of a project. 199 */ 200 private function get_project_status( $project, $locale, $set_slug, $status = null, $calc_sub_projects = true ) { 201 if ( null === $status ) { 202 $status = new stdClass; 203 $status->sub_projects_count = 0; 204 $status->waiting_count = 0; 205 $status->current_count = 0; 206 $status->fuzzy_count = 0; 207 $status->all_count = 0; 208 } 209 210 $set = GP::$translation_set->by_project_id_slug_and_locale( 211 $project->id, 212 $set_slug, 213 $locale 214 ); 215 216 if ( $set ) { 217 $status->sub_projects_count += 1; 218 $status->waiting_count += (int) $set->waiting_count(); 219 $status->current_count += (int) $set->current_count(); 220 $status->fuzzy_count += (int) $set->fuzzy_count(); 221 $status->all_count += (int) $set->all_count(); 222 } 223 224 if ( $calc_sub_projects ) { 225 $sub_projects = $this->get_active_sub_projects( $project, true ); 226 if ( $sub_projects ) { 227 foreach ( $sub_projects as $sub_project ) { 228 $this->get_project_status( $sub_project, $locale, $set_slug, $status ); 229 } 230 } 231 } 232 233 return $status; 234 } 235 236 /** 237 * Retrieves active sub projects. 238 * 239 * @param GP_Project $project The parent project 240 * @param bool $with_sub_projects Whether sub projects should be fetched too. 241 * Default false. 242 * @return array List of sub projects. 243 */ 244 private function get_active_sub_projects( $project, $with_sub_projects = false ) { 245 $_projects = $project->many( " 246 SELECT * 247 FROM $project->table 248 WHERE 249 parent_project_id = %d AND 250 active = 1 251 ORDER BY id ASC 252 ", $project->id ); 253 254 $projects = array(); 255 foreach ( $_projects as $project ) { 256 $projects[ $project->id ] = $project; 257 258 if ( $with_sub_projects ) { 259 // e.g. wp/dev/admin/network 260 $sub_projects = $project->many( " 261 SELECT * 262 FROM $project->table 263 WHERE 264 parent_project_id = %d AND 265 active = 1 266 ORDER BY id ASC 267 ", $project->id ); 268 269 foreach ( $sub_projects as $sub_project ) { 270 $projects[ $sub_project->id ] = $sub_project; 271 } 272 unset( $sub_projects); 273 } 274 } 275 unset( $_projects ); 276 277 return $projects; 278 } 279 280 private function _sort_reverse_name_callback( $a, $b ) { 281 return - strcasecmp( $a->name, $b->name ); 282 } 283 284 private function _sort_name_callback( $a, $b ) { 285 return strcasecmp( $a->name, $b->name ); 286 } 287 288 private function _sort_english_name_callback( $a, $b ) { 183 289 return $a->english_name > $b->english_name; 184 290 } 185 186 private function sort_sets_by_project_id( $a, $b ) {187 return $a->project_id > $b->project_id;188 }189 291 } -
sites/trunk/translate.wordpress.org/includes/gp-plugins/wporg-routes/wporg-routes.php
r1674 r1684 31 31 32 32 GP::$router->add( '/', array( 'GP_WPorg_Route_Index', 'get_index' ) ); 33 GP::$router->add( '/languages', array( 'GP_WPorg_Route_Locale', 'get_locales' ) );33 GP::$router->add( ' ) ); 34 34 GP::$router->add( "/languages/$locale/$path/$path", array( 'GP_WPorg_Route_Locale', 'get_locale_projects' ) ); 35 35 GP::$router->add( "/languages/$locale/$path", array( 'GP_WPorg_Route_Locale', 'get_locale_projects' ) ); 36 36 GP::$router->add( "/languages/$locale", array( 'GP_WPorg_Route_Locale', 'get_locale_projects' ) ); 37 37 38 } 38 39 } -
sites/trunk/translate.wordpress.org/public_html/gp-templates/locale.php
r1586 r1684 2 2 gp_title( sprintf( __( 'Projects translated to %s < GlotPress' ), esc_html( $locale->english_name ) ) ); 3 3 4 $breadcrumb = array();4 $breadcrumb = array(); 5 5 $breadcrumb[] = gp_link_get( '/languages', __( 'Locales' ) ); 6 if ( 'default' == $current_set_slug ) { 7 $breadcrumb[] = esc_html( $locale->english_name ); 8 } else { 9 $breadcrumb[] = gp_link_get( gp_url_join( '/languages', $locale->slug ), esc_html( $locale->english_name ) ); 10 $breadcrumb[] = $set_list[ $current_set_slug ]; 11 } 6 $breadcrumb[] = esc_html( $locale->english_name ); 12 7 gp_breadcrumb( $breadcrumb ); 13 8 gp_tmpl_header(); 14 9 ?> 15 10 16 <h2><?php printf( __( 'Active Projects translated to %s' ), esc_html( $locale->english_name ) ); ?></h2> 11 <div class="locale-header"> 12 <p class="locale-intro">Translate WordPress, core projects, plugins, and themes into your language. Select your project below to get started.</p> 17 13 18 <?php if ( count( $set_list ) > 1 ) : ?> 19 <p class="actionlist secondary"> 20 <?php echo implode( ' • ', $set_list ); ?> 21 </p> 22 <?php endif; ?> 14 <div class="locale-box"> 15 <ul class="name"> 16 <li class="english"><?php echo $locale->english_name; ?></li> 17 <li class="native"><?php echo $locale->native_name; ?></li> 18 <li class="code"> 19 <?php 20 echo $locale->wp_locale; 23 21 24 <?php 25 if ( empty( $projects_data ) ) { 26 _e( 'No active projects found.' ); 27 } 28 ?> 22 if ( count( $variants ) > 1 ) { 23 ?> 24 <select id="variant-selector" name="variant"> 25 <?php 26 foreach ( $variants as $variant ) { 27 $selected = 28 printf( 29 '<option name="%s" data-project-url="%s"%s>%s</option>', 30 $variant, 31 esc_url( gp_url_join( '/languages', $locale_slug, $variant, $project->slug ) ), 32 ( $set_slug == $variant ) ? ' selected="selected"' : '', 33 ucfirst( $variant ) 34 ); 35 } 36 ?> 37 </select> 38 <?php 39 } 40 ?> 41 </li> 42 </ul> 43 <div class="contributors"> 44 <?php 45 $contributors = sprintf( 46 '<span class="dashicons dashicons-admin-users"></span><br />%s', 47 isset( $contributors_count[ $locale->slug ] ) ? $contributors_count[ $locale->slug ] : 0 48 ); 49 echo gp_link_get( 'https://make.wordpress.org/polyglots/teams/?locale=' . $locale->wp_locale, $contributors ); 50 ?> 51 </div> 52 </div> 53 </div> 29 54 30 <?php foreach ( $projects_data as $project_id => $sub_projects ) : ?> 31 <div class="locale-project"> 32 <h3><?php echo ( $projects[$project_id]->name );?></h3> 33 <table class="locale-sub-projects"> 34 <thead> 35 <tr> 36 <th class="header" <?php if (count($sub_projects)>1 ) echo 'rowspan="'. count($sub_projects) . '"';?>><?php if (count($sub_projects)>1 ) _e( 'Project' ); ?></th> 37 <th class="header"><?php _e( 'Set / Sub Project' ); ?></th> 38 <th><?php _e( 'Translated' ); ?></th> 39 <th><?php _e( 'Fuzzy' ); ?></th> 40 <th><?php _e( 'Untranslated' ); ?></th> 41 <th><?php _e( 'Waiting' ); ?></th> 42 </tr> 43 </thead> 44 <tbody> 45 <?php foreach ( $sub_projects as $sub_project_id => $data ) : ?> 46 <tr> 47 <th class="sub-project" rowspan="<?php echo count( $data['sets'] ); ?>"> 48 <?php if (count($sub_projects)>1 ) echo esc_html( $projects[$sub_project_id]->name ); ?> 49 <div class="stats"> 50 <div class="total-strings"><?php printf( __( '%d strings' ), $data['totals']->all_count ); ?></div> 51 <div class="percent-completed"><?php printf( __( '%d%% translated' ), $data['totals']->current_count ? floor( absint($data['totals']->current_count ) / absint( $data['totals']->all_count ) * 100 ) : 0 ); ?></div> 52 </div> 53 </th> 54 <?php foreach ( $data['sets'] as $set_id => $set_data ) : ?> 55 <?php reset( $data['sets'] ); if ( $set_id !== key($data['sets']) ) echo '<tr>'; ?> 56 <td class="set-name"> 57 <strong><?php gp_link( gp_url_project( $set_data->project_path, gp_url_join( $locale->slug, $set_data->slug ) ), $set_data->name ); ?></strong> 58 <?php if ( $set_data->current_count && $set_data->current_count >= $set_data->all_count * 0.9 ): 59 $percent = floor( $set_data->current_count / $set_data->all_count * 100 ); 60 ?> 61 <span class="bubble morethan90"><?php echo $percent; ?>%</span> 62 <?php endif;?> 63 </td> 64 <td class="stats translated"><?php gp_link( gp_url_project( $set_data->project_path, gp_url_join( $locale->slug, $set_data->slug ), array('filters[translated]' => 'yes', 'filters[status]' => 'current') ), absint( $set_data->current_count ) ); ?></td> 65 <td class="stats fuzzy"><?php gp_link( gp_url_project( $set_data->project_path, gp_url_join( $locale->slug, $set_data->slug ), array('filters[status]' => 'fuzzy' ) ), absint( $set_data->fuzzy_count ) ); ?></td> 66 <td class="stats untranslated"><?php gp_link( gp_url_project( $set_data->project_path, gp_url_join( $locale->slug, $set_data->slug ), array('filters[status]' => 'untranslated' ) ), absint( $set_data->all_count ) - absint( $set_data->current_count ) ); ?></td> 67 <td class="stats waiting"><?php gp_link( gp_url_project( $set_data->project_path, gp_url_join( $locale->slug, $set_data->slug ), array('filters[translated]' => 'yes', 'filters[status]' => 'waiting') ), absint( $set_data->waiting_count ) ); ?></td> 68 </tr> 69 <?php endforeach; //sub project slugs ?> 70 </tr> 71 <?php endforeach; //sub projects ?> 72 </tbody> 73 </table> 55 <div class="filter-header"> 56 <ul class="filter-header-links"> 57 <?php 58 foreach ( $top_level_projects as $top_level_project ) { 59 printf( 60 '<li><a href="%s"%s>%s</a></li>', 61 gp_url_join( '/languages', $locale_slug, $set_slug, $top_level_project->slug ), 62 ( $top_level_project->path == $project_path ) ? ' class="current"' : '', 63 $top_level_project->name 64 ); 65 } 66 ?> 67 </ul> 68 <div class="search-form"> 69 <label class="screen-reader-text" for="projects-filter"><?php esc_attr_e( 'Search projects...' ); ?></label> 70 <input placeholder="<?php esc_attr_e( 'Search projects...' ); ?>" type="search" id="projects-filter" class="filter-search"> 74 71 </div> 75 < ?php endforeach; //top projects ?>72 <> 76 73 77 <p class="actionlist secondary"> 78 <?php gp_link( '/projects', __('All projects') ); ?> 79 </p> 74 <div id="projects" class="projects"> 75 <?php 76 foreach ( $sub_projects as $sub_project ) { 77 $percent_complete = $waiting = $sub_projects_count = 0; 78 if ( isset( $project_status[ $sub_project->id ] ) ) { 79 $status = $project_status[ $sub_project->id ]; 80 $percent_complete = floor( $status->current_count / $status->all_count * 100 ); 81 $waiting = $status->waiting_count; 82 $sub_projects_count = $status->sub_projects_count; 83 } 84 85 $project_url = gp_url_join( '/languages', $locale_slug, $set_slug, $sub_project->path ); 86 87 $project_icon = ''; 88 if ( isset( $project_icons[ $sub_project->id ] ) ) { 89 $project_icon = $project_icons[ $sub_project->id ]; 90 } 91 92 $classes = 'project-' . sanitize_title_with_dashes( str_replace( '/', '-', $project->path ) ); 93 $classes .= ' project-' . sanitize_title_with_dashes( str_replace( '/', '-', $sub_project->path ) ); 94 $classes .= ' percent-' . $percent_complete; 95 ?> 96 <div class="project <?php echo $classes; ?>"> 97 <div class="project-top"> 98 <div class="project-icon"> 99 <?php echo gp_link_get( $project_url, $project_icon ) ?> 100 </div> 101 102 <div class="project-name"> 103 <h4> 104 <?php echo gp_link_get( $project_url, $sub_project->name ) ?> 105 </h4> 106 </div> 107 <div class="project-description"> 108 <p><?php echo $sub_project->description; ?></p> 109 </div> 110 </div> 111 112 <div class="project-status"> 113 <div class="project-status-sub-projects"> 114 <span class="project-status-title">Sub-Projects</span> 115 <span class="project-status-value"><?php echo $sub_projects_count; ?></span> 116 </div> 117 <div class="project-status-waiting"> 118 <span class="project-status-title">Waiting</span> 119 <span class="project-status-value"><?php echo $waiting; ?></span> 120 </div> 121 <div class="project-status-progress"> 122 <span class="project-status-title">Progress</span> 123 <span class="project-status-value"><?php echo $percent_complete; ?>%</span> 124 </div> 125 </div> 126 127 <div class="percent"> 128 <div class="percent-complete" style="width:<?php echo $percent_complete; ?>%;"></div> 129 </div> 130 131 <div class="project-bottom"> 132 <div class="button contribute-button"> 133 <?php echo gp_link_get( $project_url, 'Translate Project' ) ?> 134 </div> 135 </div> 136 </div> 137 <?php 138 } 139 ?> 140 </div> 141 142 <script> 143 jQuery( document ).ready( function( $ ) { 144 $rows = $( '#projects' ).find( '.project' ); 145 $( '#projects-filter' ).on( 'input keyup', function() { 146 var words = this.value.toLowerCase().split( ' ' ); 147 148 if ( '' === this.value.trim() ) { 149 $rows.show(); 150 } else { 151 $rows.hide(); 152 $rows.filter( function( i, v ) { 153 var $t = $(this).find( '.project-top' ); 154 for ( var d = 0; d < words.length; ++d ) { 155 if ( $t.text().toLowerCase().indexOf( words[d] ) != -1 ) { 156 return true; 157 } 158 } 159 return false; 160 }).show(); 161 } 162 }); 163 164 $( '#variant-selector' ).on( 'change', function( event ) { 165 event.preventDefault(); 166 167 var $optionSelected = $( 'option:selected', this ), 168 projectUrl = $optionSelected.data( 'projectUrl' ); 169 170 if ( projectUrl.length ) { 171 window.location = projectUrl; 172 } 173 }); 174 }); 175 </script> 80 176 81 177 <?php gp_tmpl_footer(); -
sites/trunk/translate.wordpress.org/public_html/gp-templates/locales.php
r1590 r1684 35 35 </ul> 36 36 <div class="contributors"> 37 <span class="dashicons dashicons-admin-users"></span><br />38 37 <?php 39 $contributors = isset( $contributors_count[ $locale->slug ] ) ? $contributors_count[ $locale->slug ] : 0; 40 echo gp_link_get( 'https://make.wordpress.org/polyglots/teams/?locale=' . $wp_locale, $contributors ); 38 $contributors = sprintf( 39 '<span class="dashicons dashicons-admin-users"></span><br />%s', 40 isset( $contributors_count[ $locale->slug ] ) ? $contributors_count[ $locale->slug ] : 0 41 ); 42 echo gp_link_get( 'https://make.wordpress.org/polyglots/teams/?locale=' . $locale->wp_locale, $contributors ); 41 43 ?> 42 44 </div> … … 45 47 </div> 46 48 <div class="locale-button"> 47 <div class="button ">48 <?php echo gp_link_get( gp_url_join( gp_url_current(), $locale->slug ), "Contribute Translation") ?>49 <div class="button"> 50 <?php echo gp_link_get( gp_url_join( gp_url_current(), $locale->slug ), ) ?> 49 51 </div> 50 52 </div> … … 56 58 jQuery( document ).ready( function( $ ) { 57 59 $rows = $( '#locales' ).find( '.locale' ); 58 $( '#locales-filter' ). bind( 'change keyup input',function() {59 var words = this.value.toLowerCase().split( ' ');60 $( '#locales-filter' ).',function() { 61 var words = this.value.toLowerCase().split(); 60 62 61 63 if ( '' === this.value.trim() ) { -
sites/trunk/translate.wordpress.org/public_html/gp-templates/style.css
r1635 r1684 110 110 -webkit-box-sizing: border-box; 111 111 box-sizing: border-box; 112 margin: 12px 0 25px;112 margin: ; 113 113 padding: 0 20px; 114 114 width: 100%; … … 137 137 margin: 0 10px; 138 138 padding: 15px 0; 139 border-bottom: 4px solid # fff;139 border-bottom: 4px solid #f; 140 140 color: #666; 141 141 cursor: pointer; … … 176 176 } 177 177 178 179 180 181 182 183 184 185 186 187 188 178 189 .locales:before, 179 190 .locales:after { … … 182 193 } 183 194 195 196 197 198 199 184 200 .locales:after { 185 201 clear: both; … … 202 218 } 203 219 204 . locale-button .button {220 .button { 205 221 height: 26px; 206 222 } 207 223 208 . locale-button .button a {224 .button a { 209 225 vertical-align: baseline; 210 226 color: #555; … … 217 233 } 218 234 219 . locale-button .button a:hover {235 .button a:hover { 220 236 color: #333; 221 237 } … … 224 240 background: #f9f9f9; 225 241 text-align: center; 226 padding: 13px 0; 227 } 228 229 .locale-button a { 230 color: #555; 231 padding: 8px; 232 } 233 234 .locale .name { 242 padding: 20px 0; 243 } 244 245 .locale .name, 246 .locale-box .name { 235 247 display: inline-block; 236 248 margin: 0; … … 238 250 } 239 251 240 .locale .name li { 252 .locale .name li, 253 .locale-box .name li { 241 254 display: block; 242 255 } 243 256 244 .locale .name li.english a { 257 .locale .name li.english a, 258 .locale-box .name li.english { 245 259 font-weight: bold; 246 260 } 247 261 248 .locale .name li.code a { 262 .locale-box.project .name li.english { 263 font-weight: normal; 264 } 265 266 .locale .name li.code a, 267 .locale-box .name li.code { 249 268 color: #999; 250 269 } 251 270 252 .locale .contributors { 271 .locale .contributors, 272 .locale-box .contributors, 273 .locale-box .project-status { 253 274 float: right; 254 275 margin-top: 20px; … … 259 280 } 260 281 261 .locale .contributors .dashicons { 262 margin-left: -7px; 282 .locale-box .project-status { 283 color: #509040; 284 font-weight: 600; 285 } 286 287 .locale .contributors .dashicons, 288 .locale-box .contributors .dashicons { 263 289 font-size: 2em; 264 290 padding-bottom: 10px; 265 } 266 267 .locale .percent { 291 display: inline; 292 } 293 294 .locale-box .contributors .dashicons { 295 font-size: 1.5em; 296 } 297 298 .locale .percent, 299 .project .percent { 268 300 width: 100%; 269 301 height: 4px; … … 271 303 } 272 304 273 .locale .percent-complete { 305 .locale .percent-complete, 306 .project .percent-complete { 274 307 height: 4px; 275 308 background-color: #509040; … … 284 317 } 285 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 286 557 /* Responsive styles */ 287 558 @media (max-width: 700px) { … … 297 568 } 298 569 299 @media only screen and (max-width: 480px) { 300 .locales { 570 @media only screen and (max-width: 700px) { 571 .locales, 572 .projects { 301 573 margin-left: 0; 302 574 } 303 575 304 .locales .locale { 576 .locales .locale, 577 .projects .project { 305 578 width: 100%; 306 579 margin-left: 0;
Note: See TracChangeset
for help on using the changeset viewer.