add pagination to moderate comment view.

svn path=/plone.app.discussion/trunk/; revision=27752
This commit is contained in:
Timo Stollenwerk 2009-06-30 23:17:40 +00:00
parent 8c217ae45a
commit cfd70d8cc8
3 changed files with 41 additions and 30 deletions

View File

@ -10,7 +10,11 @@
<metal:main fill-slot="main"> <metal:main fill-slot="main">
<tal:main-macro metal:define-macro="main" <tal:main-macro metal:define-macro="main"
tal:define="items view/comments; tal:define="items view/comments;
filter view/filter|nothing;"> filter view/filter|nothing;
Batch python:modules['Products.CMFPlone'].Batch;
b_size python:30;
b_start python:0;
b_start request/b_start | b_start;">
<h1 class="documentFirstHeading" i18n:translate="title_review"> <h1 class="documentFirstHeading" i18n:translate="title_review">
Moderate comments Moderate comments
@ -49,31 +53,33 @@
</ul> </ul>
<form method="post" <form method="post"
action="#" action="#"
class="bulkactions" tal:attributes="action string:${context/absolute_url}/@@bulk-actions"
tal:attributes="action string:${context/absolute_url}/@@bulk-actions"> tal:condition="items"
tal:define="batch python:Batch(items, b_size, int(b_start), orphan=1);">
<table id="review-comments" class="listing" style="width: 100%" tal:condition="items"> <div id="bulkactions">
<select name="form.select.BulkAction">
<option selected="selected" value="-1" i18n:translate="title_bulkactions">Bulk Actions</option>
<!--<option value="retract" i18n:translate="bulkactions_retract">Retract</option>-->
<option value="publish"
i18n:translate="bulkactions_publish"
tal:condition="python: filter != 'published'">Publish</option>
<!--<option value="mark_as_spam" i18n:translate="bulkactions_markasspam">Mark as Spam</option>-->
<option value="delete" i18n:translate="bulkactions_delete">Delete</option>
</select>
<input type="hidden" name="form.button.Filter" tal:attributes="value filter" value="" />
<input id="dobulkaction"
type="submit"
class="standalone allowMultiSubmit"
value="Apply"
name="form.button.BulkAction"
i18n:attributes="value label_apply;" />
</div>
<div metal:use-macro="here/batch_macros/macros/navigation" />
<table id="review-comments" class="listing" style="width: 100%">
<thead> <thead>
<tr>
<th class="nosort bulkactions" colspan="7">
<select name="form.select.BulkAction">
<option selected="selected" value="-1" i18n:translate="title_bulkactions">Bulk Actions</option>
<!--<option value="retract" i18n:translate="bulkactions_retract">Retract</option>-->
<option value="publish"
i18n:translate="bulkactions_publish"
tal:condition="python: filter != 'published'">Publish</option>
<!--<option value="mark_as_spam" i18n:translate="bulkactions_markasspam">Mark as Spam</option>-->
<option value="delete" i18n:translate="bulkactions_delete">Delete</option>
</select>
<input type="hidden" name="form.button.Filter" tal:attributes="value filter" value="" />
<input id="dobulkaction"
type="submit"
class="standalone allowMultiSubmit"
value="Apply"
name="form.button.BulkAction"
i18n:attributes="value label_apply;" />
</th>
</tr>
<tr> <tr>
<th class="nosort"><input name="check_all" type="checkbox" value="0" /></th> <th class="nosort"><input name="check_all" type="checkbox" value="0" /></th>
<th i18n:translate="heading_author">Commenter</th> <th i18n:translate="heading_author">Commenter</th>
@ -85,7 +91,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tal:block repeat="item items"> <tal:block repeat="item batch">
<tr style="vertical-align: top" class="commentrow" <tr style="vertical-align: top" class="commentrow"
tal:define="odd repeat/item/odd" tal:define="odd repeat/item/odd"
tal:attributes="class python: odd and 'odd' or 'even'"> tal:attributes="class python: odd and 'odd' or 'even'">
@ -137,6 +143,7 @@
</tal:block> </tal:block>
</tbody> </tbody>
</table> </table>
<div metal:use-macro="here/batch_macros/macros/navigation" />
</form> </form>
</tal:main-macro> </tal:main-macro>
</metal:main> </metal:main>

View File

@ -10,6 +10,7 @@ class View(BrowserView):
""" """
template = ViewPageTemplateFile('moderation.pt') template = ViewPageTemplateFile('moderation.pt')
template.id = '@@moderate-comments'
def __call__(self): def __call__(self):

View File

@ -71,8 +71,15 @@ ul.filter {
background-color: #DEE7EC; background-color: #DEE7EC;
border-bottom: 1px solid #DEE7EC; border-bottom: 1px solid #DEE7EC;
} }
.bulkactions {
#bulkactions {
text-align: left; text-align: left;
background: #DEE7EC;
border: 1px solid #8CACBB;
}
#bulkactions select {
margin: 0.1em 0;
} }
#dobulkaction { #dobulkaction {
@ -90,7 +97,3 @@ ul.filter {
#review-comments { #review-comments {
margin: 0; margin: 0;
} }
#review-comments select {
margin: 0.1em 0;
}