Anonymous avatar Anonymous committed 38a8080

完善分页

Comments (0)

Files changed (3)

         self.template_value['prev']=p-1 if p>1 else None
         self.template_value['next'] = p +1 if len(temp) == PAGESIZE else None
         self.template_value['imgs']=temp
+        self.template_value['ps'] = range(1,imgs.page_count()+1)
+        self.template_value['current_p'] = p
         self.render('album_manage.html')
         
 class ImageUploadHandler(AdminHandler):
         self.template_value['prev']=p-1 if p>1 else None
         self.template_value['next'] = p +1 if len(temp) == PAGESIZE else None
         self.template_value['imgs']  = temp
-        self.template_value['ps'] = range(1,imgs.page_count())
+        self.template_value['ps'] = range(1,imgs.page_count()+1)
         self.template_value['current_p'] = p
         self.render('album.html')
     

themes/admin/album_manage.html

 			<td sytle="width:100px"><button id="t-ddd">一键删除</button></td>
 			<td style="width:100px"></td>
 			<td style="width:250px;text-align:right;">
-			{% if prev %}<a href="?p={{prev}}">上一页</a> {% endif %} {% if next %}<a href="?p={{next}}">下一页</a> {% endif%}
+			{% if prev %}<a href="?p={{prev}}">上一页</a> {% endif %} 
+			{% for p in ps %}
+			{% ifequal p current_p %}
+			{{p}}
+			{% else %}
+			<a href="?p={{p}}">{{p}}</a> 
+			{% endifequal %}
+			{% endfor %}
+			{% if next %}<a href="?p={{next}}">下一页</a> {% endif%}
 			</td>
         </tr>
     </tbody>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.