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