summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdolfo Fitoria <adolfo.fitoria@gmail.com>2013-05-07 11:30:49 -0600
committerAdolfo Fitoria <adolfo.fitoria@gmail.com>2013-05-07 11:30:49 -0600
commitce48471aacfbc8bc84e698b1eb6eedb5010e9eb3 (patch)
tree7975ba2443d349e16e4fd708b414be1a14d89447
parent2b0ac640d004f54fa2993c2085a7b0fa727ef533 (diff)
parent8ac806f3fd19e2cc08643560432b8bc2f99f6497 (diff)
downloadaskbot-ce48471aacfbc8bc84e698b1eb6eedb5010e9eb3.tar.gz
askbot-ce48471aacfbc8bc84e698b1eb6eedb5010e9eb3.tar.bz2
askbot-ce48471aacfbc8bc84e698b1eb6eedb5010e9eb3.zip
Merge branch 'master' of github.com:ASKBOT/askbot-devel
-rw-r--r--askbot/conf/social_sharing.py7
-rw-r--r--askbot/doc/source/changelog.rst1
-rw-r--r--askbot/media/js/post.js10
-rw-r--r--askbot/media/js/wmd/wmd.js25
-rw-r--r--askbot/templates/question.html17
-rw-r--r--askbot/templates/user_profile/user_info.html8
6 files changed, 44 insertions, 24 deletions
diff --git a/askbot/conf/social_sharing.py b/askbot/conf/social_sharing.py
index e57dec28..392fa042 100644
--- a/askbot/conf/social_sharing.py
+++ b/askbot/conf/social_sharing.py
@@ -35,7 +35,12 @@ settings.register(
SOCIAL_SHARING,
'ENABLE_SHARING_TWITTER',
default=True,
- description=_('Check to enable sharing of questions on Twitter')
+ description=_('Check to enable sharing of questions on Twitter'),
+ help_text=_(
+ 'Important - to actually start sharing on twitter, '
+ 'it is required to set up Twitter consumer key and secret '
+ 'in the "keys to external services" section.'
+ )
)
)
diff --git a/askbot/doc/source/changelog.rst b/askbot/doc/source/changelog.rst
index d842db0d..cda70e77 100644
--- a/askbot/doc/source/changelog.rst
+++ b/askbot/doc/source/changelog.rst
@@ -3,6 +3,7 @@ Changes in Askbot
Development version
-------------------
+* Applied Askbot templates to the settings control panel
* Added option to auto-follow questions by the question posters with default "on"
* Support for Django 1.5
* Auto-tweet option for questions and answers
diff --git a/askbot/media/js/post.js b/askbot/media/js/post.js
index 4a2fb0d6..4d63559c 100644
--- a/askbot/media/js/post.js
+++ b/askbot/media/js/post.js
@@ -2225,8 +2225,12 @@ Comment.prototype.loadText = function(on_load_handler){
url: askbot['urls']['getComment'],
data: {id: this._data['id']},
success: function(json){
- me._data['text'] = json['text'];
- on_load_handler()
+ if (json['success']) {
+ me._data['text'] = json['text'];
+ on_load_handler()
+ } else {
+ showMessage(me.getElement(), json['message'], 'after');
+ }
},
error: function(xhr, textStatus, exception) {
showMessage(me.getElement(), xhr.responseText, 'after');
@@ -2576,7 +2580,7 @@ FoldedEditor.prototype.getEditorInputId = function() {
FoldedEditor.prototype.onAfterOpenHandler = function() {
var editor = this.getEditor();
if (editor) {
- setTimeout(editor.focus(), 500);
+ setTimeout(function() {editor.focus()}, 500);
}
};
diff --git a/askbot/media/js/wmd/wmd.js b/askbot/media/js/wmd/wmd.js
index c3c85b21..09e11371 100644
--- a/askbot/media/js/wmd/wmd.js
+++ b/askbot/media/js/wmd/wmd.js
@@ -452,8 +452,7 @@ util.prompt = function(text, defaultInputText, makeLinkMarkdown, dialogType){
if (input.type == 'text' && input.selectionStart !== undefined) {
input.selectionStart = 0;
input.selectionEnd = defTextLen;
- }
- else if (input.createTextRange) {
+ } else if (input.createTextRange) {
var range = input.createTextRange();
range.collapse(false);
range.moveStart("character", -defTextLen);
@@ -494,30 +493,26 @@ util.prompt = function(text, defaultInputText, makeLinkMarkdown, dialogType){
var innerWidth, innerHeight;
// It's not very clear which blocks work with which browsers.
- if(self.innerHeight && self.scrollMaxY){
+ if (self.innerHeight && self.scrollMaxY) {
scrollWidth = doc.body.scrollWidth;
scrollHeight = self.innerHeight + self.scrollMaxY;
- }
- else if(doc.body.scrollHeight > doc.body.offsetHeight){
+ } else if (doc.body.scrollHeight > doc.body.offsetHeight){
scrollWidth = doc.body.scrollWidth;
scrollHeight = doc.body.scrollHeight;
- }
- else{
+ } else {
scrollWidth = doc.body.offsetWidth;
scrollHeight = doc.body.offsetHeight;
}
- if(self.innerHeight){
+ if (self.innerHeight) {
// Non-IE browser
innerWidth = self.innerWidth;
innerHeight = self.innerHeight;
- }
- else if(doc.documentElement && doc.documentElement.clientHeight){
+ } else if (doc.documentElement && doc.documentElement.clientHeight){
// Some versions of IE (IE 6 w/ a DOCTYPE declaration)
innerWidth = doc.documentElement.clientWidth;
innerHeight = doc.documentElement.clientHeight;
- }
- else if(doc.body){
+ } else if(doc.body) {
// Other versions of IE
innerWidth = doc.body.clientWidth;
innerHeight = doc.body.clientHeight;
@@ -1917,7 +1912,7 @@ util.prompt = function(text, defaultInputText, makeLinkMarkdown, dialogType){
if (start_now){
loadListener();
} else {
- util.addEvent(top, "load", loadListener);
+ util.addEvent(window, "load", loadListener);
}
};
@@ -1950,7 +1945,7 @@ util.prompt = function(text, defaultInputText, makeLinkMarkdown, dialogType){
var result = 0;
- if (innerHeight) {
+ if (window.innerHeight) {
result = pageYOffset;
}
else
@@ -2495,7 +2490,7 @@ if (askbot['settings']['editorType'] == 'markdown' && !Attacklab.wmd) {
mergeEnv(Attacklab.wmd_defaults);
mergeEnv(Attacklab.account_options);
- mergeEnv(top["wmd_options"]);
+ mergeEnv(window["wmd_options"]);
Attacklab.full = true;
var defaultButtons = "bold italic link blockquote code image attachment ol ul heading hr";
diff --git a/askbot/templates/question.html b/askbot/templates/question.html
index 3364cc2f..a8aef0a7 100644
--- a/askbot/templates/question.html
+++ b/askbot/templates/question.html
@@ -43,6 +43,10 @@
return nodes;
};
+ var getTextContent = function(node) {
+ return node.innerText || node.textContent;
+ };
+
var hasAttribute = function(node, attrName) {
if (node.hasAttribute) {
return node.hasAttribute(attrName);
@@ -62,6 +66,13 @@
return null;
};
+ var postIsComment = function(postId) {
+ if (document.getElementById('comment-' + postId)) {
+ return true;
+ }
+ return false;
+ };
+
var removeNode = function(node) {
node.parentNode.removeChild(node);
};
@@ -132,7 +143,7 @@
//todo: this is not reliable
var answerBodyNodes = answerBody.childNodes;
var answerElement = answerBodyNodes[answerBodyNodes.length - 1];
- if (trim(answerElement.textContent).length > askbot['data']['maxCommentLength']) {
+ if (trim(getTextContent(answerElement)).length > askbot['data']['maxCommentLength']) {
repostAsQuestionComment.parentNode.removeChild(repostAsQuestionComment);
repostAsPrevAnsComment.parentNode.removeChild(repostAsPrevAnsComment);
} else if (parseInt(post_id) === data['oldestAnswerId']) {
@@ -186,9 +197,9 @@
) {
removeNode(closeBtn[0]);
}
+ var repLow = (data['userReputation'] < {{settings.MIN_REP_TO_EDIT_OTHERS_POSTS}});
if (//maybe remove "edit" button
- data['userReputation'] <
- {{settings.MIN_REP_TO_EDIT_OTHERS_POSTS}}
+ repLow || postIsComment(post_id)//only authors edit comments
){
var edit_btn = document.getElementById(
'post-' + post_id + '-edit'
diff --git a/askbot/templates/user_profile/user_info.html b/askbot/templates/user_profile/user_info.html
index 8f7a5006..95baad20 100644
--- a/askbot/templates/user_profile/user_info.html
+++ b/askbot/templates/user_profile/user_info.html
@@ -88,8 +88,12 @@
<td>{{ macros.user_website_link(view_user, max_display_length = 30) }}</td>
</tr>
{% endif %}
- {% if request.user == view_user and settings.ENABLE_SHARING_TWITTER %}
- {% include "user_profile/twitter_sharing_controls.html" %}
+ {% if request.user == view_user and
+ settings.TWITTER_SECRET and
+ settings.TWITTER_KEY and
+ settings.ENABLE_SHARING_TWITTER
+ %}
+ {% include "user_profile/twitter_sharing_controls.html" %}
{% endif %}
{% if view_user.location or view_user.country %}
<tr>