summaryrefslogtreecommitdiffstats
path: root/askbot/skins
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2012-09-11 08:28:58 -0400
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2012-09-11 08:28:58 -0400
commita1ca047f68fd11d536b637c3e1c12615703f8492 (patch)
tree4cde54084129d8dcb40be94945eb57f12c424519 /askbot/skins
parenta8913956f07777874622baa484205caed866311d (diff)
parent72b7105b032fe501d0b4d8183850a51dff1f5c09 (diff)
downloadaskbot-a1ca047f68fd11d536b637c3e1c12615703f8492.tar.gz
askbot-a1ca047f68fd11d536b637c3e1c12615703f8492.tar.bz2
askbot-a1ca047f68fd11d536b637c3e1c12615703f8492.zip
Merge branch 'adolfo-master' into user-groups
Diffstat (limited to 'askbot/skins')
-rw-r--r--askbot/skins/common/media/js/post.js6
-rw-r--r--askbot/skins/common/media/js/utils.js10
-rw-r--r--askbot/skins/common/templates/question/answer_controls.html8
-rw-r--r--askbot/skins/default/media/style/style.css40
-rw-r--r--askbot/skins/default/media/style/style.less35
-rw-r--r--askbot/skins/default/templates/macros.html2
-rw-r--r--askbot/skins/default/templates/question.html17
-rw-r--r--askbot/skins/default/templates/question/javascript.html1
8 files changed, 104 insertions, 15 deletions
diff --git a/askbot/skins/common/media/js/post.js b/askbot/skins/common/media/js/post.js
index adcb0cd6..6074ab63 100644
--- a/askbot/skins/common/media/js/post.js
+++ b/askbot/skins/common/media/js/post.js
@@ -1703,9 +1703,9 @@ Comment.prototype.decorate = function(element){
this._edit_link.decorate(edit_link);
}
- var convert_link = this._element.find('form.convert');
+ var convert_link = this._element.find('form.convert-comment');
if (this._is_convertible){
- this._convert_link = new ConvertLink(comment_id);
+ this._convert_link = new CommentConvertLink(comment_id);
this._convert_link.decorate(convert_link);
}
@@ -1794,7 +1794,7 @@ Comment.prototype.setContent = function(data){
}
if (this._is_convertible){
- this._convert_link = new ConvertLink(this._data['id']);
+ this._convert_link = new CommentConvertLink(this._data['id']);
this._comment_body.append(this._convert_link.getElement());
}
this._element.append(this._comment_body);
diff --git a/askbot/skins/common/media/js/utils.js b/askbot/skins/common/media/js/utils.js
index 0e23963e..42f19d5b 100644
--- a/askbot/skins/common/media/js/utils.js
+++ b/askbot/skins/common/media/js/utils.js
@@ -655,15 +655,15 @@ EditLink.prototype.decorate = function(element){
this.setHandlerInternal();
};
-var ConvertLink = function(comment_id){
+var CommentConvertLink = function(comment_id){
WrappedElement.call(this)
this._comment_id = comment_id;
};
-inherits(ConvertLink, WrappedElement);
+inherits(CommentConvertLink, WrappedElement);
-ConvertLink.prototype.createDom = function(){
+CommentConvertLink.prototype.createDom = function(){
var element = this.makeElement('form');
- element.addClass('convert');
+ element.addClass('convert-comment');
element.attr('method', 'POST');
element.attr('action', askbot['urls']['convertComment']);
var hidden_input = this.makeElement('input');
@@ -681,7 +681,7 @@ ConvertLink.prototype.createDom = function(){
};
-ConvertLink.prototype.decorate = function(element){
+CommentConvertLink.prototype.decorate = function(element){
this._element = element;
};
diff --git a/askbot/skins/common/templates/question/answer_controls.html b/askbot/skins/common/templates/question/answer_controls.html
index e0edc2e8..9b3be6f0 100644
--- a/askbot/skins/common/templates/question/answer_controls.html
+++ b/askbot/skins/common/templates/question/answer_controls.html
@@ -39,6 +39,14 @@
<span id='post-{{answer.id}}-edit' class="action-link">
<a class="question-edit" href="{% url edit_answer answer.id %}">{% trans %}edit{% endtrans %}</a>
</span>
+<span id='post-{{answer.id}}-convert' class="action-link">
+ <form class="answer-convert" action="{% url answer_to_comment %}" method="POST">
+ {% csrf_token %}
+ <input type="hidden" name="answer_id" id="id_answer_id" value="{{answer.id}}">
+ <input type="submit" name="" value="{% trans %}convert to comment{% endtrans %}">
+ </form>
+</span>
<script type="text/javascript">
askbot['functions']['renderPostControls']('{{answer.id}}');
+ askbot['functions']['hideConvertAnswerLinks']('{{answer.id}}');
</script>
diff --git a/askbot/skins/default/media/style/style.css b/askbot/skins/default/media/style/style.css
index 2e558988..752f0def 100644
--- a/askbot/skins/default/media/style/style.css
+++ b/askbot/skins/default/media/style/style.css
@@ -2076,6 +2076,40 @@ ul#related-tags li {
.question-page .answer-controls .permant-link {
background: url(../images/link.png) no-repeat center left;
}
+.question-page .post-controls .answer-convert,
+.question-page .answer-controls .answer-convert {
+ float: right;
+ clear: left;
+ /*background: url(../images/link.png) no-repeat center left;*/
+
+}
+.question-page .post-controls .answer-convert input,
+.question-page .answer-controls .answer-convert input {
+ font-size: 12px;
+ color: #777;
+ font-family: Arial;
+ text-decoration: none;
+ display: inline;
+ white-space: nowrap;
+ padding-left: 0px;
+ background: none;
+ border: none;
+ padding: 0px 7px 3px 18px;
+ float: right;
+ height: 18px;
+ line-height: 18px;
+ margin-top: -2px;
+ margin-left: 4px;
+}
+.question-page .post-controls .answer-convert input:hover,
+.question-page .answer-controls .answer-convert input:hover {
+ background-color: #f5f0c9;
+ border-radius: 3px;
+ -ms-border-radius: 3px;
+ -moz-border-radius: 3px;
+ -webkit-border-radius: 3px;
+ -khtml-border-radius: 3px;
+}
.question-page .tabBar {
width: 100%;
}
@@ -2306,12 +2340,12 @@ ul#related-tags li {
.question-page .comments .comment-body .edit {
padding-left: 6px;
}
-.question-page .comments .comment-body .convert {
+.question-page .comments .comment-body .convert-comment {
display: inline;
white-space: nowrap;
padding-left: 0px;
}
-.question-page .comments .comment-body .convert input {
+.question-page .comments .comment-body .convert-comment input {
background: none;
padding: 0px;
color: #1B79BD;
@@ -2322,7 +2356,7 @@ ul#related-tags li {
margin-left: 6px;
font-size: 13px;
}
-.question-page .comments .comment-body .convert input:hover {
+.question-page .comments .comment-body .convert-comment input:hover {
text-decoration: underline;
cursor: pointer;
}
diff --git a/askbot/skins/default/media/style/style.less b/askbot/skins/default/media/style/style.less
index 8d10a4d4..f3151cf0 100644
--- a/askbot/skins/default/media/style/style.less
+++ b/askbot/skins/default/media/style/style.less
@@ -1982,6 +1982,35 @@ ul#related-tags li {
.permant-link{
background: url(../images/link.png) no-repeat center left;
}
+
+ .answer-convert{
+ float:right;
+ clear: left;
+ /*background: url(../images/link.png) no-repeat center left;*/
+ }
+
+ .answer-convert input{
+ font-size:12px;
+ color: #777;
+ font-family:@body-font;
+ text-decoration: none;
+ display:inline;
+ white-space:nowrap;
+ padding-left: 0px;
+ background: none;
+ border: none;
+ padding: 0px 7px 3px 18px;
+ float:right;
+ height:18px;
+ line-height:18px;
+ margin-top:-2px;
+ margin-left:4px;
+ }
+
+ .answer-convert input:hover{
+ background-color: #f5f0c9;
+ .rounded-corners(3px);
+ }
}
.tabBar{
width:100%;
@@ -2178,13 +2207,13 @@ ul#related-tags li {
padding-left:6px;
}
- .convert {
+ .convert-comment{
display: inline;
white-space: nowrap;
padding-left: 0px;
}
- .convert input{
+ .convert-comment input{
background: none;
padding: 0px;
color: #1B79BD;
@@ -2196,7 +2225,7 @@ ul#related-tags li {
font-size: 13px;
}
- .convert input:hover{
+ .convert-comment input:hover{
text-decoration:underline;
cursor:pointer;
}
diff --git a/askbot/skins/default/templates/macros.html b/askbot/skins/default/templates/macros.html
index 91f2a655..d1732ee5 100644
--- a/askbot/skins/default/templates/macros.html
+++ b/askbot/skins/default/templates/macros.html
@@ -424,7 +424,7 @@ for the purposes of the AJAX comment editor #}
<span class="age">&nbsp;({{ timeago(comment.added_at) }})</span>
<a id="post-{{comment.id}}-edit"
class="edit">{% trans %}edit{% endtrans %}</a>
- <form action="{% url comment_to_answer %}" method="POST" accept-charset="utf-8" class='convert'>
+ <form action="{% url comment_to_answer %}" method="POST" accept-charset="utf-8" class='convert-comment'>
{% csrf_token %}
<input type="hidden" value="{{comment.id}}" name="comment_id" id="id_comment_id">
<input type="submit" value="{% trans %}convert to answer{% endtrans %}">
diff --git a/askbot/skins/default/templates/question.html b/askbot/skins/default/templates/question.html
index 651392fc..85210bbd 100644
--- a/askbot/skins/default/templates/question.html
+++ b/askbot/skins/default/templates/question.html
@@ -54,6 +54,22 @@
}
}
}
+
+ function hide_convert_answer_links(post_id){
+ var answer_convert_id = 'post-' + post_id + '-convert';
+ var convert_answer = document.getElementById(answer_convert_id);
+ if (data['userIsAdminOrMod']){
+ 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){
+ convert_answer.parentNode.removeChild(convert_answer);
+ }
+ } else{
+ convert_answer.parentNode.removeChild(convert_answer);
+ }
+ }
+
function render_post_controls(post_id){
if (data['userIsAdminOrMod']){
return;//all functions on
@@ -172,6 +188,7 @@
askbot['functions']['renderAddCommentButton'] = render_add_comment_button;
askbot['functions']['renderAddAnswerButton'] = render_add_answer_button;
askbot['functions']['hideConvertLinks'] = hide_convert_links;
+ askbot['functions']['hideConvertAnswerLinks'] = hide_convert_answer_links;
})();
/*]]>*/
</script>
diff --git a/askbot/skins/default/templates/question/javascript.html b/askbot/skins/default/templates/question/javascript.html
index 9e1366fb..df81ede2 100644
--- a/askbot/skins/default/templates/question/javascript.html
+++ b/askbot/skins/default/templates/question/javascript.html
@@ -10,6 +10,7 @@
askbot['urls']['editComment'] = '{% url edit_comment %}';
askbot['urls']['deleteComment'] = '{% url delete_comment %}';
askbot['urls']['convertComment'] = '{% url comment_to_answer %}';
+ askbot['urls']['convertAnswer'] = '{% url answer_to_comment %}';
askbot['urls']['getComment'] = '{% url get_comment %}';
askbot['urls']['saveDraftAnswer'] = '{% url save_draft_answer %}';
askbot['urls']['question_url_template'] = scriptUrl + '{{ 'question/'|transurl }}{{ "{{QuestionID}}/{{questionSlug}}" }}';{# yes it needs to be that whacky #}