diff options
-rw-r--r-- | askbot/skins/default/media/style/style.css | 4 | ||||
-rw-r--r-- | askbot/skins/default/media/style/style.less | 4 | ||||
-rw-r--r-- | askbot/skins/default/templates/question.html | 11 | ||||
-rw-r--r-- | askbot/skins/default/templates/question/javascript.html | 1 | ||||
-rw-r--r-- | askbot/views/writers.py | 18 |
5 files changed, 29 insertions, 9 deletions
diff --git a/askbot/skins/default/media/style/style.css b/askbot/skins/default/media/style/style.css index 97dc1a73..d787977d 100644 --- a/askbot/skins/default/media/style/style.css +++ b/askbot/skins/default/media/style/style.css @@ -2040,11 +2040,13 @@ ul#related-tags li { } .question-page .comments .comment-body .convert input { background: none; + padding: 0px; color: #1B79BD; border: none; width: auto; font-family: Arial; - line-height: 12.5px; + line-height: 14px; + margin-left: 6px; font-size: 13px; } .question-page .comments .comment-body .convert input:hover { diff --git a/askbot/skins/default/media/style/style.less b/askbot/skins/default/media/style/style.less index 1a3e3c7d..062ccd36 100644 --- a/askbot/skins/default/media/style/style.less +++ b/askbot/skins/default/media/style/style.less @@ -1957,11 +1957,13 @@ ul#related-tags li { .convert input{ background: none; + padding: 0px; color: #1B79BD; border:none; width:auto; font-family: Arial; - line-height: 12.5px; + line-height: 14px; + margin-left: 6px; font-size: 13px; } diff --git a/askbot/skins/default/templates/question.html b/askbot/skins/default/templates/question.html index bb74db33..4374dc8e 100644 --- a/askbot/skins/default/templates/question.html +++ b/askbot/skins/default/templates/question.html @@ -148,11 +148,22 @@ ); } } + + function hide_convert_links(){ + if (!askbot['data']['userIsAdminOrMod']){ + var links = document.getElementsByClassName('convert'); + for (i=0; i<links.length; i++){ + links[i].setAttribute('style', 'display:none;'); + } + } + } + askbot['functions'] = askbot['functions'] || {}; askbot['functions']['renderPostVoteButtons'] = render_vote_buttons; askbot['functions']['renderPostControls'] = render_post_controls; askbot['functions']['renderAddCommentButton'] = render_add_comment_button; askbot['functions']['renderAddAnswerButton'] = render_add_answer_button; + askbot['functions']['hideConvertLinks'] = hide_convert_links; })(); </script> {% endblock %} diff --git a/askbot/skins/default/templates/question/javascript.html b/askbot/skins/default/templates/question/javascript.html index 5b73854e..51555bc1 100644 --- a/askbot/skins/default/templates/question/javascript.html +++ b/askbot/skins/default/templates/question/javascript.html @@ -53,6 +53,7 @@ $("#fmanswer_button").hide(); }); {%endif%} + askbot['functions']['hideConvertLinks'](); }); $(window).bind('hashchange', animate_hashes); diff --git a/askbot/views/writers.py b/askbot/views/writers.py index c2521b92..4640a66d 100644 --- a/askbot/views/writers.py +++ b/askbot/views/writers.py @@ -671,10 +671,14 @@ def delete_comment(request): @decorators.admins_only @decorators.post_only def comment_to_answer(request): - comment_id = int(request.POST['comment_id']) - comment = get_object_or_404(models.Post, post_type = 'comment', id=comment_id) - comment.post_type = 'answer' - comment.save() - comment.thread.invalidate_cached_data() - - return HttpResponseRedirect(comment.get_absolute_url()) + comment_id = request.POST.get('comment_id') + if comment_id: + comment_id = int(comment_id) + comment = get_object_or_404(models.Post, post_type = 'comment', id=comment_id) + comment.post_type = 'answer' + comment.save() + comment.thread.invalidate_cached_data() + + return HttpResponseRedirect(comment.get_absolute_url()) + else: + raise Http404 |