Commit de4652aa by Chris Dodge

limit the number of pages to display to just be 7 on the instructor dashboard

parent 55b744ea
......@@ -136,12 +136,30 @@ var edx = edx || {};
},
render: function () {
if (this.template !== null) {
var data_json = this.collection.toJSON()[0];
// calculate which pages ranges to display
// show no more than 7 pages at the same time
var start_page = data_json.pagination_info.current_page - 3;
var end_page = data_json.pagination_info.current_page + 3;
if (start_page < 1) {
start_page = 1;
}
if (end_page > data_json.pagination_info.total_pages) {
end_page = data_json.pagination_info.total_pages;
}
var data = {
proctored_exam_attempts: this.collection.toJSON()[0].proctored_exam_attempts,
pagination_info: this.collection.toJSON()[0].pagination_info,
attempt_url: this.collection.toJSON()[0].attempt_url,
proctored_exam_attempts: data_json.proctored_exam_attempts,
pagination_info: data_json.pagination_info,
attempt_url: data_json.attempt_url,
inSearchMode: this.inSearchMode,
searchText: this.searchText
searchText: this.searchText,
start_page: start_page,
end_page: end_page,
};
_.extend(data, viewHelper);
var html = this.template(data);
......
......@@ -34,7 +34,7 @@
</a>
</li>
<% }%>
<% for(var n = 1; n <= pagination_info.total_pages; n++) { %>
<% for(var n = start_page; n <= end_page; n++) { %>
<li>
<a class="target-link <% if (pagination_info.current_page == n){ %> active <% } %>"
data-target-url="
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment