allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [1/2] allura git commit: [#8055] Fixes moderation queue paging, and small UI improvements
Date Mon, 16 Jan 2017 20:18:42 GMT
Repository: allura
Updated Branches:
  refs/heads/master 13534d447 -> e449bd0d1


[#8055] Fixes moderation queue paging, and small UI improvements


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/88f600ab
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/88f600ab
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/88f600ab

Branch: refs/heads/master
Commit: 88f600abf048fba346b38e6992fb1b1ce4b288a9
Parents: 13534d4
Author: Kenton Taylor <ktaylor@slashdotmedia.com>
Authored: Mon Jan 16 16:56:07 2017 +0000
Committer: Kenton Taylor <ktaylor@slashdotmedia.com>
Committed: Mon Jan 16 16:56:07 2017 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/discuss.py            |  8 +++--
 Allura/allura/lib/widgets/discuss.py            | 34 +++++++++++---------
 .../allura/templates/discussion/moderate.html   | 12 +++----
 .../templates/widgets/moderate_posts.html       |  5 ++-
 4 files changed, 31 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/88f600ab/Allura/allura/controllers/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/discuss.py b/Allura/allura/controllers/discuss.py
index 509de41..a61a9e1 100644
--- a/Allura/allura/controllers/discuss.py
+++ b/Allura/allura/controllers/discuss.py
@@ -36,6 +36,8 @@ from allura.lib.decorators import require_post
 from allura.lib.security import require_access
 
 from allura.lib.widgets import discuss as DW
+from allura.lib.widgets import form_fields as ffw
+
 from allura.model.auth import User
 from .attachments import AttachmentsController, AttachmentController
 from .feed import FeedArgs, FeedController
@@ -69,6 +71,7 @@ class WidgetConfig(object):
     thread = DW.Thread()
     post = DW.Post()
     thread_header = DW.ThreadHeader()
+    page_list = ffw.PageList()
 
 # Controllers
 
@@ -424,6 +427,7 @@ class ModerationController(BaseController):
         flag = kw.pop('flag', None)
         c.post_filter = WidgetConfig.post_filter
         c.moderate_posts = WidgetConfig.moderate_posts
+        c.page_list = WidgetConfig.page_list
         query = dict(
             discussion_id=self.discussion._id,
             deleted=False)
@@ -434,7 +438,7 @@ class ModerationController(BaseController):
         if username:
             filtered_user = User.by_username(username)
             query['author_id'] = filtered_user._id if filtered_user else None
-        q = self.PostModel.query.find(query)
+        q = self.PostModel.query.find(query).sort('timestamp', -1)
         count = q.count()
         limit, page, start = g.handle_paging(limit, page or 0, default=50)
         q = q.skip(start)
@@ -444,7 +448,7 @@ class ModerationController(BaseController):
         return dict(discussion=self.discussion,
                     posts=q, page=page, limit=limit,
                     status=status, flag=flag, username=username,
-                    pgnum=pgnum, pages=pages)
+                    pgnum=pgnum, pages=pages, count=count)
 
     @h.vardec
     @expose()

http://git-wip-us.apache.org/repos/asf/allura/blob/88f600ab/Allura/allura/lib/widgets/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/discuss.py b/Allura/allura/lib/widgets/discuss.py
index 2d1fb1d..30dc244 100644
--- a/Allura/allura/lib/widgets/discuss.py
+++ b/Allura/allura/lib/widgets/discuss.py
@@ -89,33 +89,37 @@ class ModeratePosts(ew.SimpleForm):
               });
               return false;
           });
