allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [2/8] allura git commit: [#8020] ticket:875 updated rendering of spam block; changed notification text and redirect here link
Date Wed, 06 Jan 2016 19:30:21 GMT
[#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/1aebc645
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/1aebc645
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/1aebc645

Branch: refs/heads/db/8020
Commit: 1aebc645feca28ca8ed7686cd561adca59e93d4d
Parents: d11146f
Author: DeV1doR <dev1dor@ukr.net>
Authored: Mon Dec 21 18:15:56 2015 +0200
Committer: Dave Brondsema <dave@brondsema.net>
Committed: Wed Jan 6 12:51:41 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/1aebc645/Allura/allura/lib/widgets/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/discuss.py b/Allura/allura/lib/widgets/discuss.py
index ac4722d..52e9c32 100644
--- a/Allura/allura/lib/widgets/discuss.py
+++ b/Allura/allura/lib/widgets/discuss.py
@@ -341,37 +341,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/1aebc645/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 76606af..0e60c81 100644
--- a/Allura/allura/nf/allura/css/site_style.css
+++ b/Allura/allura/nf/allura/css/site_style.css
@@ -3424,6 +3424,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/1aebc645/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>


Mime
View raw message