summaryrefslogtreecommitdiffstats
path: root/askbot/templates/question.html
diff options
context:
space:
mode:
Diffstat (limited to 'askbot/templates/question.html')
-rw-r--r--askbot/templates/question.html40
1 files changed, 38 insertions, 2 deletions
diff --git a/askbot/templates/question.html b/askbot/templates/question.html
index 592a0893..e1310e3c 100644
--- a/askbot/templates/question.html
+++ b/askbot/templates/question.html
@@ -15,6 +15,9 @@
//below is pure cross-browser javascript, no jQuery
askbot['data']['userIsThreadModerator'] = {% if user_is_thread_moderator %}true{% else %}false{% endif %};
askbot['data']['oldestAnswerId'] = {% if oldest_answer_id %}{{ oldest_answer_id }}{% else %}-1{% endif %};
+ {% if settings.READ_ONLY_MODE_ENABLED %}
+ askbot['settings']['readOnlyModeEnabled'] = true;
+ {% endif %}
(function(){
var hasClass = function(node, selector) {
@@ -174,7 +177,37 @@
}
}
+ function remove_all_controls(post_id) {
+ var deleteBtn = document.getElementById('post-' + post_id + '-delete');
+ var controls = deleteBtn.parentNode;
+ if (controls.className == 'comment-content') {
+ removeNode(deleteBtn);
+ var convertLinks = findChildrenByClassName(controls, 'convert-comment');
+ if (convertLinks.length) {
+ removeNode(convertLinks[0]);
+ }
+ var editLinks = findChildrenByClassName(controls, 'edit');
+ if (editLinks.length) {
+ removeNode(editLinks[0]);
+ }
+ } else {
+ var buttons = controls.childNodes;
+ var numButtons = buttons.length;
+ for (var i = numButtons - 1; i >= 0; i--) {
+ removeNode(buttons[i]);
+ }
+ }
+ };
+
+
function render_post_controls(post_id){
+
+ //in this case remove all post controls
+ if (askbot['settings']['readOnlyModeEnabled'] === true) {
+ remove_all_controls(post_id);
+ return;
+ }
+
if (data['userIsAdminOrMod']){
return;//all remaining functions stay on
}
@@ -244,12 +277,12 @@
add_answer_btn.className += ' answer-own-question';
add_answer_btn.setAttribute(
'value',
- '{% trans %}Answer Your Own Question{% endtrans %}'
+ '{{ settings.WORDS_ANSWER_YOUR_OWN_QUESTION|escapejs }}'
)
} else {
add_answer_btn.setAttribute(
'value',
- '{% trans %}Post Your Answer{% endtrans %}'
+ '{{ settings.WORDS_POST_YOUR_ANSWER|escapejs }}'
)
}
} else {
@@ -337,6 +370,9 @@
askbot['messages']['addComment'] = '{% trans %}add a comment{% endtrans %}';
askbot['messages']['userNamePrompt'] = '{% trans %}User name:{% endtrans %}';
askbot['messages']['userEmailPrompt'] = '{% trans %}Email address:{% endtrans %}';
+ {% if settings.READ_ONLY_MODE_ENABLED %}
+ askbot['messages']['readOnlyMessage'] = '{{ settings.READ_ONLY_MESSAGE }}';
+ {% endif %}
askbot['settings']['saveCommentOnEnter'] = {{ settings.SAVE_COMMENT_ON_ENTER|as_js_bool }};
askbot['settings']['tagSource'] = '{{ settings.TAG_SOURCE }}';
askbot['settings']['enableSharingGoogle'] = {{ settings.ENABLE_SHARING_GOOGLE|as_js_bool }};