+          $('.col-checkbox').click(function(e){
+            if (e.target.tagName === "INPUT") { return; };
+            var checkbox = $(this).find('input[type=checkbox]').get(0);
+            checkbox.checked = !checkbox.checked;
+          });
       }(jQuery));''')
 
 
 class PostFilter(ff.ForgeForm):
     defaults = dict(
         ew.SimpleForm.defaults,
+        class_name='foo',
         submit_text=None,
         method='GET')
     fields = [
         ew.HiddenField(
             name='page',
             validator=fev.Int()),
-        ew.FieldSet(label='Post Filter', fields=[
-            ew.SingleSelectField(
-                    name='status',
-                    label='Show posts with status',
-                    options=[
-                        ew.Option(py_value='-', label='Any'),
-                        ew.Option(py_value='spam', label='Spam'),
-                        ew.Option(py_value='pending',
-                                  label='Pending moderation'),
-                        ew.Option(py_value='ok', label='Ok')],
-                    if_missing='pending'),
-            ew.InputField(name='username',
-                          label='Show post filtered by username'),
-            ew.SubmitButton(label='Filter Posts')
-        ])
+        ew.SingleSelectField(
+                name='status',
+                label='Filter By Status',
+                options=[
+                    ew.Option(py_value='-', label='Any'),
+                    ew.Option(py_value='spam', label='Spam'),
+                    ew.Option(py_value='pending',
+                                label='Pending moderation'),
+                    ew.Option(py_value='ok', label='Ok')],
+                if_missing='pending'),
+        ew.InputField(name='username',
+                        label='Filter by Username'),
+        ew.SubmitButton(label='Filter Posts')
     ]
 
 

http://git-wip-us.apache.org/repos/asf/allura/blob/88f600ab/Allura/allura/templates/discussion/moderate.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/discussion/moderate.html b/Allura/allura/templates/discussion/moderate.html
index ddbd51f..e572348 100644
--- a/Allura/allura/templates/discussion/moderate.html
+++ b/Allura/allura/templates/discussion/moderate.html
@@ -27,15 +27,11 @@ Moderation Queue
 {% endblock %}
 
 {% block content %}
-<div class="grid-19">
-  <div>
-    Displaying page {{pgnum}} / {{pages}}
-  </div>
-  <a href="?status={{status}}&amp;flag={{flag}}&amp;page={{page-limit}}">Previous
Page</a>
-  <a href="?status={{status}}&amp;flag={{flag}}&amp;page={{page+limit}}">Next
Page</a>
-</div>
+<h3>Filter Posts</h3>
 {{c.post_filter.display(action=discussion.url()+'moderate', value=dict(status=status, flag=flag,
username=username))}}
+<h3>Update Marked Posts</h3>
 {{c.moderate_posts.display(value=dict(posts=posts), action=discussion.url()+'moderate/save_moderation')}}
+{{c.page_list.display(limit=limit, page=page, count=count)}}
 {% endblock %}
 
 {% block extra_css %}
@@ -46,4 +42,4 @@ Moderation Queue
         word-break: break-all;
     }
 </style>
-{% endblock %}
\ No newline at end of file
+{% endblock %}

http://git-wip-us.apache.org/repos/asf/allura/blob/88f600ab/Allura/allura/templates/widgets/moderate_posts.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/moderate_posts.html b/Allura/allura/templates/widgets/moderate_posts.html
index 977abcd..6b55a25 100644
--- a/Allura/allura/templates/widgets/moderate_posts.html
+++ b/Allura/allura/templates/widgets/moderate_posts.html
@@ -18,9 +18,8 @@
 -#}
 {% import 'allura:templates/jinja_master/lib.html' as lib with context %}
 <form {{widget.j2_attrs({'name':name, 'id':id, 'method':method, 'action':action, 'enctype':enctype})}}
-      {{attrs|default({}, true)|xmlattr}}>
+    {{attrs|default({}, true)|xmlattr}}>
   <fieldset class="grid-19">
-    <legend>Update marked posts</legend>
     <input type="submit" name="approve" value="Approve Marked"/>
     <input type="submit" name="spam" value="Spam Marked"/>
     <input type="submit" name="delete" value="Delete Marked"/>
@@ -42,7 +41,7 @@
     <tbody>
       {% for post in value.posts %}
         <tr>
-          <td>
+          <td class="col-checkbox">
             <input type="hidden" name="post-{{loop.index0}}._id" value="{{post._id}}"/>
             <input type="checkbox" name="post-{{loop.index0}}.checked"/>
           </td>


Mime
View raw message