Update CSS for paging, and start counting at 1
This commit is contained in:
1 parent
7f99535b16
commit
5a48d050dc
4 files changed
+14
-14
No files matched your search
@@ -243,16 +243,16 @@ a:link, a:visited, a:hover, a:active {
|
||||
}
|
||||
|
||||
#content .page {
|
||||
border: none;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
padding: 8px 0px;
|
||||
width: 5%;
|
||||
background-color: #424242;
|
||||
background-color: #212121;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
#content .page:hover {
|
||||
background-color: #888888;
|
||||
background-color: #AAAAAA;
|
||||
}
|
||||
|
||||
#error {
|
||||
|
||||
+5
-5
@@ -14,8 +14,8 @@ def pagingContext(page, pageLength, items, url):
|
||||
end = min(start + pageLength, items)
|
||||
|
||||
# Get page numbers near the current page
|
||||
pagenum = math.ceil(items / pageLength)
|
||||
temp = list(range(0, min(3, pagenum)))
|
||||
pagenum = 1 + math.ceil(items / pageLength)
|
||||
temp = list(range(1, min(4, pagenum)))
|
||||
temp.extend(range(pagenum-1, pagenum-4, -1))
|
||||
temp.extend(range(max(0, page-2), min(pagenum-1, page+3)))
|
||||
temp = list(set(temp))
|
||||
@@ -24,7 +24,7 @@ def pagingContext(page, pageLength, items, url):
|
||||
# Fill in gaps with an ellipsis, throw out negatives
|
||||
pages = []
|
||||
for f in range(len(temp)):
|
||||
if temp[f] < 0: continue
|
||||
if temp[f] < 1: continue
|
||||
pages.append(temp[f])
|
||||
if f < len(temp) - 1 and temp[f] != temp[f+1] - 1:
|
||||
pages.append("...")
|
||||
@@ -34,8 +34,8 @@ def pagingContext(page, pageLength, items, url):
|
||||
"url" : url,
|
||||
"page" : page,
|
||||
"pages" : pages,
|
||||
"prev" : max(0, page - 1),
|
||||
"next" : max(0, min(page + 1, pagenum - 1)),
|
||||
"prev" : max(1, page - 1),
|
||||
"next" : max(1, min(page + 1, pagenum - 1)),
|
||||
}
|
||||
|
||||
def getSourceLocation(branch, repo):
|
||||
|
||||
+3
-3
@@ -113,7 +113,7 @@ def editProfile(request):
|
||||
# Send back to see the changes
|
||||
return HttpResponseRedirect('/viewProfile/')
|
||||
|
||||
def index(request, page=0, pageLength=25, greens=False, username=None, error=''):
|
||||
def index(request, page=1, pageLength=24, greens=False, username=None, error=''):
|
||||
|
||||
# Get tests pending approval
|
||||
pending = Test.objects.filter(approved=False)
|
||||
@@ -164,8 +164,8 @@ def index(request, page=0, pageLength=25, greens=False, username=None, error='')
|
||||
|
||||
# Choose tests within the given page, if any
|
||||
items = len(completed)
|
||||
start = page * pageLength
|
||||
end = start + pageLength
|
||||
start = (page - 1) * pageLength
|
||||
end = page * pageLength
|
||||
start = max(0, min(start, items))
|
||||
end = max(0, min(end, items))
|
||||
paging = pagingContext(page, pageLength, items, source)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
{% for test in pending %}
|
||||
<tr>
|
||||
<td class="numeric"><a href="/viewUser/{{test.author}}">{{test.author}}</a></td>
|
||||
<td>{{test.engine}}</td>
|
||||
<td class="numeric">{{test.engine}}</td>
|
||||
<td><a href="/viewTest/{{test.id}}">{{test.dev.name}}</a></td>
|
||||
<td class="textcenter"><a href="{{test|gitDiffLink}}">diff</a></td>
|
||||
<td>{{test.timecontrol}}</td>
|
||||
@@ -21,7 +21,7 @@
|
||||
{% for test in active %}
|
||||
<tr>
|
||||
<td class="numeric"><a href="/viewUser/{{test.author}}">{{test.author}}</a></td>
|
||||
<td>{{test.engine}}</td>
|
||||
<td class="numeric">{{test.engine}}</td>
|
||||
<td><a href="/viewTest/{{test.id}}">{{test.dev.name}}</a></td>
|
||||
<td class="textcenter"><a href="{{test|gitDiffLink}}">diff</a></td>
|
||||
<td>{{test.timecontrol}}</td>
|
||||
@@ -33,7 +33,7 @@
|
||||
{% for test in completed %}
|
||||
<tr>
|
||||
<td class="numeric"><a href="/viewUser/{{test.author}}">{{test.author}}</a></td>
|
||||
<td>{{test.engine}}</td>
|
||||
<td class="numeric">{{test.engine}}</td>
|
||||
<td><a href="/viewTest/{{test.id}}">{{test.dev.name}}</a></td>
|
||||
<td class="textcenter"><a href="{{test|gitDiffLink}}">diff</a></td>
|
||||
<td>{{test.timecontrol}}</td>
|
||||
|
||||
Reference in new issue
Block a user