Browse Source

UI tweaks for reports.

Ralfp 12 years ago
parent
commit
0eafb89022

+ 6 - 1
misago/apps/reports/list.py

@@ -68,10 +68,15 @@ class ThreadsListView(ThreadsListBaseView, ThreadsListModeration, TypeMixin):
         reported_threads = []
         for thread in self.threads:
             if thread.pk in ids:
+                if thread.original_weight != thread.weight:
+                    if thread.weight == 1:
+                        thread.last_post.set_checkpoint(self.request, 'resolved')
+                    if thread.weight == 0:
+                        thread.last_post.set_checkpoint(self.request, 'bogus')
+                    thread.last_post.save(force_update=True)
                 if thread.original_weight == 2:
                     reported_posts.append(thread.report_for.pk)
                     reported_threads.append(thread.report_for.thread_id)
-                    second_pass.append(thread.pk)
         if reported_threads:
             Thread.objects.filter(id__in=reported_threads).update(replies_reported=F('replies_reported') - 1)
             Post.objects.filter(id__in=reported_posts).update(reported=False)

+ 4 - 0
misago/apps/reports/thread.py

@@ -39,9 +39,13 @@ class ThreadView(ThreadBaseView, ThreadModeration, PostsModeration, TypeMixin):
         return actions
 
     def after_thread_action_sticky(self):
+        self.thread.last_post.set_checkpoint(self.request, 'resolved')
+        self.thread.last_post.save(force_update=True)
         self.request.messages.set_flash(Message(_('Report has been set as resolved.')), 'success', 'threads')
 
     def after_thread_action_normal(self):
+        self.thread.last_post.set_checkpoint(self.request, 'bogus')
+        self.thread.last_post.save(force_update=True)
         self.request.messages.set_flash(Message(_('Report has been set as bogus.')), 'success', 'threads')
 
     def after_thread_action_undelete(self):

+ 5 - 1
static/cranefly/css/cranefly.css

