Commits

Anonymous committed 38a8080

完善分页

  • Participants
  • Parent commits 60e86b9

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>