diff --git a/OpenBench/static/style.css b/OpenBench/static/style.css index 6872910..79ffbbc 100644 --- a/OpenBench/static/style.css +++ b/OpenBench/static/style.css @@ -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 { diff --git a/OpenBench/utils.py b/OpenBench/utils.py index 55abc3f..fb7e320 100644 --- a/OpenBench/utils.py +++ b/OpenBench/utils.py @@ -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): diff --git a/OpenBench/views.py b/OpenBench/views.py index 902970d..62406ae 100644 --- a/OpenBench/views.py +++ b/OpenBench/views.py @@ -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) diff --git a/Templates/OpenBench/index.html b/Templates/OpenBench/index.html index 2345a28..163bdb3 100644 --- a/Templates/OpenBench/index.html +++ b/Templates/OpenBench/index.html @@ -8,7 +8,7 @@ {% for test in pending %}