summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2014-07-14 15:23:23 -0300
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2014-07-14 15:23:23 -0300
commit448b122b6e4522d66b6b71f4822ad1caf9f9c3f3 (patch)
tree0cce2669ddf2c6f2a4439a95de7dd8aa05d35f05
parentefbb9cde888e194c446c4e1913e04972b3e7df65 (diff)
downloadaskbot-448b122b6e4522d66b6b71f4822ad1caf9f9c3f3.tar.gz
askbot-448b122b6e4522d66b6b71f4822ad1caf9f9c3f3.tar.bz2
askbot-448b122b6e4522d66b6b71f4822ad1caf9f9c3f3.zip
bugfixes in premoderation and allowed loading more moderation messages when few are left
-rw-r--r--askbot/media/js/user.js27
-rw-r--r--askbot/media/style/style.css6
-rw-r--r--askbot/media/style/style.less9
-rw-r--r--askbot/models/question.py19
-rw-r--r--askbot/templates/moderation/queue.html4
-rw-r--r--askbot/templates/question/question_card.html2
6 files changed, 55 insertions, 12 deletions
diff --git a/askbot/media/js/user.js b/askbot/media/js/user.js
index d79a3986..11457803 100644
--- a/askbot/media/js/user.js
+++ b/askbot/media/js/user.js
@@ -129,6 +129,10 @@ PostModerationControls.prototype.setEntryCount = function(count) {
this._entryCount.html(count);
};
+PostModerationControls.prototype.getEntryCount = function() {
+ return this.getCheckBoxes().length;
+};
+
PostModerationControls.prototype.getCheckBoxes = function() {
return this._element.find('.messages input[type="checkbox"]');
};
@@ -180,8 +184,27 @@ PostModerationControls.prototype.getModHandler = function(action, items, optReas
me.removeEntries(response_data['memo_ids']);
me.setEntryCount(response_data['memo_count']);
}
- if (response_data['message']) {
- me.showMessage(response_data['message']);
+
+ var message = response_data['message'] || '';
+ if (me.getEntryCount() < 10 && response_data['memo_count'] > 9) {
+ if (message) {
+ message += '. '
+ }
+ var junk = $('#junk-mod');
+ if (junk.length == 0) {
+ junk = me.makeElement('div');
+ junk.attr('id', 'junk-mod');
+ junk.hide();
+ $(document).append(junk);
+ }
+ var a = me.makeElement('a');
+ a.attr('href', window.location.href);
+ a.text(gettext('Load more items.'));
+ junk.append(a);
+ message += a[0].outerHTML;
+ }
+ if (message) {
+ me.showMessage(message);
}
}
});
diff --git a/askbot/media/style/style.css b/askbot/media/style/style.css
index ab5e12a6..b9bb6643 100644
--- a/askbot/media/style/style.css
+++ b/askbot/media/style/style.css
@@ -2052,8 +2052,9 @@ ul#related-tags li {
/* ----- Question template ----- */
.answer .moderated,
.question .moderated {
- background: url(../images/dialog-warning.png) 2px 0 no-repeat;
font-weight: bold;
+ background: url(../images/dialog-warning.png) 2px 0 no-repeat;
+ text-decoration: underline;
line-height: 16px !important;
margin-bottom: -2px !important;
padding-left: 24px !important;
@@ -3753,6 +3754,9 @@ button::-moz-focus-inner {
font-size: 12px;
padding: 0;
}
+.action-status a {
+ font-weight: bold;
+}
.inbox-flags .action-status {
line-height: 38px;
height: 24px;
diff --git a/askbot/media/style/style.less b/askbot/media/style/style.less
index 8c69e6e8..d508420c 100644
--- a/askbot/media/style/style.less
+++ b/askbot/media/style/style.less
@@ -2160,13 +2160,11 @@ ul#related-tags li {
/* ----- Question template ----- */
-.moderated {
-}
-
.answer, .question {
.moderated {
- background: url(../images/dialog-warning.png) 2px 0 no-repeat;
font-weight: bold;
+ background: url(../images/dialog-warning.png) 2px 0 no-repeat;
+ text-decoration: underline;
line-height: 16px !important;
margin-bottom: -2px !important;
padding-left: 24px !important;
@@ -3990,6 +3988,9 @@ button::-moz-focus-inner {
line-height: 10px;
font-size: 12px;
padding: 0;
+ a {
+ font-weight: bold;
+ }
}
.inbox-flags .action-status {
diff --git a/askbot/models/question.py b/askbot/models/question.py
index 399066b3..b6754e79 100644
--- a/askbot/models/question.py
+++ b/askbot/models/question.py
@@ -1108,12 +1108,26 @@ class Thread(models.Model):
post_to_author[post_id] = rev.author_id
post.set_runtime_needs_moderation()
+ def post_type_ord(p):
+ """need to sort by post type"""
+ if p.is_question():
+ return 0
+ elif p.is_answer():
+ return 1
+ return 2
+
+ def cmp_post_types(a, b):
+ """need to sort by post type"""
+ at = post_type_ord(a)
+ bt = post_type_ord(b)
+ return cmp(at, bt)
+
if len(post_id_set):
#brand new suggested posts
from askbot.models import Post
#order by insures that
- posts = Post.objects.filter(id__in=post_id_set).order_by('post_type')
- for post in posts:
+ posts = list(Post.objects.filter(id__in=post_id_set))
+ for post in sorted(posts, cmp=cmp_post_types):
rev = rev_map[post.id]
post.text = rev.text
post.html = post.parse_post_text()['html']
@@ -1127,6 +1141,7 @@ class Thread(models.Model):
all_posts.append(post)#add b/c there may be self-comments
if post.is_question():
post_data[0] = post
+ all_posts.append(post)
return post_data
diff --git a/askbot/templates/moderation/queue.html b/askbot/templates/moderation/queue.html
index 772aa48c..ae9ea880 100644
--- a/askbot/templates/moderation/queue.html
+++ b/askbot/templates/moderation/queue.html
@@ -5,11 +5,11 @@
{% endblock %}
{% block inbox_content %}
<div class="tools">
- <div class="select-items">
+ {#<div class="select-items">
<strong>{% trans %}Select:{% endtrans %}</strong>
<a class="sel-all">{% trans %}all{% endtrans %}</a> |
<a class="sel-none">{% trans %}none{% endtrans %}</a>
- </div>
+ </div>#}
<a class="btn approve-posts">{% trans %}approve posts{% endtrans %}</a>
<a class="btn approve-posts-users" id="re_approve_posts_users">{% trans %}approve posts and users{% endtrans %}</a>
<div class="btn-group dropdown decline-reasons-menu">
diff --git a/askbot/templates/question/question_card.html b/askbot/templates/question/question_card.html
index 12260f12..c90489a5 100644
--- a/askbot/templates/question/question_card.html
+++ b/askbot/templates/question/question_card.html
@@ -14,7 +14,7 @@
{% include "question/question_author_info.html" %}
</div>
{% if question.needs_moderation() %}
- <p class="moderated">{% trans %}This post awaiting moderation{% endtrans %}</p>
+ <p class="moderated">{% trans %}This post is awaiting moderation{% endtrans %}</p>
{% endif %}
{{ question.summary }}
</div>