You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2016/01/27 18:17:41 UTC

[04/10] allura git commit: [#8020] ticket:875 updated rendering of spam block; changed notification text and redirect here link

[#8020] ticket:875 updated rendering of spam block; changed notification text and redirect here link


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

Branch: refs/heads/master
Commit: 0778b7adecf9ad558bbe56143670f513e811676e
Parents: bf73398
Author: DeV1doR <de...@ukr.net>
Authored: Mon Dec 21 18:15:56 2015 +0200
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Wed Jan 27 12:03:18 2016 -0500

----------------------------------------------------------------------
 Allura/allura/lib/widgets/discuss.py            | 34 +++++++-------------
 Allura/allura/nf/allura/css/site_style.css      |  1 +
 .../allura/templates/widgets/post_widget.html   | 26 +++++++--------
 3 files changed, 25 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/0778b7ad/Allura/allura/lib/widgets/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/discuss.py b/Allura/allura/lib/widgets/discuss.py
index 4d83070..d343969 100644
--- a/Allura/allura/lib/widgets/discuss.py
+++ b/Allura/allura/lib/widgets/discuss.py
@@ -340,37 +340,25 @@ class Post(HierWidget):
                                 $('div.moderate', post).removeClass('moderate');
                             }
                             else if (mod == 'Spam'){
-                                spam_block_display($(post), 'none');
+                                spam_block_display($(post), 'show_spam');
                             }
                             else if (mod == 'Undo'){
-                                spam_block_display($(post), 'block');
+                                spam_block_display($(post), 'hide_spam');
                             }
                         }
                     });
                 });
 
                 function spam_block_display($post, display_type) {
-                    var post_block = $post.find('.display_post');
-                    post_block.css('display', display_type);
-
-                    var attach_block = $post.find('.add_attachment_form').next();
-                    if (attach_block.attr('class') == undefined) {
-                        attach_block.css('display', display_type);
-                    }
-
-                    $.each($post.find('.options').children(), function() {
-                        $(this).css('display', display_type);
-                        if (
-                            $(this).hasClass('reply_post') &&
-                            $post.find('input[name="prev_status"]').attr('value') == 'pending'
-                        ) {
-                            $(this).hide();
-                        }
-                    });
-                    if (display_type == 'none') {
-                        $post.find('.spam-present').show();
-                    } else {
-                        $post.find('.spam-present').hide();
+                    var spam_block = $post.find('.info.grid-15.spam-present');
+                    var row = $post.find('.row').eq(0);
+
+                    if (display_type == 'show_spam') {
+                        spam_block.show();
+                        row.hide();
+                    } else if (display_type == 'hide_spam') {
+                        spam_block.hide();
+                        row.show();
                     }
                 }
 

http://git-wip-us.apache.org/repos/asf/allura/blob/0778b7ad/Allura/allura/nf/allura/css/site_style.css
----------------------------------------------------------------------
diff --git a/Allura/allura/nf/allura/css/site_style.css b/Allura/allura/nf/allura/css/site_style.css
index 5dd347d..885d948 100644
--- a/Allura/allura/nf/allura/css/site_style.css
+++ b/Allura/allura/nf/allura/css/site_style.css
@@ -3430,6 +3430,7 @@ fieldset.preferences legend {
 }
 .spam-present {
   display: none;
+  margin-left: 75px;
 }
 .spam-text {
   float: left;

http://git-wip-us.apache.org/repos/asf/allura/blob/0778b7ad/Allura/allura/templates/widgets/post_widget.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/post_widget.html b/Allura/allura/templates/widgets/post_widget.html
index 6b8622d..4d388ee 100644
--- a/Allura/allura/templates/widgets/post_widget.html
+++ b/Allura/allura/templates/widgets/post_widget.html
@@ -29,6 +29,19 @@
 
 <div>
   <div id="{{value.slug}}" class="discussion-post">
+    {% if h.has_access(value, 'moderate')() %}
+    <div class="info grid-15 spam-present">
+      <span class="spam-text">Comment has been marked as spam.&nbsp;</span>
+      <form method="POST" action="{{value.url()+'moderate'}}">
+        <input type="hidden" name="undo" value="True"/>
+        <input type="hidden" name="prev_status" value="{{value.status}}">
+        <a href="" class="moderate_post little_link"><span>Undo</span></a>
+        {{lib.csrf_token()}}
+      </form>
+      <br>
+      <span class="spam-text">You can see all pending comments posted by this user&nbsp;</span><a href="/p/test/tickets/_discuss/moderate?username={{value.author().username}}&status=pending">here</a>
+    </div>
+    {% endif %}
     <div class="row">
       <div class="grid-2 tcenter gravatar">
        <p class="gravatar">
@@ -44,19 +57,6 @@
       {% set pending = value.status == 'pending' %}
       {% set moderator = h.has_access(value, 'moderator')() %}
       <div class="grid-14 post-content" style="width: {{indent == 0 and 525 or (indent <= 40 and 515-indent*10 or 65)}}px">
-        <div class="spam-present">
-          <span class="spam-text">Comment has been marked as spam.&nbsp;</span>
-          {% if h.has_access(value, 'moderate')() %}
-          <form method="POST" action="{{value.url()+'moderate'}}">
-            <input type="hidden" name="undo" value="True"/>
-            <input type="hidden" name="prev_status" value="{{value.status}}">
-            <a href="" class="moderate_post little_link"><span>Undo</span></a>
-            {{lib.csrf_token()}}
-          </form>
-          {% endif %}
-          <br>
-          <span class="spam-text">You can see all comments posted by this user&nbsp;</span><a href="/p/test/tickets/_discuss/moderate?username={{value.author().username}}&status=spam">here</a>
-        </div>
         <div class="display_post{% if pending and moderator %} moderate{% endif %}">
           {% if pending and not moderator %}
             <b>Post awaiting moderation.</b>