Fixed pagination position in the project view

This commit is contained in:
Dmitry Khomutov 2017-02-28 20:28:54 +07:00
parent 23aa5d7cc7
commit 651aba0267
No known key found for this signature in database
GPG key ID: 7EB36C9576F9ECB9

View file

@ -55,23 +55,74 @@
<div class="box-header">
<h3 class="box-title"><?php Lang::out('builds'); ?> (<?php print $total; ?>)</h3>
</div>
<table class="table table-hover">
<thead>
<tr>
<th><?php Lang::out('id'); ?></th>
<th><?php Lang::out('date'); ?></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><?php Lang::out('duration'); ?></th>
<th></th>
</tr>
</thead>
<tbody id="latest-builds">
<?php print $builds; ?>
</tbody>
</table>
<table class="table table-hover">
<thead>
<tr>
<th><?php Lang::out('id'); ?></th>
<th><?php Lang::out('date'); ?></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><?php Lang::out('duration'); ?></th>
<th></th>
</tr>
</thead>
<tbody id="latest-builds">
<?php print $builds; ?>
</tbody>
</table>
</div>
<?php
print '<div><ul class="pagination">';
$project_url = APP_URL . 'project/view/' . $project->getId() . ((!empty($branch)) ? '/' . urlencode($branch) : '');
if ($page > 1) {
print '<li><a href="' . $project_url . '?p='.($page == 1 ? '1' : $page - 1).'">'.Lang::get('prev_link').'</a></li>';
}
if ($pages > 1) {
$start = $page - 3;
if ($start <= 0) {
$start = 1;
}
$end = $page + 3;
if ($end > $pages) {
$end = $pages;
}
if ($start > 1) {
print '<li><a href="' . $project_url . '">1...</a></li>';
}
for($i = $start; $i <= $end; $i++)
{
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>';
}
}
if ($pages > $end) {
print '<li><a href="' . $project_url . '?p='.$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>';
}
print '</ul></div>';
?>
</div>
<div class="col-lg-3 col-md-4 col-sm-4">
@ -138,58 +189,6 @@
</div>
</div>
<?php
print '<div><ul class="pagination">';
$project_url = APP_URL . 'project/view/' . $project->getId() . ((!empty($branch)) ? '/' . urlencode($branch) : '');
if ($page > 1) {
print '<li><a href="' . $project_url . '?p='.($page == 1 ? '1' : $page - 1).'">'.Lang::get('prev_link').'</a></li>';
}
if ($pages > 1) {
$start = $page - 3;
if ($start <= 0) {
$start = 1;
}
$end = $page + 3;
if ($end > $pages) {
$end = $pages;
}
if ($start > 1) {
print '<li><a href="' . $project_url . '">1...</a></li>';
}
for($i = $start; $i <= $end; $i++)
{
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>';
}
}
if ($pages > $end) {
print '<li><a href="' . $project_url . '?p='.$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>';
}
print '</ul></div>';
?>
<script>
$(function() {
$('#delete-project').on('click', function (e) {