<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[GlotPress][940] trunk: Add first version of locale details pages.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="https://glotpress.trac.wordpress.org/changeset/940">940</a></dd>
<dt>Author</dt> <dd>markoheijnen</dd>
<dt>Date</dt> <dd>2014-08-09 19:14:45 +0000 (Sat, 09 Aug 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Add first version of locale details pages. Props yoavf. See <a href="http://glotpress.trac.wordpress.org/ticket/212">#212</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkcssstylecss">trunk/css/style.css</a></li>
<li><a href="#trunkgpincludesmetaphp">trunk/gp-includes/meta.php</a></li>
<li><a href="#trunkgpincludesrouterphp">trunk/gp-includes/router.php</a></li>
<li><a href="#trunkgpincludesschemaphp">trunk/gp-includes/schema.php</a></li>
<li><a href="#trunkgpincludesthingstranslationsetphp">trunk/gp-includes/things/translation-set.php</a></li>
<li><a href="#trunkgpsettingsphp">trunk/gp-settings.php</a></li>
<li><a href="#trunkgptemplatesprojectsphp">trunk/gp-templates/projects.php</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkgpincludesrouteslocalephp">trunk/gp-includes/routes/locale.php</a></li>
<li><a href="#trunkgptemplateslocalephp">trunk/gp-templates/locale.php</a></li>
<li><a href="#trunkgptemplateslocalesphp">trunk/gp-templates/locales.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkcssstylecss"></a>
<div class="modfile"><h4>Modified: trunk/css/style.css (939 => 940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/css/style.css 2014-08-06 12:17:08 UTC (rev 939)
+++ trunk/css/style.css 2014-08-09 19:14:45 UTC (rev 940)
</span><span class="lines">@@ -115,7 +115,7 @@
</span><span class="cx"> line-height: 1.5em;
</span><span class="cx"> width: 40em;
</span><span class="cx"> }
</span><del>-table.translations, table.translation-sets, table.glossary {
</del><ins>+table.translations, table.translation-sets, table.glossary, table.language-sub-projects {
</ins><span class="cx"> font-size: 90%;
</span><span class="cx"> width: 100%;
</span><span class="cx"> border-spacing: 0.1em;
</span><span class="lines">@@ -124,13 +124,18 @@
</span><span class="cx"> table.translations tfoot th,
</span><span class="cx"> table.translation-sets thead th,
</span><span class="cx"> table.translations tfoot th,
</span><del>-table.glossary thead th {
</del><ins>+table.glossary thead th,
+table.language-sub-projects thead th,
+table.locales thead th {
</ins><span class="cx"> font-weight: bold;
</span><span class="cx"> color: #eee;
</span><span class="cx"> background-color: #555;
</span><span class="cx"> padding: 0.5em;
</span><span class="cx"> }
</span><del>-table.translations tr, table.translation-sets tr, table.glossary tr {
</del><ins>+table.locales thead th {
+ width: 33%;
+}
+table.translations tr, table.translation-sets tr, table.glossary tr, table.language-sub-projects {
</ins><span class="cx"> border: 0;
</span><span class="cx"> }
</span><span class="cx"> table.translations td.translation ul {
</span><span class="lines">@@ -155,7 +160,12 @@
</span><span class="cx"> font-style: italic;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-table.translations td, table.translations th, table.translation-sets td, table.translation-sets th, table.glossary th, table.glossary td {
</del><ins>+table.translations td,table.translations th,
+table.translation-sets td, table.translation-sets th,
+table.locales td, table.locales th,
+table.glossary th, table.glossary td,
+table.language-sub-projects th,
+table.language-sub-projects td {
</ins><span class="cx"> padding: 0.5em;
</span><span class="cx"> border: 1px solid #eee;
</span><span class="cx"> margin: 0;
</span><span class="lines">@@ -448,7 +458,7 @@
</span><span class="cx"> clear: both;
</span><span class="cx"> visibility: hidden;
</span><span class="cx"> }
</span><del>-table.translation-sets .stats a {
</del><ins>+table.translation-sets .stats a, table.language-sub-projects .stats a {
</ins><span class="cx"> color: black;
</span><span class="cx"> text-decoration: none;
</span><span class="cx"> -webkit-border-radius: 0.3em;
</span><span class="lines">@@ -469,10 +479,10 @@
</span><span class="cx"> margin-left: 2px;
</span><span class="cx"> }
</span><span class="cx"> .secondary {
</span><del>- font-size: 0.85em;
</del><ins>+ font-size: 0.95em;
</ins><span class="cx"> }
</span><span class="cx"> .ternary {
</span><del>- font-size: 0.7em;
</del><ins>+ font-size: 0.8em;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> .actionlist {
</span><span class="lines">@@ -582,26 +592,26 @@
</span><span class="cx"> width: 100%;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-.translation-sets .percent {
</del><ins>+.translation-sets .percent, .language-sub-projects .percent {
</ins><span class="cx"> font-weight: bold;
</span><span class="cx"> }
</span><span class="cx"> .translation-sets .stats {
</span><span class="cx"> text-align: center;
</span><span class="cx"> }
</span><del>-.translation-sets td {
</del><ins>+.translation-sets td, .locales td {
</ins><span class="cx"> padding: 0.5em 0.75em;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-.translation-sets tr {
</del><ins>+.translation-sets tr, .locales tr {
</ins><span class="cx"> background-color: #eee;
</span><span class="cx"> }
</span><del>-.translation-sets tr.odd {
</del><ins>+.translation-sets tr.odd, .locales tr.odd {
</ins><span class="cx"> background-color: #fff;
</span><span class="cx"> }
</span><del>-.translation-sets tr:hover {
</del><ins>+.translation-sets tr:hover, .locales tr:hover {
</ins><span class="cx"> background-color: #dee;
</span><span class="cx"> }
</span><del>-.translation-sets tr.odd:hover {
</del><ins>+.translation-sets tr.odd:hover, .locales tr.odd:hover {
</ins><span class="cx"> background-color: #eff;
</span><span class="cx"> }
</span><span class="cx"> #submit {
</span><span class="lines">@@ -730,6 +740,70 @@
</span><span class="cx"> padding: 5px;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+.language-project {
+ margin-left: 20em;
+}
+
+.language-project .project-description {
+ float:left;
+ margin-left: -20em;
+ width:16em;
+ padding-left: 10px;
+}
+
+table.language-sub-projects {
+ empty-cells: hide;
+}
+
+table.language-sub-projects thead th {
+ text-align:left;
+}
+
+.language-sub-projects .project-name {
+ border-collapse: separate;
+ border-spacing: 20px 5px;
+ border: 2px solid #0ff;
+}
+.language-sub-projects .project-name th {
+ font-size: 1.1em;
+ font-weight: bold;
+ background-color: #eee;
+ padding: 0.25em 0.5em 1em 0.5em;
+ color: #444;
+}
+
+table.language-sub-projects td {
+ border:none;
+ border-bottom: 1px solid #eee;
+}
+table.language-sub-projects tr:hover td {
+ background-color:#eff;
+}
+
+.language-sub-projects .sub-project {
+ border:none;
+ text-align: left;
+ vertical-align: top;
+ border-bottom: 2px solid #eee;
+}
+
+table.language-sub-projects tbody tr:last-child td {
+ border-bottom:2px solid #eee;
+}
+
+
+table.language-sub-projects {
+ margin-bottom: 30px;
+}
+
+table.language-sub-projects thead th:nth-child(-n+2) {
+ width: 20%;
+}
+table.language-sub-projects thead th:nth-child(n+3) {
+ width: 15%;
+}
+
+
</ins><span class="cx"> @media (max-width: 800px) {
</span><span class="cx"> #sub-projects {
</span><span class="cx"> float: none;
</span><span class="lines">@@ -738,4 +812,13 @@
</span><span class="cx"> #translation-sets.with-sub-projects {
</span><span class="cx"> margin: 0;
</span><span class="cx"> }
</span><ins>+
+ .language-project {
+ margin-left: 0;
+ }
+
+ .language-project .project-description {
+ float: none;
+ margin-left: 0;
+ }
</ins><span class="cx"> }
</span></span></pre></div>
<a id="trunkgpincludesmetaphp"></a>
<div class="modfile"><h4>Modified: trunk/gp-includes/meta.php (939 => 940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/gp-includes/meta.php 2014-08-06 12:17:08 UTC (rev 939)
+++ trunk/gp-includes/meta.php 2014-08-09 19:14:45 UTC (rev 940)
</span><span class="lines">@@ -247,7 +247,7 @@
</span><span class="cx"> case 'version':
</span><span class="cx"> return '0.1'; // Don't filter
</span><span class="cx"> case 'gp_db_version' :
</span><del>- return '918'; // Don't filter
</del><ins>+ return '940'; // Don't filter
</ins><span class="cx"> case 'html_type':
</span><span class="cx"> $r = 'text/html';
</span><span class="cx"> break;
</span></span></pre></div>
<a id="trunkgpincludesrouterphp"></a>
<div class="modfile"><h4>Modified: trunk/gp-includes/router.php (939 => 940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/gp-includes/router.php 2014-08-06 12:17:08 UTC (rev 939)
+++ trunk/gp-includes/router.php 2014-08-09 19:14:45 UTC (rev 940)
</span><span class="lines">@@ -49,6 +49,9 @@
</span><span class="cx"> 'get:/profile' => array('GP_Route_Profile', 'profile_get'),
</span><span class="cx"> 'post:/profile' => array('GP_Route_Profile', 'profile_post'),
</span><span class="cx">
</span><ins>+ 'get:/languages' => array('GP_Route_Locale', 'locales_get'),
+ "get:/languages/$locale" => array('GP_Route_Locale', 'single'),
+
</ins><span class="cx"> "get:/$set/glossary" => array('GP_Route_Glossary_Entry', 'glossary_entries_get'),
</span><span class="cx"> "post:/$set/glossary" => array('GP_Route_Glossary_Entry', 'glossary_entries_post'),
</span><span class="cx"> "post:/$set/glossary/-new" => array('GP_Route_Glossary_Entry', 'glossary_entry_add_post'),
</span></span></pre></div>
<a id="trunkgpincludesrouteslocalephp"></a>
<div class="addfile"><h4>Added: trunk/gp-includes/routes/locale.php (0 => 940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/gp-includes/routes/locale.php (rev 0)
+++ trunk/gp-includes/routes/locale.php 2014-08-09 19:14:45 UTC (rev 940)
</span><span class="lines">@@ -0,0 +1,94 @@
</span><ins>+<?php
+class GP_Route_Locale extends GP_Route_Main {
+
+ function locales_get() {
+ $this->tmpl( 'locales' );
+ }
+
+ function single( $locale_slug ) {
+ $locale = GP_Locales::by_slug( $locale_slug );
+ $sets = GP::$translation_set->by_locale( $locale_slug );
+
+ //TODO: switch to wp_list_pluck
+ $locale_projects = $projects_data = $projects = $parents = array();
+ foreach ( $sets as $key => $value ) {
+ $locale_projects[ $key ] = $value->project_id;
+ }
+
+ foreach ( $sets as $set ) {
+ // Store project data for later use
+ if ( isset( $projects[$set->project_id] ) ) {
+ $set_project = $projects[$set->project_id];
+ } else {
+ $set_project = GP::$project->get( $set->project_id );
+ $projects[$set->project_id] = $set_project;
+ }
+
+ // We only want to list active projects
+ if ( ! isset( $set_project->active ) || $set_project->active == false ) {
+ continue;
+ }
+
+
+ $parent_id = is_null( $set_project->parent_project_id ) ? $set_project->id : $set_project->parent_project_id;
+
+ // Store parent project data for later use
+ if ( isset( $projects[$parent_id] ) ) {
+ $parent_project = $projects[$parent_id];
+ } else {
+ $parent_project = GP::$project->get( $parent_id );
+ $projects[$parent_id] = $parent_project;
+ }
+
+ // Store parent id for
+ $parents[$set_project->id] = $parent_id;
+
+ if ( ! in_array( $set_project->parent_project_id, $locale_projects ) ) {
+ $projects_data[$parent_id][$set_project->id]['project'] = $set_project;
+ $projects_data[$parent_id][$set_project->id]['data'][$set->slug] = $this->set_data( $set );
+
+ if ( ! isset( $projects_data[$parent_id][$set_project->id]['project'] ) ) {
+ $projects_data[$parent_id][$set_project->id]['project'] = $set_project;
+ }
+ } else {
+ while ( ! in_array( $parent_id, array_keys( $projects_data ) ) && isset( $parents[$parent_id] ) ) {
+ $previous_parent = $parent_id;
+ $parent_id = $parents[$parent_id];
+ }
+
+ //Orphan project - a sub project is set to active, while it's parent isn't
+ if ( ! isset( $projects_data[$parent_id] ) ) {
+ continue;
+ }
+
+ //For when root project has sets, and sub projects.
+ if ( ! isset( $projects_data[$parent_id][$previous_parent] ) ) {
+ $previous_parent = $parent_id;
+ }
+
+ $set_data = $projects_data[$parent_id][$previous_parent]['data'][$set->slug];
+ $projects_data[$parent_id][$previous_parent]['data'][$set->slug] = $this->set_data( $set, $set_data );
+ }
+ }
+
+ $this->tmpl( 'locale', get_defined_vars() );
+ }
+
+ private function set_data( $set, $set_data = null ) {
+ if ( ! $set_data ) {
+ $set_data = new stdClass;
+ }
+
+ if ( ! isset( $set_data->name ) ) {
+ $set_data->name = $set->name;
+ }
+
+ $set_data->waiting_count += $set->waiting_count();
+ $set_data->current_count += $set->current_count();
+ $set_data->fuzzy_count += $set->fuzzy_count();
+ $set_data->all_count += $set->all_count();
+
+ return $set_data;
+ }
+
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkgpincludesschemaphp"></a>
<div class="modfile"><h4>Modified: trunk/gp-includes/schema.php (939 => 940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/gp-includes/schema.php 2014-08-06 12:17:08 UTC (rev 939)
+++ trunk/gp-includes/schema.php 2014-08-09 19:14:45 UTC (rev 940)
</span><span class="lines">@@ -50,7 +50,8 @@
</span><span class="cx"> `project_id` INT(10) DEFAULT NULL,
</span><span class="cx"> `locale` VARCHAR(10) DEFAULT NULL,
</span><span class="cx"> PRIMARY KEY (`id`),
</span><del>- UNIQUE KEY `project_id_slug_locale` (`project_id`, `slug`, `locale`)
</del><ins>+ UNIQUE KEY `project_id_slug_locale` (`project_id`, `slug`, `locale`),
+ KEY `locale_slug` (`locale`, `slug`)
</ins><span class="cx"> );";
</span><span class="cx">
</span><span class="cx"> /*
</span></span></pre></div>
<a id="trunkgpincludesthingstranslationsetphp"></a>
<div class="modfile"><h4>Modified: trunk/gp-includes/things/translation-set.php (939 => 940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/gp-includes/things/translation-set.php 2014-08-06 12:17:08 UTC (rev 939)
+++ trunk/gp-includes/things/translation-set.php 2014-08-09 19:14:45 UTC (rev 940)
</span><span class="lines">@@ -26,6 +26,13 @@
</span><span class="cx"> WHERE slug = '%s' AND project_id= %d AND locale = %s", $slug, $project_id, $locale_slug );
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ function by_locale( $locale_slug ) {
+ return $this->many( "
+ SELECT * FROM $this->table
+ WHERE locale = '%s'", $locale_slug );
+ }
+
+
</ins><span class="cx"> function by_project_id( $project_id ) {
</span><span class="cx"> return $this->many( "
</span><span class="cx"> SELECT * FROM $this->table
</span></span></pre></div>
<a id="trunkgpsettingsphp"></a>
<div class="modfile"><h4>Modified: trunk/gp-settings.php (939 => 940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/gp-settings.php 2014-08-06 12:17:08 UTC (rev 939)
+++ trunk/gp-settings.php 2014-08-09 19:14:45 UTC (rev 940)
</span><span class="lines">@@ -309,6 +309,7 @@
</span><span class="cx"> require_once GP_PATH . GP_INC . 'routes/translation.php';
</span><span class="cx"> require_once GP_PATH . GP_INC . 'routes/glossary.php';
</span><span class="cx"> require_once GP_PATH . GP_INC . 'routes/glossary-entry.php';
</span><ins>+require_once GP_PATH . GP_INC . 'routes/locale.php';
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> GP::$translation_warnings = new GP_Translation_Warnings();
</span></span></pre></div>
<a id="trunkgptemplateslocalephp"></a>
<div class="addfile"><h4>Added: trunk/gp-templates/locale.php (0 => 940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/gp-templates/locale.php (rev 0)
+++ trunk/gp-templates/locale.php 2014-08-09 19:14:45 UTC (rev 940)
</span><span class="lines">@@ -0,0 +1,77 @@
</span><ins>+<?php
+gp_title( sprintf( __( 'Projects translated to %s < GlotPress' ), esc_html( $locale->english_name ) ) );
+gp_breadcrumb( array(
+ gp_link_get( '/languages', __( 'Locales' ) ),
+ esc_html( $locale->english_name )
+) );
+gp_tmpl_header();
+?>
+
+ <h2><?php printf( __( 'Active Projects translated to %s' ), esc_html( $locale->english_name ) ); ?></h2>
+ <?php
+ if ( empty( $projects_data ) ) {
+ _e( 'No active projects found.' );
+ }
+ ?>
+
+ <?php foreach ( $projects_data as $project_id => $sub_projects ) : ?>
+ <h3><?php echo esc_html( $projects[ $project_id ]->name ); ?></h3>
+ <div class="language-project">
+ <div class="project-description">
+ <?php echo esc_html( gp_html_excerpt( $projects[ $project_id ]->description, 150 ) ); ?>
+ </div>
+ <table class="language-sub-projects">
+ <thead>
+ <tr>
+ <th class="header"><?php _e( 'Sub Project' ); ?></th>
+ <th class="header"><?php _e( 'Set' ); ?></th>
+ <th><?php echo _x( '%', 'language translation percent header' ); ?></th>
+ <th><?php _e( 'Translated' ); ?></th>
+ <th><?php _e( 'Fuzzy' ); ?></th>
+ <th><?php _e( 'Untranslated' ); ?></th>
+ <th><?php _e( 'Waiting' ); ?></th>
+ </tr>
+ </thead>
+ <?php foreach ( $sub_projects as $sub_project_id => $sets ) : ?>
+ <tbody>
+ <tr>
+ <th class="sub-project" rowspan="<?php echo count( $sets ) + 1; ?>">
+ <?php echo esc_html( $projects[$sub_project_id]->name ); ?>
+ </th>
+ </tr>
+ <?php foreach ( $sets['data'] as $set_slug => $set_data ) : ?>
+ <tr>
+ <td class="set-name">
+ <strong><?php gp_link( gp_url_project( $sets['project'], gp_url_join( $locale->slug, $set_slug ) ), $set_data->name ); ?></strong>
+ <?php if ( $set_data->current_count && $set_data->current_count >= $set_data->all_count * 0.9 ):
+ $percent = floor( $set_data->current_count / $set_data->all_count * 100 );
+ ?>
+ <span class="bubble morethan90"><?php echo $percent; ?>%</span>
+ <?php endif;?>
+ </td>
+ <td class="stats percent">
+ <?php
+ if ( $set_data->current_count ) {
+ echo( floor( absint( $set_data->current_count ) / absint( $set_data->all_count ) * 100 ) );
+ } else {
+ echo '0';
+ }
+ ?>%
+ </td>
+ <td class="stats translated"><?php gp_link( gp_url_project( $sets['project'], gp_url_join( $locale->slug, $set_slug ), array('filters[translated]' => 'yes', 'filters[status]' => 'current') ), absint( $set_data->current_count ) ); ?></td>
+ <td class="stats fuzzy"><?php gp_link( gp_url_project( $sets['project'], gp_url_join( $locale->slug, $set_slug ), array('filters[status]' => 'fuzzy' ) ), absint( $set_data->fuzzy_count ) ); ?></td>
+ <td class="stats untranslated"><?php gp_link( gp_url_project( $sets['project'], gp_url_join( $locale->slug, $set_slug ), array('filters[status]' => 'untranslated' ) ), absint( $set_data->all_count ) - absint( $set_data->current_count ) ); ?></td>
+ <td class="stats waiting"><?php gp_link( gp_url_project( $sets['project'], gp_url_join( $locale->slug, $set_slug ), array('filters[translated]' => 'yes', 'filters[status]' => 'waiting') ), absint( $set_data->waiting_count ) ); ?></td>
+ </tr>
+ <?php endforeach; //sub project slugs ?>
+ <?php endforeach; //sub projects ?>
+ </tbody>
+ </table>
+ </div>
+ <?php endforeach; //top projects ?>
+
+ <p class="actionlist secondary">
+ <?php gp_link( '/projects', __('All projects') ); ?>
+ </p>
+
+<?php gp_tmpl_footer();
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkgptemplateslocalesphp"></a>
<div class="addfile"><h4>Added: trunk/gp-templates/locales.php (0 => 940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/gp-templates/locales.php (rev 0)
+++ trunk/gp-templates/locales.php 2014-08-09 19:14:45 UTC (rev 940)
</span><span class="lines">@@ -0,0 +1,68 @@
</span><ins>+<?php
+gp_title( __('Locales < GlotPress') );
+wp_enqueue_script('common');
+wp_enqueue_script('tablesorter');
+$parity = gp_parity_factory();
+gp_tmpl_header();
+?>
+
+ <h2><?php _e('Locales and Languages'); ?></h2>
+ <div class="locales-filter">
+ <?php _e( 'Filter:' );?><input id="locales-filter" type="search" placeholder="<?php esc_attr_e('Search string'); ?>" />
+ </div>
+
+ <table class="tablesorter locales">
+ <thead>
+ <tr>
+ <th class="header"><?php _e( 'Name (in English)' );?></th>
+ <th class="header"><?php _e( 'Native name' );?></th>
+ <th class="header"><?php _e( 'Language code' );?></th>
+
+ </tr>
+ </thead>
+ <tbody>
+ <?php foreach ( GP_Locales::locales() as $locale ) :?>
+ <tr class="<?php echo $parity(); ?>">
+ <?php echo "<td>" . gp_link_get( gp_url_join( gp_url_current(), $locale->slug ), $locale->english_name ) . "</td>" ?>
+ <?php echo "<td>" . gp_link_get( gp_url_join( gp_url_current(), $locale->slug ), $locale->native_name ) . "</td>" ?>
+ <?php echo "<td>" . gp_link_get( gp_url_join( gp_url_current(), $locale->slug ), $locale->slug ) . "</td>" ?>
+ </tr>
+ <?php endforeach; ?>
+ </tbody>
+ </table>
+
+ <script type="text/javascript" charset="utf-8">
+ jQuery(document).ready(function($) {
+ $('.locales').tablesorter({
+ headers: {
+ 0: {
+ sorter: 'text'
+ }
+ },
+ widgets: ['zebra']
+ });
+
+ $rows = $('.locales tbody').find('tr');
+ $('#locales-filter').keyup( function(){
+ var twidth = $('.locales').width();
+ var words = this.value.toLowerCase().split(' ');
+ if ( '' == this.value.trim() ) {
+ $rows.show();
+ } else {
+ $rows.hide();
+ $rows.filter(function (i, v) {
+ var $t = $(this);
+ for ( var d = 0; d < words.length; ++d ) {
+ if ( $t.text().toLowerCase().indexOf( words[d] ) != -1 ) {
+ return true;
+ }
+ }
+ return false;
+ }).show();
+ $('.locales').width(twidth );
+ }
+ });
+ });
+ </script>
+
+<?php gp_tmpl_footer();
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkgptemplatesprojectsphp"></a>
<div class="modfile"><h4>Modified: trunk/gp-templates/projects.php (939 => 940)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/gp-templates/projects.php 2014-08-06 12:17:08 UTC (rev 939)
+++ trunk/gp-templates/projects.php 2014-08-09 19:14:45 UTC (rev 940)
</span><span class="lines">@@ -3,14 +3,20 @@
</span><span class="cx"> gp_tmpl_header();
</span><span class="cx"> ?>
</span><span class="cx">
</span><del>-<h2><?php _e('Projects'); ?></h2>
-<ul>
-<?php foreach($projects as $project): ?>
- <li><?php gp_link_project( $project, esc_html( $project->name ) ); ?> <?php gp_link_project_edit( $project, null, array('class' => 'bubble') ); ?></li>
-<?php endforeach; ?>
-</ul>
-<?php if ( GP::$user->current()->can( 'write', 'project' ) ): ?>
- <p class="actionlist secondary"><?php gp_link( gp_url_project( '-new' ), __('Create a New Project') ); ?></p>
-<?php endif; ?>
</del><ins>+ <h2><?php _e('Projects'); ?></h2>
</ins><span class="cx">
</span><ins>+ <ul>
+ <?php foreach ( $projects as $project ): ?>
+ <li><?php gp_link_project( $project, esc_html( $project->name ) ); ?> <?php gp_link_project_edit( $project, null, array( 'class' => 'bubble' ) ); ?></li>
+ <?php endforeach; ?>
+ </ul>
+
+ <p class="actionlist secondary">
+ <?php if ( GP::$user->current()->can( 'write', 'project' ) ): ?>
+ <?php gp_link( gp_url_project( '-new' ), __('Create a New Project') ); ?> •
+ <?php endif; ?>
+
+ <?php gp_link( '/languages', __('Projects by language') ); ?>
+ </p>
+
</ins><span class="cx"> <?php gp_tmpl_footer();
</span><span class="cx">\ No newline at end of file
</span></span></pre>
</div>
</div>
</body>
</html>