View Project

This commit is contained in:
Dan Cryer 2014-12-04 12:19:06 +00:00
parent cc58191048
commit 54765bf823
5 changed files with 66 additions and 32 deletions

View file

@ -48,8 +48,9 @@ $strings = array(
// Timeline:
'latest_builds' => 'Latest Builds',
'created' => 'Created',
'started' => 'Started',
'pending' => 'Pending',
'running' => 'Running',
'success' => 'Success',
'successful' => 'Successful',
'failed' => 'Failed',
@ -87,4 +88,32 @@ $strings = array(
'error_github' => 'Repository name must be in the format "owner/repo"',
'error_bitbucket' => 'Repository name must be in the format "owner/repo"',
'error_path' => 'The path you specified does not exist.',
// View Project:
'all_branches' => 'All Branches',
'builds' => 'Builds',
'id' => 'ID',
'project' => 'Project',
'commit' => 'Commit',
'branch' => 'Branch',
'status' => 'Status',
'prev_link' => '« Prev',
'next_link' => 'Next »',
'public_key' => 'Public Key',
'delete_build' => 'Delete Build',
'webhooks' => 'Webhooks',
'webhooks_help_github' => 'To automatically build this project when new commits are pushed, add the URL below
as a new "Webhook" in the <a href="https://github.com/%s/settings/hooks">Webhooks
and Services</a> section of your Github repository.',
'webhooks_help_gitlab' => 'To automatically build this project when new commits are pushed, add the URL below
as a "WebHook URL" in the Web Hooks section of your Gitlab repository.',
'webhooks_help_bitbucket' => 'To automatically build this project when new commits are pushed, add the URL below
as a "POST" service in the
<a href="https://bitbucket.org/%s/admin/services">
Services</a> section of your Bitbucket repository.',
);

View file

@ -7,4 +7,6 @@
* @link https://www.phptesting.org/
*/
require_once(dirname(__FILE__) . '/lang.en-gb.php');
require_once(dirname(__FILE__) . '/lang.en-gb.php');
if (!isset($strings)) $strings = array('test' => 'test');

View file

@ -1,7 +1,8 @@
<?php use PHPCI\Helper\Lang; ?>
<?php if(empty($builds) || !count($builds)): ?>
<tr class="">
<td colspan="6">No builds yet.</td>
<td colspan="6"><?php Lang::out('no_builds_yet'); ?></td>
</tr>
<?php endif; ?>
@ -13,26 +14,26 @@ switch($build->getStatus())
case 0:
$cls = 'active';
$subcls = 'info';
$status = 'Pending';
$status = Lang::get('pending');
break;
case 1:
$cls = 'warning';
$subcls = 'warning';
$status = 'Running';
$status = Lang::get('running');
break;
case 2:
$cls = 'success';
$subcls = 'success';
$status = 'Success';
$status = Lang::get('success');
break;
case 3:
$cls = 'danger';
$subcls = 'danger';
$status = 'Failed';
$status = Lang::get('failed');
break;
}
?>
@ -57,7 +58,7 @@ switch($build->getStatus())
$build->getCommitterEmail()
);
} else {
print 'Manual Build';
print Lang::get('manual_build');
}
?>
</td>
@ -68,13 +69,13 @@ switch($build->getStatus())
</td>
<td>
<div class="btn-group">
<a class="btn btn-default btn-sm" href="<?php echo PHPCI_URL ?>build/view/<?php print $build->getId(); ?>">View</a>
<a class="btn btn-default btn-sm" href="<?php echo PHPCI_URL ?>build/view/<?php print $build->getId(); ?>"><?php Lang::out('view'); ?></a>
<?php if($this->User()->getIsAdmin()): ?>
<button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="<?php echo PHPCI_URL ?>build/delete/<?php print $build->getId(); ?>" class="phpci-app-delete-build">Delete Build</a></li>
<li><a href="<?php echo PHPCI_URL ?>build/delete/<?php print $build->getId(); ?>" class="phpci-app-delete-build"><?php Lang::out('delete_build'); ?></a></li>
</ul>
<?php endif; ?>
</div>

View file

@ -21,13 +21,13 @@
switch ($build->getStatus()) {
case \PHPCI\Model\Build::STATUS_NEW:
$updated = $build->getCreated();
$label = Lang::get('created');
$label = Lang::get('pending');
$color = 'blue';
break;
case \PHPCI\Model\Build::STATUS_RUNNING:
$updated = $build->getStarted();
$label = Lang::get('started');
$label = Lang::get('running');
$color = 'yellow';
break;
@ -81,7 +81,7 @@
$build->getCommitterEmail()
);
} else {
print 'Manual Build';
print Lang::get('manual_build');
}
?>
- <?php print $build->getCommitMessage(); ?>

View file

