php-censor/PHPCI/View/Project/view.phtml

102 lines
3.7 KiB
PHTML
Raw Normal View History

2013-05-10 13:28:43 +02:00
<div id="title">
<h1>Project: <?php print (is_object($project)) ? htmlspecialchars($project->getTitle()) : ' - '; ?></h1>
2013-05-10 13:28:43 +02:00
</div>
<div class="row">
<div class="col-lg-3">
<ul class="nav nav-pills nav-stacked">
2014-01-28 22:27:39 +01:00
<li><a href="<?php echo PHPCI_URL ?>"><i class="icon-home"></i> Dashboard</a></li>
<li><a href="<?php echo PHPCI_URL ?>project/view/<?php print $project->getId(); ?>"><i class="icon-folder-open"></i> <?php print htmlspecialchars($project->getTitle()); ?></a></li>
</ul>
<h5>Options</h5>
<ul class="nav nav-pills nav-stacked">
2014-01-28 22:27:39 +01:00
<li><a href="<?php echo PHPCI_URL ?>project/build/<?php print $project->getId(); ?>"><i class="icon-cog"></i> Build Now</a></li>
2013-05-10 13:28:43 +02:00
2013-05-10 17:25:51 +02:00
<?php if($this->User()->getIsAdmin()): ?>
2014-01-28 22:27:39 +01:00
<li><a href="<?php echo PHPCI_URL ?>project/edit/<?php print $project->getId(); ?>"><i class="icon-edit"></i> Edit Project</a></li>
<li><a href="#" id="delete-project"><i class="icon-trash"></i> Delete Project</a></li>
2013-05-10 17:25:51 +02:00
<?php endif; ?>
2013-05-10 13:28:43 +02:00
</ul>
<?php if (in_array($project->getType(), array('github', 'gitlab','bitbucket'))): ?>
<br>
<p class="alert alert-info">To automatically build this project when new commits are pushed, add the URL below
<?php endif; ?>
2013-05-10 13:28:43 +02:00
<?php
switch($project->getType())
{
case 'github':
$url = PHPCI_URL . 'webhook/github/' . $project->getId();
2013-05-10 13:28:43 +02:00
print ' as a "WebHook URL" in the <a href="https://github.com/' . $project->getReference() . '/settings/hooks">Service Hooks</a> section of your Github repository.<br><br><strong style="word-wrap: break-word;">' . $url . '</strong>';
break;
2013-09-19 09:46:29 +02:00
case 'gitlab':
$url = PHPCI_URL. 'webhook/gitlab/' . $project->getId();
2013-09-19 09:46:29 +02:00
print ' as a "WebHook URL" in the Web Hooks section of your Gitlab repository.<br><br><strong style="word-wrap: break-word;">' . $url . '</strong>';
break;
2013-05-10 13:28:43 +02:00
case 'bitbucket':
$url = PHPCI_URL . 'webhook/bitbucket/' . $project->getId();
2013-05-10 13:28:43 +02:00
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>';
break;
}
?>
</p>
</div>
<div class="col-lg-9">
2013-05-10 13:28:43 +02:00
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>ID</th>
<th>Project</th>
<th>Commit</th>
<th>Branch</th>
<th>Status</th>
<th style="width: 100px"></th>
2013-05-10 13:28:43 +02:00
</tr>
</thead>
<tbody id="latest-builds">
<?php print $builds; ?>
2013-05-10 13:28:43 +02:00
</tbody>
</table>
<?php
print '<div><ul class="pagination">';
2013-05-10 13:28:43 +02:00
$pages = ceil($total / 10);
$pages = $pages == 0 ? 1 : $pages;
print '<li class="'.($page == 1 ? 'disabled' : '').'"><a href="' . PHPCI_URL . 'project/view/'.$project->getId().'?p='.($page == 1 ? '1' : $page - 1).'">&laquo;</a></li>';
2013-05-10 13:28:43 +02:00
for($i = 1; $i <= $pages; $i++)
{
print '<li><a href="' . PHPCI_URL . 'project/view/' . $project->getId() . '?p=' . $i . '">' . $i . '</a></li>';
2013-05-10 13:28:43 +02:00
}
print '<li class="'.($page == $pages ? 'disabled' : '').'"><a href="' . PHPCI_URL . 'project/view/'.$project->getId().'?p='.($page == $pages ? $pages : $page + 1).'">&raquo;</a></li>';
2013-05-10 13:28:43 +02:00
print '</ul></div>';
?>
</div>
</div>
<?php if($page == 1): ?>
<script>
setInterval(function()
{
2014-01-28 22:27:39 +01:00
$('#latest-builds').load('<?php echo PHPCI_URL ?>project/builds/<?php print $project->getId(); ?>');
}, 10000);
$(function() {
$('#delete-project').on('click', function (e) {
e.preventDefault();
confirmDelete(
2014-01-28 22:27:39 +01:00
"<?php echo PHPCI_URL ?>project/delete/<?php print $project->getId(); ?>", "Project"
).onCloseConfirmed = function () {window.location = '/'};
});
})
2013-05-10 13:28:43 +02:00
</script>
<?php endif; ?>