summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2012-11-26 13:24:24 -0300
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2012-11-26 13:24:24 -0300
commit46526ef93e87cd4ac1e75f760543688751981300 (patch)
treeea9bc4e0efd9cec33a09b33614d2dc3e37d2b42b
parentefbd24dc205c2397b1ead808f89376c95f6a6cc1 (diff)
parentac052de56b2942a5d5421b5d475716037f269897 (diff)
downloadaskbot-46526ef93e87cd4ac1e75f760543688751981300.tar.gz
askbot-46526ef93e87cd4ac1e75f760543688751981300.tar.bz2
askbot-46526ef93e87cd4ac1e75f760543688751981300.zip
Merge branch 'master' into responsive
-rw-r--r--askbot/models/post.py4
-rw-r--r--askbot/templates/meta/html_head_javascript.html1
-rw-r--r--askbot/templates/question.html5
-rw-r--r--askbot/views/writers.py8
4 files changed, 13 insertions, 5 deletions
diff --git a/askbot/models/post.py b/askbot/models/post.py
index ce7b249b..bde6acaf 100644
--- a/askbot/models/post.py
+++ b/askbot/models/post.py
@@ -416,11 +416,11 @@ class Post(models.Model):
if self.post_type in ('question', 'answer', 'tag_wiki', 'reject_reason'):
_urlize = False
- _use_markdown = True
+ _use_markdown = (askbot_settings.EDITOR_TYPE == 'markdown')
_escape_html = False #markdow does the escaping
elif self.is_comment():
_urlize = True
- _use_markdown = True
+ _use_markdown = (askbot_settings.EDITOR_TYPE == 'markdown')
_escape_html = True
else:
raise NotImplementedError
diff --git a/askbot/templates/meta/html_head_javascript.html b/askbot/templates/meta/html_head_javascript.html
index 09362baa..306f325a 100644
--- a/askbot/templates/meta/html_head_javascript.html
+++ b/askbot/templates/meta/html_head_javascript.html
@@ -19,6 +19,7 @@
askbot['data']['userIsAuthenticated'] = false;
askbot['data']['userReputation'] = 0;
{% endif %}
+ askbot['data']['maxCommentLength'] = {{settings.MAX_COMMENT_LENGTH}};
askbot['urls'] = {};
askbot['settings'] = {};
askbot['settings']['editorType'] = '{{ settings.EDITOR_TYPE }}';
diff --git a/askbot/templates/question.html b/askbot/templates/question.html
index 57c71068..5a317707 100644
--- a/askbot/templates/question.html
+++ b/askbot/templates/question.html
@@ -63,7 +63,10 @@
var answer_id = 'post-id-' + post_id;
var answer_container = document.getElementById(answer_id);
var answer_element= answer_container.getElementsByClassName('answer-body')[0].children[1];
- if (answer_element.textContent.length > 300){
+ if (
+ answer_element.textContent.length >
+ askbot['data']['maxCommentLength']
+ ){
convert_answer.parentNode.removeChild(convert_answer);
}
} else{
diff --git a/askbot/views/writers.py b/askbot/views/writers.py
index da4ce6a1..fadacd1f 100644
--- a/askbot/views/writers.py
+++ b/askbot/views/writers.py
@@ -772,7 +772,7 @@ def answer_to_comment(request):
answer_id = int(answer_id)
answer = get_object_or_404(models.Post,
post_type = 'answer', id=answer_id)
- if len(answer.text) <= 300:
+ if len(answer.text) <= askbot_settings.MAX_COMMENT_LENGTH:
answer.post_type = 'comment'
answer.parent = answer.thread._question_post()
#can we trust this?
@@ -790,7 +790,11 @@ def answer_to_comment(request):
answer.thread.invalidate_cached_data()
else:
- request.user.message_set.create(message = _("the selected answer cannot be a comment"))
+ message = _(
+ 'Cannot convert, because text has more characters than '
+ '%(max_chars)s - maximum allowed for comments'
+ ) % askbot_settings.MAX_COMMENT_LENGTH
+ request.user.message_set.create(message=message)
return HttpResponseRedirect(answer.get_absolute_url())
else: