Fixed pagination for environments in project/view page and ajax builds update.

This commit is contained in:
Dmitry Khomutov 2017-05-08 14:51:32 +07:00
commit 446deca0cb
No known key found for this signature in database
GPG key ID: 7EB36C9576F9ECB9
9 changed files with 71 additions and 57 deletions

View file

@ -14,9 +14,9 @@
<tr>
<th><?php Lang::out('project'); ?></th>
<td style="text-align: right">
<a href="<?php print APP_URL . 'project/view/' . $build->getProjectId(); ?>">
<i class="fa fa-<?php print $build->getProject()->getIcon(); ?>"></i>
<?php print $build->getProject()->getTitle(); ?>
<a href="<?= APP_URL . 'project/view/' . $build->getProjectId(); ?>">
<i class="fa fa-<?= $build->getProject()->getIcon(); ?>"></i>
<?= $build->getProject()->getTitle(); ?>
</a>
</td>
</tr>

View file

@ -80,12 +80,12 @@ if ($buildCount > 0) {
?>
<div class="small-box small-box-full bg-<?php print $subcls; ?>">
<div class="small-box small-box-full bg-<?= $subcls; ?>">
<div class="inner">
<h3>
<a href="<?php print APP_URL; ?>project/view/<?php print $project->getId(); ?>">
<?php print $project->getTitle(); ?>
<a href="<?= APP_URL; ?>project/view/<?= $project->getId(); ?>">
<?= $project->getTitle(); ?>
</a>
</h3>
@ -97,7 +97,7 @@ if ($buildCount > 0) {
<div class="icon">
<i class="fa fa-<?php print $project->getIcon(); ?>"></i>
</div>
<a href="<?php print APP_URL; ?>project/view/<?php print $project->getId(); ?>" class="small-box-footer small-box-footer-project">
<a href="<?= APP_URL; ?>project/view/<?= $project->getId(); ?>" class="small-box-footer small-box-footer-project">
<div class="pull-left" style="margin-left: 10px">
<?php if ($project->getAllowPublicStatus()): ?>
<i class="fa fa-unlock"></i>
@ -105,7 +105,7 @@ if ($buildCount > 0) {
<i class="fa fa-lock"></i>
<?php endif; ?>
</div>
<?php Lang::out('view_project'); ?> (<?php print $counts; ?>) <i class="fa fa-arrow-circle-right"></i>
<?php Lang::out('view_project'); ?> (<?= $counts; ?>) <i class="fa fa-arrow-circle-right"></i>
</a>
<?php for ($idx=0; $idx < 5; $idx++) {

View file

@ -65,13 +65,13 @@ use PHPCensor\Model\Build;
?>
</span>
<h3 class="timeline-header">
<a href="<?php print APP_URL; ?>project/view/<?php print $build->getProjectId(); ?>">
<?php print $build->getProject()->getTitle(); ?>
<a href="<?= APP_URL; ?>project/view/<?= $build->getProjectId(); ?>">
<?= $build->getProject()->getTitle(); ?>
</a>
<span><?php print $environment; ?></span>
<span><?= $environment; ?></span>
&mdash;
<a href="<?php print APP_URL; ?>build/view/<?php print $build->getId(); ?>">
Build #<?php print $build->getId(); ?>
<a href="<?= APP_URL; ?>build/view/<?= $build->getId(); ?>">
Build #<?= $build->getId(); ?>
</a>
&mdash;
<?php print $label; ?>

View file

@ -80,25 +80,25 @@ foreach($projects as $project):
}
?>
<div class="project-box" id="project-box-<?php print $project->getId(); ?>">
<div class="small-box small-box-full bg-<?php print $subcls; ?>">
<div class="project-box" id="project-box-<?= $project->getId(); ?>">
<div class="small-box small-box-full bg-<?= $subcls; ?>">
<div class="inner">
<h3>
<a href="<?php print APP_URL; ?>project/view/<?php print $project->getId(); ?>">
<?php print $project->getTitle(); ?>
<a href="<?= APP_URL; ?>project/view/<?= $project->getId(); ?>">
<?= $project->getTitle(); ?>
</a>
</h3>
<p>
<?php print $message; ?>
<?= $message; ?>
</p>
</div>
<div class="icon">
<i class="fa fa-<?php print $project->getIcon(); ?>"></i>
</div>
<a href="<?php print APP_URL; ?>project/view/<?php print $project->getId(); ?>" class="small-box-footer small-box-footer-project">
<a href="<?= APP_URL; ?>project/view/<?= $project->getId(); ?>" class="small-box-footer small-box-footer-project">
<div class="pull-left" style="margin-left: 10px">
<?php if ($project->getAllowPublicStatus()): ?>
<i class="fa fa-unlock"></i>

View file

@ -96,16 +96,16 @@ use PHPCensor\Model\Build;
?>
</span>
<h3 class="timeline-header">
<a href="<?php print APP_URL; ?>project/view/<?php print $build->getProjectId(); ?>">
<?php print $build->getProject()->getTitle(); ?>
<a href="<?= APP_URL; ?>project/view/<?= $build->getProjectId(); ?>">
<?= $build->getProject()->getTitle(); ?>
</a>
<span><?php print $environment; ?></span>
<span><?= $environment; ?></span>
&mdash;
<a href="<?php print APP_URL; ?>build/view/<?php print $build->getId(); ?>">
Build #<?php print $build->getId(); ?>
<a href="<?= APP_URL; ?>build/view/<?= $build->getId(); ?>">
Build #<?= $build->getId(); ?>
</a>
&mdash;
<?php print $label; ?>
<?= $label; ?>
</h3>
<div class="timeline-body">

View file

@ -4,6 +4,7 @@
var PROJECT_ENVIRONMENT = '<?= $environment; ?>';
var PROJECT_BRANCH = '<?= $branch; ?>';
var PER_PAGE = <?= $perPage; ?>;
var PAGE = <?= $page; ?>;
</script>
<div class="clearfix" style="margin-bottom: 20px;">
@ -115,10 +116,19 @@
print '<div><ul class="pagination">';
$project_url = APP_URL . 'project/view/' . $project->getId() . ((!empty($branch)) ? '/' . urlencode($branch) : '');
$project_url = APP_URL . 'project/view/' . $project->getId();
$params = [];
if (!empty($branch)) {
$params['branch'] = $branch;
}
if (!empty($environment)) {
$params['environment'] = $environment;
}
if ($page > 1) {
print '<li><a href="' . $project_url . '?p='.($page == 1 ? '1' : $page - 1).'">'.Lang::get('prev_link').'</a></li>';
print '<li><a href="' . $project_url . '?' . http_build_query(array_merge($params, ['page' => ($page - 1)])) . '">' . Lang::get('prev_link') . '</a></li>';
}
if ($pages > 1) {
@ -136,27 +146,29 @@
}
if ($start > 1) {
print '<li><a href="' . $project_url . '">1...</a></li>';
print '<li><a href="' . $project_url . '?' . http_build_query($params) . '">1...</a></li>';
}
for($i = $start; $i <= $end; $i++)
{
if ($pages > $end && $i == $pages) continue;
if ($pages > $end && $i == $pages) {
continue;
}
if ($i == $page) {
print '<li class="bg-blue"><span>' . $i . '</span></li>';
} else {
print '<li><a href="' . $project_url . '?p=' . $i . '">' . $i . '</a></li>';
print '<li><a href="' . $project_url . '?' . http_build_query(array_merge($params, ['page' => $i])) . '">' . $i . '</a></li>';
}
}
if ($pages > $end) {
print '<li><a href="' . $project_url . '?p='.$pages.'">...'.$pages.'</a></li>';
print '<li><a href="' . $project_url . '?' . http_build_query(array_merge($params, ['page' => $pages])) . '">...' . $pages . '</a></li>';
}
}
if ($page < $pages - 1) {
print '<li><a href="' . $project_url . '?p='.($page == $pages ? $pages : $page + 1).'">'.Lang::get('next_link').'</a></li>';
if ($page < ($pages - 1)) {
print '<li><a href="' . $project_url . '?' . http_build_query(array_merge($params, ['page' => ($page == $pages) ? $pages : ($page + 1)])) . '">' . Lang::get('next_link') . '</a></li>';
}
print '</ul></div>';

View file

@ -173,7 +173,7 @@
<ul class="treeview-menu">
<?php foreach($group['projects'] as $project): ?>
<li>
<a href="<?php print APP_URL; ?>project/view/<?php print $project->getId(); ?>">
<a href="<?php print APP_URL; ?>project/view/<?= $project->getId(); ?>">
<i class="fa fa-<?php print $project->getIcon(); ?>"></i>
<span><?php print $project->getTitle(); ?></span>
</a>