cluster_search_ui/commit

Laconic pagination code.

authorChris Dijkshoorn
Tue Dec 16 15:26:15 2014 +0100
committerChris Dijkshoorn
Tue Dec 16 15:26:15 2014 +0100
commit9522a00608f1003de57c0c6c6effe217ff731158
tree4398dd3647060f0deca72bb43731276459261818
parent5e946a6b996ad525d536f84b727ade3560beca2f
Diff style: patch stat
diff --git a/web/js/pagination.js b/web/js/pagination.js
index e679d83..046a7d0 100644
--- a/web/js/pagination.js
+++ b/web/js/pagination.js
@@ -32,32 +32,38 @@ function changePagination(pageNumber, activePage, numberOfPages, clusterId) {
 	//Often replacing html, this is because often <a> has to be replaced by <span> and vice versa 
 	//Replace span active class with a link
 	$("#cluster" + clusterId + " .pagination li").eq(activePage).replaceWith(
-			'<li><a href="javascript:goToPage(' + activePage + ', ' + clusterId + ')">' + activePage + '</a></li>');
-	
+		$.el.li($.el.a({'href':'javascript:goToPage(' + activePage + ', ' + clusterId + ')'},
+					   activePage)));
+																			 
 	//Replace a link with span active class
 	$("#cluster" + clusterId + " .pagination li").eq(pageNumber).replaceWith(
-			'<li class="active"><span>' + pageNumber + '</span></li>');
-	
+		$.el.li({'class':'active'},
+				$.el.span(pageNumber)));
+
 	//Replace left arrow
 	if(pageNumber == 1) {
 		// Disable left because switching to page one
 		$("#cluster" + clusterId + " .pagination li").eq(0).replaceWith(
-				'<li class="disabled"><span>&laquo;</span></li>');
+			$.el.li({'class':'disabled'},
+					$.el.span('\u00ab')));
 	} else {
 		// Enable left with pageNumber as a link
 		$("#cluster" + clusterId + " .pagination li").eq(0).replaceWith(
-		'<li><a href="javascript:previousPage(' + pageNumber + ', ' + clusterId + ')">&laquo;</a></li>');
+			$.el.li($.el.a({'href':'javascript:previousPage(' + pageNumber + ', ' + clusterId + ')'},
+						   '\u00ab')));
 	}
 	
 	//Replace right arrow
 	if(pageNumber == numberOfPages) {
 		// Disable left because switching to page one
 		$("#cluster" + clusterId + " .pagination li").eq(numberOfPages+1).replaceWith(
-				'<li class="disabled"><span>&raquo;</span></li>');
+			$.el.li({'class':'disabled'},
+					$.el.span('\u00bb')));
 	} else {
 		// Enable left with pageNumber as a link
 		$("#cluster" + clusterId + " .pagination li").eq(numberOfPages+1).replaceWith(
-		'<li><a href="javascript:nextPage(' + pageNumber + ', ' + clusterId + ')">&raquo;</a></li>');
+			$.el.li($.el.a({'href':'javascript:nextPage(' + pageNumber + ', ' + clusterId + ')'},
+						   '\u00bb')));
 	}
 }