@ -1,3 +1,4 @@
<?php use PHPCI\Helper\Lang; ?>
<script>
var PHPCI_PROJECT_ID = <?php print $project->getId(); ?>;
var PHPCI_PROJECT_BRANCH = '<?php print $branch; ?>';
@ -5,11 +6,13 @@
<div class="clearfix" style="margin-bottom: 20px;">
<div class="pull-right btn-group">
<a class="btn btn-success" href="<?php print PHPCI_URL . 'project/build/' . $project->getId(); ?>">Build Now</a>
<a class="btn btn-success" href="<?php print PHPCI_URL . 'project/build/' . $project->getId(); ?>">
<?php Lang::out('build_now'); ?>
</a>
<div class="btn-group branch-btn pull-right">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
Branch<?php print !empty($branch) ? ': ' . $branch : ''; ?>&nbsp;&nbsp;<span class="caret"></span>
<?php print !empty($branch) ? Lang::get('branch_x', $branch) : Lang::get('branch'); ?>&nbsp;&nbsp;<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
@ -22,7 +25,7 @@
<?php endforeach; ?>
<li class="divider"></li>
<li><a href="<?php echo PHPCI_URL ?>project/view/<?php print $project->getId(); ?>">All</a></li>
<li><a href="<?php echo PHPCI_URL ?>project/view/<?php print $project->getId(); ?>"><?php Lang::out('all_branches'); ?></a></li>
</ul>
</div>
</div>
@ -34,16 +37,16 @@
<div class="box box-primary">
<div class="box-header">
<h3 class="box-title">Builds</h3>
<h3 class="box-title"><?php Lang::out('builds'); ?></h3>
</div>
<table class="table">
<thead>
<tr>
<th>ID</th>
<th>Project</th>
<th class="hidden-md hidden-sm hidden-xs">Commit</th>
<th>Branch</th>
<th>Status</th>
<th><?php Lang::out('id'); ?></th>
<th><?php Lang::out('project'); ?></th>
<th class="hidden-md hidden-sm hidden-xs"><?php Lang::out('commit'); ?></th>
<th><?php Lang::out('branch'); ?></th>
<th><?php Lang::out('status'); ?></th>
<th style="width: 100px"></th>
</tr>
</thead>
@ -59,38 +62,37 @@
<?php if (in_array($project->getType(), array('github', 'gitlab', 'bitbucket'))): ?>
<div class="box box-info">
<div class="box-header">
<h4 class="box-title">Webhooks</h4>
<h4 class="box-title"><?php Lang::out('webhooks'); ?></h4>
</div>
<div class="box-body">
To automatically build this project when new commits are pushed, add the URL below
<?php
switch($project->getType())
{
case 'github':
$url = PHPCI_URL . 'webhook/github/' . $project->getId();
print ' as a new "Webhook" in the <a href="https://github.com/' . $project->getReference() . '/settings/hooks">Webhooks and Services</a> section of your Github repository.<br><br><strong style="word-wrap: break-word;">' . $url . '</strong>';
Lang::out('webhooks_help_github', $project->getReference());
break;
case 'gitlab':
$url = PHPCI_URL. 'webhook/gitlab/' . $project->getId();
print ' as a "WebHook URL" in the Web Hooks section of your Gitlab repository.<br><br><strong style="word-wrap: break-word;">' . $url . '</strong>';
Lang::out('webhooks_help_gitlab');
break;
case 'bitbucket':
$url = PHPCI_URL . 'webhook/bitbucket/' . $project->getId();
print ' as a "POST" service in the <a href="https://bitbucket.org/' . $project->getReference() . '/admin/services">Services</a> section of your Bitbucket repository.<br><br><strong style="word-wrap: break-word;">' . $url . '</strong>';
Lang::out('webhooks_help_bitbucket', $project->getReference());
break;
}
?>
<br><br><strong style="word-wrap: break-word;"><?php print $url; ?></strong>
</div>
</div>
<?php endif; ?>
<?php if ($project->getSshPublicKey()): ?>
<div class="box box-info">
<div class="box-header"><h3 class="box-title"><a data-toggle="collapse" data-parent="#accordion" href="#publicCollapse">Public Key</a></h3></div>
<div class="box-header"><h3 class="box-title"><a data-toggle="collapse" data-parent="#accordion" href="#publicCollapse"><?php Lang::out('public_key'); ?></a></h3></div>
<div class="box-body" style="word-break: break-word;"><?php print $project->getSshPublicKey(); ?></div>
</div>
<?php endif; ?>
@ -104,7 +106,7 @@ print '<div><ul class="pagination">';
$project_url = PHPCI_URL . 'project/view/' . $project->getId() . ((!empty($branch)) ? '/' . urlencode($branch) : '');
if ($page > 1) {
print '<li><a href="' . $project_url . '?p='.($page == 1 ? '1' : $page - 1).'">&laquo; Prev</a></li>';
print '<li><a href="' . $project_url . '?p='.($page == 1 ? '1' : $page - 1).'">'.Lang::get('prev_link').'</a></li>';
}
if ($pages > 1) {
@ -144,7 +146,7 @@ if ($pages > 1) {
if ($page < $pages - 1) {
print '<li><a href="' . $project_url . '?p='.($page == $pages ? $pages : $page + 1).'">Next &raquo;</a></li>';
print '<li><a href="' . $project_url . '?p='.($page == $pages ? $pages : $page + 1).'">'.Lang::get('next_link').'</a></li>';
}