Browse Source

Fix page bug again.

pull/6/head
t123yh 7 years ago
parent
commit
1d3a22387f
  1. 27
      views/page.ejs

27
views/page.ejs

@ -18,26 +18,33 @@
omitLeft = omitRight = true;
}
} %>
<% if (paginate.currPage !== 1) { %>
<a class="item" href="<%= syzoj.utils.makeUrl(req, Object.assign(req.query, { page: 1 })) %>"><%= 1 %></a>
<% } %>
<% if (omitLeft) { %>
<div class="disabled item">...</div>
<%
}
for (let i = paginate.currPage - leftCnt; i < paginate.currPage; i++) { %>
<% } %>
<% for (let i = paginate.currPage - leftCnt; i < paginate.currPage; i++) { %>
<a class="item" href="<%= syzoj.utils.makeUrl(req, Object.assign(req.query, { page: i })) %>"><%= i %></a>
<%
}
%>
<% } %>
<a class="active item" href="<%= syzoj.utils.makeUrl(req, Object.assign(req.query, { page: paginate.currPage })) %>"><%= paginate.currPage %></a>
<% for (let i = paginate.currPage + 1; i <= paginate.currPage + rightCnt; i++) { %>
<a class="item" href="<%= syzoj.utils.makeUrl(req, Object.assign(req.query, { page: i })) %>"><%= i %></a>
<%
}
if (omitRight) {
%>
<% } %>
<% if (omitRight) { %>
<div class="disabled item">...</div>
<% } %>
<% if (paginate.currPage !== paginate.pageCnt) { %>
<a class="item" href="<%= syzoj.utils.makeUrl(req, Object.assign(req.query, { page: paginate.pageCnt })) %>"><%= paginate.pageCnt %></a>
<% } %>
<a class="<% if (paginate.currPage === paginate.pageCnt) { %> disabled<% } %> icon item" <% if (paginate.currPage !== paginate.pageCnt) { %>href="<%= syzoj.utils.makeUrl(req, Object.assign(req.query, { page: paginate.currPage + 1 })) %>" <% } %>id="page_next">
<i class="right chevron icon"></i>
</a>

Loading…
Cancel
Save