@@ -1191,7 +1191,11 @@ a.btn-link:hover,a.btn-link:active,a.btn-link:focus{opacity:0.9;filter:alpha(opa
 .post-diff .post-diff-details table td.added{background-color:#dff1df;color:#285d28;font-weight:bold;}.post-diff .post-diff-details table td.added.even{background-color:#cdeacd;}
 .post-diff .post-diff-details table td.removed{background-color:#faeae8;color:#7c261b;font-weight:bold;}.post-diff .post-diff-details table td.removed.even{background-color:#f5d7d4;}
 .post-diff .post-diff-details table td.stag{color:#555555;}
-.report-view .report-wrapper{background-color:#eeeeee;background-image:-webkit-gradient(linear, 0 0, 100% 100%, color-stop(0.25, rgba(255, 255, 255, 0.2)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.2)), color-stop(0.75, rgba(255, 255, 255, 0.2)), color-stop(0.75, transparent), to(transparent));background-image:-webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.2) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.2) 75%, transparent 75%, transparent);background-image:-moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.2) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.2) 75%, transparent 75%, transparent);background-image:-ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.2) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.2) 75%, transparent 75%, transparent);background-image:-o-linear-gradient(-45deg, rgba(255, 255, 255, 0.2) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.2) 75%, transparent 75%, transparent);background-image:linear-gradient(-45deg, rgba(255, 255, 255, 0.2) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.2) 75%, transparent 75%, transparent);-webkit-background-size:10px 10px;-moz-background-size:10px 10px;background-size:10px 10px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;padding:8px;margin-bottom:8px;}.report-view .report-wrapper .post-body{margin-bottom:0px;}
+.report-view .report-wrapper{background-color:#eeeeee;background-image:-webkit-gradient(linear, 0 0, 100% 100%, color-stop(0.25, rgba(255, 255, 255, 0.2)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.2)), color-stop(0.75, rgba(255, 255, 255, 0.2)), color-stop(0.75, transparent), to(transparent));background-image:-webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.2) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.2) 75%, transparent 75%, transparent);background-image:-moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.2) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.2) 75%, transparent 75%, transparent);background-image:-ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.2) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.2) 75%, transparent 75%, transparent);background-image:-o-linear-gradient(-45deg, rgba(255, 255, 255, 0.2) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.2) 75%, transparent 75%, transparent);background-image:linear-gradient(-45deg, rgba(255, 255, 255, 0.2) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.2) 75%, transparent 75%, transparent);-webkit-background-size:10px 10px;-moz-background-size:10px 10px;background-size:10px 10px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;padding:8px;margin-bottom:8px;}.report-view .report-wrapper .post-body{margin-bottom:0px;}.report-view .report-wrapper .post-body .report-actions{border-left:none !important;float:left !important;padding:0px !important;}.report-view .report-wrapper .post-body .report-actions:first-child .btn{-webkit-border-radius:0px 0px 0px 3px !important;-moz-border-radius:0px 0px 0px 3px !important;border-radius:0px 0px 0px 3px !important;}
+.report-view .report-wrapper .post-body .report-actions .btn{opacity:0.9 !important;filter:alpha(opacity=90) !important;margin:0px !important;padding:8px 12px !important;color:#ffffff !important;font-weight:bold !important;}.report-view .report-wrapper .post-body .report-actions .btn i{background-image:url("../img/glyphicons-halflings-white.png");position:relative;top:0px;}
+.report-view .report-wrapper .post-body .report-actions .btn:hover,.report-view .report-wrapper .post-body .report-actions .btn:active,.report-view .report-wrapper .post-body .report-actions .btn:focus{opacity:1 !important;filter:alpha(opacity=100) !important;text-decoration:none !important;}
+.report-view .report-wrapper .post-body .report-actions .btn.btn-resolve{background-color:#3e933e;text-shadow:0px 1px 0px #285d28;}
+.report-view .report-wrapper .post-body .report-actions .btn.btn-bogus{background-color:#333333;text-shadow:0px 1px 0px #000000;}
 .reports-list .thread-label{overflow:visible;}.reports-list .thread-label .report-label{-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;float:right;padding:3px 8px;position:relative;right:-32px;bottom:2px;color:#ffffff;font-weight:bold;}.reports-list .thread-label .report-label i{background-image:url("../img/glyphicons-halflings-white.png");}
 .reports-list .thread-label .report-label.report-open{background-color:#f89406;text-shadow:0px 1px 0px #945904;}
 .reports-list .thread-label .report-label.report-resolved{background-color:#46a546;text-shadow:0px 1px 0px #285d28;}

+ 41 - 0
static/cranefly/css/cranefly/report.less

@@ -33,6 +33,47 @@
 
     .post-body {
       margin-bottom: 0px;
+
+      .report-actions {
+        border-left: none !important;
+        float: left !important;
+        padding: 0px !important;
+
+        &:first-child .btn {
+          .border-radius(0px 0px 0px @baseBorderRadius) !important;
+        }
+
+        .btn {
+          .opacity(90) !important;
+          margin: 0px !important;
+          padding: 8px 12px !important;
+
+          color: @white !important;
+          font-weight: bold !important;
+
+          i {
+            background-image: url("@{iconWhiteSpritePath}");
+            position: relative;
+            top: 0px;
+          }
+
+          &:hover, &:active, &:focus {
+            .opacity(100) !important;
+
+            text-decoration: none !important;
+          }
+
+          &.btn-resolve {
+            background-color: darken(@green, 5%);
+            text-shadow: 0px 1px 0px darken(@green, 20%);
+          }
+
+          &.btn-bogus {
+            background-color: @grayDark;
+            text-shadow: 0px 1px 0px darken(@grayDark, 20%);
+          }
+        }
+      }
     }
   }
 }

+ 38 - 4
templates/cranefly/reports/thread.html

@@ -135,6 +135,38 @@
             </div>
           </div>
           <div class="post-footer">{% filter trim %}
+            {% if post.pk == thread.start_post_id %}
+            <div class="post-actions report-actions">
+              {% if thread.weight == 2 %}
+              <form action="{{ request_path }}" class="form-inline" method="post">
+                <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
+                <input type="hidden" name="origin" value="thread_form">
+                <input type="hidden" name="thread_action" value="sticky">
+                <button type="submit" class="btn btn-link btn-resolve tooltip-top" title="{% trans %}Set this report as resolved{% endtrans %}"><i class="icon-ok"></i> {% trans %}Resolved{% endtrans %}</button>
+              </form>
+              <form action="{{ request_path }}" class="form-inline" method="post">
+                <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
+                <input type="hidden" name="origin" value="thread_form">
+                <input type="hidden" name="thread_action" value="normal">
+                <button type="submit" class="btn btn-link btn-bogus tooltip-top" title="{% trans %}Set this report as bogus{% endtrans %}"><i class="icon-remove"></i> {% trans %}Bogus{% endtrans %}</button>
+              </form>
+              {% elif thread.weight != 1 %}
+              <form action="{{ request_path }}" class="form-inline" method="post">
+                <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
+                <input type="hidden" name="origin" value="thread_form">
+                <input type="hidden" name="thread_action" value="sticky">
+                <button type="submit" class="btn btn-link btn-resolve tooltip-top" title="{% trans %}Set this report as bogus{% endtrans %}"><i class="icon-ok"></i> {% trans %}Resolved{% endtrans %}</button>
+              </form>
+              {% elif thread.weight != 0 %}
+              <form action="{{ request_path }}" class="form-inline" method="post">
+                <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
+                <input type="hidden" name="origin" value="thread_form">
+                <input type="hidden" name="thread_action" value="normal">
+                <button type="submit" class="btn btn-link btn-bogus tooltip-top" title="{% trans %}Set this report as resolved{% endtrans %}"><i class="icon-remove"></i> {% trans %}Bogus{% endtrans %}</button>
+              </form>
+              {% endif %}
+            </div>
+            {% endif %}
             <div class="post-actions">
               {% if acl.users.can_see_users_trails() -%}
               <a href="{% url 'post_info' thread=thread.pk, slug=thread.slug, post=post.pk %}" class="post-trail">{% trans %}Info{% endtrans %}</a>
@@ -204,12 +236,16 @@
         <span>
           {%- if checkpoint.action == 'limit' -%}
           <i class="icon-lock"></i> {% trans  %}This thread has reached its post limit and has been closed.{% endtrans %}
+          {%- elif checkpoint.action == 'resolved' -%}
+          <i class="icon-ok"></i> {% trans user=checkpoint_user(checkpoint), date=checkpoint.date|reltimesince|low %}{{ user }} has set this report as resolved {{ date }}{% endtrans %}
+          {%- elif checkpoint.action == 'bogus' -%}
+          <i class="icon-remove"></i> {% trans user=checkpoint_user(checkpoint), date=checkpoint.date|reltimesince|low %}{{ user }} has set this report as bogus {{ date }}{% endtrans %}
+          {%- elif checkpoint.action == 'reported' -%}
+          <i class="icon-fire"></i> {% trans user=checkpoint_user(checkpoint), date=checkpoint.date|reltimesince|low %}{{ user }} has also reported this post {{ date }}{% endtrans %}
           {%- elif checkpoint.action == 'deleted' -%}
           <i class="icon-trash"></i> {% trans user=checkpoint_user(checkpoint), date=checkpoint.date|reltimesince|low %}{{ user }} deleted this thread {{ date }}{% endtrans %}
           {%- elif checkpoint.action == 'undeleted' -%}
           <i class="icon-trash"></i> {% trans user=checkpoint_user(checkpoint), date=checkpoint.date|reltimesince|low %}{{ user }} restored this thread {{ date }}{% endtrans %}
-          {%- elif checkpoint.action == 'reported' -%}
-          <i class="icon-fire"></i> {% trans user=checkpoint_user(checkpoint), date=checkpoint.date|reltimesince|low %}{{ user }} has also reported this post {{ date }}{% endtrans %}
           {%- endif -%}
           {% if acl.threads.can_delete_checkpoint(forum) %}
           {% if checkpoint.deleted %}
@@ -240,14 +276,12 @@
 
   {% if thread_form or posts_form %}
   <div class="thread-moderation">
-    {% if thread_form%}
     <form id="thread_form" class="form-inline pull-left" action="{{ request_path }}" method="POST">
       <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
       <input type="hidden" name="origin" value="thread_form">
       {{ form_theme.input_select(thread_form['thread_action'],width=3) }}
       <button type="submit" class="btn btn-danger">{% trans %}Go{% endtrans %}</button>
     </form>
-    {% endif %}
     {% if posts_form%}
     <form id="posts_form" class="form-inline pull-right" action="{{ request_path }}" method="POST">
       <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">