diff options
author | NoahY <yuttadhammo@yahoo.com> | 2011-07-29 13:20:55 +0530 |
---|---|---|
committer | NoahY <yuttadhammo@yahoo.com> | 2011-07-29 13:20:55 +0530 |
commit | e7c418296189bbb9d57f7450de61459d3af7b412 (patch) | |
tree | e888a328557387405d7de794228cd4584baebbc2 | |
parent | 8d1fef9afaac61122056f791a74f16a91618b29d (diff) | |
download | askbot-e7c418296189bbb9d57f7450de61459d3af7b412.tar.gz askbot-e7c418296189bbb9d57f7450de61459d3af7b412.tar.bz2 askbot-e7c418296189bbb9d57f7450de61459d3af7b412.zip |
sidebar settings for each view
-rw-r--r-- | askbot/conf/sidebar_main.py (renamed from askbot/conf/sidebar_settings.py) | 29 | ||||
-rw-r--r-- | askbot/conf/sidebar_profile.py | 45 | ||||
-rw-r--r-- | askbot/conf/sidebar_question.py | 85 | ||||
-rw-r--r-- | askbot/skins/default/templates/question.html | 54 |
4 files changed, 177 insertions, 36 deletions
diff --git a/askbot/conf/sidebar_settings.py b/askbot/conf/sidebar_main.py index db4b79a9..012d8ace 100644 --- a/askbot/conf/sidebar_settings.py +++ b/askbot/conf/sidebar_main.py @@ -5,19 +5,16 @@ from askbot.conf.settings_wrapper import settings from askbot.deps.livesettings import ConfigurationGroup from askbot.deps.livesettings import values from django.utils.translation import ugettext as _ -from django.conf import settings as django_settings -from askbot.skins import utils as skin_utils -from askbot import const -SIDEBAR_SETTINGS = ConfigurationGroup( - 'SIDEBAR_SETTINGS', - _('Sidebar Widget settings'), +SIDEBAR_MAIN = ConfigurationGroup( + 'SIDEBAR_MAIN', + _('Sidebar widget settings - main page'), ) settings.register( values.LongStringValue( - SIDEBAR_SETTINGS, - 'SIDEBAR_HEADER', + SIDEBAR_MAIN, + 'SIDEBAR_MAIN_HEADER', description = _('Custom sidebar header'), default = '', help_text = _( @@ -32,8 +29,8 @@ settings.register( settings.register( values.BooleanValue( - SIDEBAR_SETTINGS, - 'SIDEBAR_SHOW_AVATARS', + SIDEBAR_MAIN, + 'SIDEBAR_MAIN_SHOW_AVATARS', description = _('Show avatar block in sidebar'), help_text = _( 'Uncheck this if you want to hide the avatar ' @@ -45,8 +42,8 @@ settings.register( settings.register( values.BooleanValue( - SIDEBAR_SETTINGS, - 'SIDEBAR_SHOW_TAG_SELECTOR', + SIDEBAR_MAIN, + 'SIDEBAR_MAIN_SHOW_TAG_SELECTOR', description = _('Show tag selector in sidebar'), help_text = _( 'Uncheck this if you want to hide the options ' @@ -58,8 +55,8 @@ settings.register( settings.register( values.BooleanValue( - SIDEBAR_SETTINGS, - 'SIDEBAR_SHOW_TAGS', + SIDEBAR_MAIN, + 'SIDEBAR_MAIN_SHOW_TAGS', description = _('Show tag list/cloud in sidebar'), help_text = _( 'Uncheck this if you want to hide the tag ' @@ -71,8 +68,8 @@ settings.register( settings.register( values.LongStringValue( - SIDEBAR_SETTINGS, - 'SIDEBAR_FOOTER', + SIDEBAR_MAIN, + 'SIDEBAR_MAIN_FOOTER', description = _('Custom sidebar footer'), default = '', help_text = _( diff --git a/askbot/conf/sidebar_profile.py b/askbot/conf/sidebar_profile.py new file mode 100644 index 00000000..7c6b1a57 --- /dev/null +++ b/askbot/conf/sidebar_profile.py @@ -0,0 +1,45 @@ +""" +Sidebar settings +""" +from askbot.conf.settings_wrapper import settings +from askbot.deps.livesettings import ConfigurationGroup +from askbot.deps.livesettings import values +from django.utils.translation import ugettext as _ + +SIDEBAR_PROFILE = ConfigurationGroup( + 'SIDEBAR_PROFILE', + _('Sidebar widget settings - profile page'), + ) + +settings.register( + values.LongStringValue( + SIDEBAR_PROFILE, + 'SIDEBAR_PROFILE_HEADER', + description = _('Custom sidebar header'), + default = '', + help_text = _( + 'Use this area to enter content at the TOP of the sidebar' + 'in HTML format. When using this option ' + '(as well as the sidebar footer), please ' + 'use the HTML validation service to make sure that ' + 'your input is valid and works well in all browsers.' + ) + ) +) + +settings.register( + values.LongStringValue( + SIDEBAR_PROFILE, + 'SIDEBAR_PROFILE_FOOTER', + description = _('Custom sidebar footer'), + default = '', + help_text = _( + 'Use this area to enter content at the BOTTOM of the sidebar' + 'in HTML format. When using this option ' + '(as well as the sidebar header), please ' + 'use the HTML validation service to make sure that ' + 'your input is valid and works well in all browsers.' + ) + ) +) + diff --git a/askbot/conf/sidebar_question.py b/askbot/conf/sidebar_question.py new file mode 100644 index 00000000..93bd5349 --- /dev/null +++ b/askbot/conf/sidebar_question.py @@ -0,0 +1,85 @@ +""" +Sidebar settings +""" +from askbot.conf.settings_wrapper import settings +from askbot.deps.livesettings import ConfigurationGroup +from askbot.deps.livesettings import values +from django.utils.translation import ugettext as _ + +SIDEBAR_QUESTION = ConfigurationGroup( + 'SIDEBAR_QUESTION', + _('Sidebar widget settings - question page'), + ) + +settings.register( + values.LongStringValue( + SIDEBAR_QUESTION, + 'SIDEBAR_QUESTION_HEADER', + description = _('Custom sidebar header'), + default = '', + help_text = _( + 'Use this area to enter content at the TOP of the sidebar' + 'in HTML format. When using this option ' + '(as well as the sidebar footer), please ' + 'use the HTML validation service to make sure that ' + 'your input is valid and works well in all browsers.' + ) + ) +) + +settings.register( + values.BooleanValue( + SIDEBAR_QUESTION, + 'SIDEBAR_QUESTION_SHOW_TAGS', + description = _('Show tag list in sidebar'), + help_text = _( + 'Uncheck this if you want to hide the tag ' + 'list from the sidebar ' + ), + default = True + ) +) + +settings.register( + values.BooleanValue( + SIDEBAR_QUESTION, + 'SIDEBAR_QUESTION_SHOW_META', + description = _('Show meta information in sidebar'), + help_text = _( + 'Uncheck this if you want to hide the meta ' + 'information about the question (post date, ' + 'views, last updated). ' + ), + default = True + ) +) + +settings.register( + values.BooleanValue( + SIDEBAR_QUESTION, + 'SIDEBAR_QUESTION_SHOW_RELATED', + description = _('Show related questions in sidebar'), + help_text = _( + 'Uncheck this if you want to hide the list ' + 'of related questions. ' + ), + default = True + ) +) + +settings.register( + values.LongStringValue( + SIDEBAR_QUESTION, + 'SIDEBAR_QUESTION_FOOTER', + description = _('Custom sidebar footer'), + default = '', + help_text = _( + 'Use this area to enter content at the BOTTOM of the sidebar' + 'in HTML format. When using this option ' + '(as well as the sidebar header), please ' + 'use the HTML validation service to make sure that ' + 'your input is valid and works well in all browsers.' + ) + ) +) + diff --git a/askbot/skins/default/templates/question.html b/askbot/skins/default/templates/question.html index 0d304cd2..a5a04f09 100644 --- a/askbot/skins/default/templates/question.html +++ b/askbot/skins/default/templates/question.html @@ -401,25 +401,35 @@ {% endblock %} {% block sidebar %} -{% cache 0 "questions_tags" questions_tags question.id language_code %} + +{{ settings.SIDEBAR_QUESTION_HEADER }} + +{% if settings.SIDEBAR_QUESTION_SHOW_TAGS %} + {% cache 0 "questions_tags" questions_tags question.id language_code %} + <div class="boxC"> + <p> + {% trans %}Question tags{% endtrans %}: + </p> + <ul id="related-tags" class="tags"> + {% for tag in tags %} + <li> + {{ macros.tag_widget( + tag, + html_tag = 'div', + url_params = 'start_over=true', + extra_content = '<span class="tag-number">× ' ~ + tag.used_count|intcomma ~ '</span>' + ) + }} + </li> + {% endfor %} + </ul> + </div> + {% endcache %} +{% endif %} + +{% if settings.SIDEBAR_QUESTION_SHOW_META %} <div class="boxC"> - <p> - {% trans %}Question tags{% endtrans %}: - </p> - <ul id="related-tags" class="tags"> - {% for tag in tags %} - <li> - {{ macros.tag_widget( - tag, - html_tag = 'div', - url_params = 'start_over=true', - extra_content = '<span class="tag-number">× ' ~ - tag.used_count|intcomma ~ '</span>' - ) - }} - </li> - {% endfor %} - </ul> <p style="clear:left"> {% trans %}question asked{% endtrans %}: <strong title="{{ question.added_at }}">{{question.added_at|diff_date}}</strong> </p> @@ -430,8 +440,9 @@ {% trans %}last updated{% endtrans %}: <strong title="{{ question.last_activity_at }}">{{question.last_activity_at|diff_date}}</strong> </p> </div> -{% endcache %} -{% if similar_questions.data %} +{% endif %} + +{% if similar_questions.data and settings.SIDEBAR_QUESTION_SHOW_RELATED %} {% cache 1800 "related_questions" related_questions question.id language_code %} <div class="boxC"> <h2>{% trans %}Related questions{% endtrans %}</h2> @@ -445,6 +456,9 @@ </div> {% endcache %} {% endif %} + +{{ settings.SIDEBAR_QUESTION_FOOTER }} + {% endblock %} {% block endjs %} {% if not question.closed %} |