diff options
-rwxr-xr-x | .gitignore | 1 | ||||
-rw-r--r-- | askbot/__init__.py | 2 | ||||
-rw-r--r-- | askbot/conf/__init__.py | 1 | ||||
-rw-r--r-- | askbot/conf/settings_wrapper.py | 8 | ||||
-rw-r--r-- | askbot/conf/site_modes.py | 85 | ||||
-rw-r--r-- | askbot/doc/source/changelog.rst | 11 | ||||
-rw-r--r-- | askbot/skins/default/media/style/style.css | 2 | ||||
-rw-r--r-- | askbot/skins/default/templates/question.html | 17 | ||||
-rw-r--r-- | askbot/skins/default/templates/users.html | 8 | ||||
-rw-r--r-- | askbot/views/writers.py | 11 |
10 files changed, 134 insertions, 12 deletions
@@ -1,6 +1,7 @@ *.pyc *.swp *.log +db cache/?? run *.wsgi diff --git a/askbot/__init__.py b/askbot/__init__.py index b4889f92..ef784c3b 100644 --- a/askbot/__init__.py +++ b/askbot/__init__.py @@ -9,7 +9,7 @@ import smtplib import sys import logging -VERSION = (0, 7, 24) +VERSION = (0, 7, 25) #necessary for interoperability of django and coffin try: diff --git a/askbot/conf/__init__.py b/askbot/conf/__init__.py index 1d2d7240..64fe41fb 100644 --- a/askbot/conf/__init__.py +++ b/askbot/conf/__init__.py @@ -19,6 +19,7 @@ import askbot.conf.markup import askbot.conf.social_sharing import askbot.conf.badges import askbot.conf.login_providers +import askbot.conf.site_modes #import main settings object from askbot.conf.settings_wrapper import settings diff --git a/askbot/conf/settings_wrapper.py b/askbot/conf/settings_wrapper.py index aac8f071..2e0d8db2 100644 --- a/askbot/conf/settings_wrapper.py +++ b/askbot/conf/settings_wrapper.py @@ -49,6 +49,14 @@ class ConfigSettings(object): """ return getattr(self.__instance, key).value + def get_default(self, key): + """return the defalut value for the setting""" + return getattr(self.__instance, key).default + + def reset(self, key): + """returns setting to the default value""" + self.update(key, self.get_default(key)) + def update(self, key, value): setting = config_get(self.__group_map[key], key) setting.update(value) diff --git a/askbot/conf/site_modes.py b/askbot/conf/site_modes.py new file mode 100644 index 00000000..e79169e7 --- /dev/null +++ b/askbot/conf/site_modes.py @@ -0,0 +1,85 @@ +""" +Site modes settings: + Support for site modes currently supports + Bootstrap - for sites that are starting and + Default - for sites that already have a momentum. +""" +from askbot.conf.settings_wrapper import settings +from askbot.deps.livesettings import ConfigurationGroup, BooleanValue +from django.utils.translation import ugettext as _ + +BOOTSTRAP_MODE_SETTINGS = { + #minimum reputation settins. + 'MIN_REP_TO_VOTE_UP': 5, + 'MIN_REP_TO_VOTE_DOWN': 50, + 'MIN_REP_TO_ANSWER_OWN_QUESTION': 5, + 'MIN_REP_TO_ACCEPT_OWN_ANSWER': 20, + 'MIN_REP_TO_FLAG_OFFENSIVE': 5, + 'MIN_REP_TO_LEAVE_COMMENTS': 10, + 'MIN_REP_TO_DELETE_OTHERS_COMMENTS': 200, + 'MIN_REP_TO_DELETE_OTHERS_POSTS': 500, + 'MIN_REP_TO_UPLOAD_FILES': 10, + 'MIN_REP_TO_CLOSE_OWN_QUESTIONS': 25, + 'MIN_REP_TO_RETAG_OTHERS_QUESTIONS': 50, + 'MIN_REP_TO_REOPEN_OWN_QUESTIONS': 50, + 'MIN_REP_TO_EDIT_WIKI': 75, + 'MIN_REP_TO_EDIT_OTHERS_POSTS': 200, + 'MIN_REP_TO_VIEW_OFFENSIVE_FLAGS': 200, + 'MIN_REP_TO_CLOSE_OTHERS_QUESTIONS': 200, + 'MIN_REP_TO_LOCK_POSTS': 400, + 'MIN_REP_TO_HAVE_STRONG_URL': 25, + #badge settings + 'NOTABLE_QUESTION_BADGE_MIN_VIEWS': 25, + 'POPULAR_QUESTION_BADGE_MIN_VIEWS': 15, + 'FAMOUS_QUESTION_BADGE_MIN_VIEWS': 50, + 'ENTHUSIAST_BADGE_MIN_DAYS': 5, + 'TAXONOMIST_BADGE_MIN_USE_COUNT': 5, + #moderation rule settings + 'MIN_FLAGS_TO_HIDE_POST': 2, + 'MIN_FLAGS_TO_DELETE_POST': 3, +} + +def bootstrap_callback(current_value, new_value): + '''Callback to update settings''' + + if current_value == new_value: + #do not overwrite settings in case that tha value + #is the same + return new_value + + if new_value == True: + for key, value in BOOTSTRAP_MODE_SETTINGS.items(): + settings.update(key, value) + + else: + for key in BOOTSTRAP_MODE_SETTINGS: + settings.reset(key) + + return new_value + + +SITE_MODES = ConfigurationGroup( + 'SITE_MODES', + _('Site modes'), + ) + +settings.register( + BooleanValue( + SITE_MODES, + 'ACTIVATE_BOOTSTRAP_MODE', + default=False, + description=_( + 'Activate a "Bootstrap" mode'), + help_text=_( + "Bootstrap mode lowers reputation and certain badge " + "thresholds, to values, more suitable " + "for the smaller communities, " + "<strong>WARNING:</strong> your current value for " + "Minimum reputation, " + "Bagde Settings and " + "Vote Rules will " + "be changed after you modify this setting." + ), + update_callback = bootstrap_callback + ) +) diff --git a/askbot/doc/source/changelog.rst b/askbot/doc/source/changelog.rst index 77ff4a45..d58b415f 100644 --- a/askbot/doc/source/changelog.rst +++ b/askbot/doc/source/changelog.rst @@ -1,12 +1,15 @@ Changes in Askbot ================= -Development version (Not yet released) --------------------------------------- +0.7.25 (Current Version) +------------------------ * RSS feed for individual question (Sayan Chowdhury) +* Allow pre-population of tags via ask a questions link (Adolfo) +* Make answering own question one click harder (Adolfo) +* Bootstrap mode (Adolfo, Evgeny) -0.7.24 (Current Version) ------------------------- +0.7.24 +------ * Made it possible to disable the anonymous user greeting alltogether (Raghu Udiyar) * Added annotations for the meanings of user levels on the "moderation" page. (Jishnu) * Auto-link patterns - e.g. to bug databases - are configurable from settings. (Arun SAG) diff --git a/askbot/skins/default/media/style/style.css b/askbot/skins/default/media/style/style.css index 46bf0321..8e757d14 100644 --- a/askbot/skins/default/media/style/style.css +++ b/askbot/skins/default/media/style/style.css @@ -1089,8 +1089,6 @@ a:hover.medal { border-right: 1px solid #D1CA3D; } - - .questions-related { font-weight: 700; word-wrap: break-word; diff --git a/askbot/skins/default/templates/question.html b/askbot/skins/default/templates/question.html index 91287bdb..ae003ef4 100644 --- a/askbot/skins/default/templates/question.html +++ b/askbot/skins/default/templates/question.html @@ -305,7 +305,12 @@ <a href="mailto:?subject={{ settings.APP_SHORT_NAME|urlencode }}&body={{ question_url }}">{% trans %}email{% endtrans %}</a>. </h2> {% endif %} -<form id="fmanswer" action="{% url answer question.id %}" method="post">{% csrf_token %} +<form + id="fmanswer" + {% if user == question.author %}style="display:none"{% endif %} + action="{% url answer question.id %}" + method="post" +>{% csrf_token %} {% if request.user.is_authenticated() %} <p style="padding-left:3px"> {{ answer.email_notify }} @@ -380,6 +385,9 @@ {% endif %} {% endif %} </form> + {% if request.user == question.author %} + <input type="button" class="submit after-editor" id="fmanswer_button" value="{% trans %}Answer Your Own Question{% endtrans %}"/> + {%endif%} {% endblock %} {% block sidebar %} @@ -535,6 +543,13 @@ $('#fmanswer textarea').focus(); } {% if settings.ENABLE_SHARING_GOOGLE %}$.getScript("http://apis.google.com/js/plusone.js"){% endif %} + + {% if request.user == question.author %} + $("#fmanswer_button").click(function() { + $("#fmanswer").show(); + $("#fmanswer_button").hide(); + }); + {%endif%} }); function initEditor(){ diff --git a/askbot/skins/default/templates/users.html b/askbot/skins/default/templates/users.html index 750b3abb..1d7d02dd 100644 --- a/askbot/skins/default/templates/users.html +++ b/askbot/skins/default/templates/users.html @@ -10,25 +10,25 @@ id="sort_reputation" href="{% url users %}?sort=reputation" {% if tab_id == 'reputation' %}class="on"{% endif %} - title="{% trans %}reputation{% endtrans %}" + title="{% trans %}see people with the highest reputation{% endtrans %}" ><span>{% trans %}reputation{% endtrans %}</span></a> <a id="sort_newest" href="{% url users %}?sort=newest" {% if tab_id == 'newest' %}class="on"{% endif %} - class="off" title="{% trans %}recent{% endtrans %}" + class="off" title="{% trans %}see people who joined most recently{% endtrans %}" ><span>{% trans %}recent{% endtrans %}</span></a> <a id="sort_last" href="{% url users %}?sort=last" {% if tab_id == 'last' %}class="on"{% endif %} - class="off" title="{% trans %}oldest{% endtrans %}" + class="off" title="{% trans %}see people who joined the site first{% endtrans %}" ><span>{% trans %}oldest{% endtrans %}<span></a> <a id="sort_user" href="{% url users %}?sort=user" {% if tab_id == 'user' %}class="on"{% endif %} - title="{% trans %}by username{% endtrans %}" + title="{% trans %}see people sorted by name{% endtrans %}" ><span>{% trans %}by username{% endtrans %}</span></a> </div> </div> diff --git a/askbot/views/writers.py b/askbot/views/writers.py index d64c9c02..8b07681a 100644 --- a/askbot/views/writers.py +++ b/askbot/views/writers.py @@ -267,6 +267,17 @@ def ask(request):#view used to ask a new question query = search_state.query form.initial['title'] = query + if 'tags' in request.GET: + #pre-populate tags. + clean_tags = request.GET['tags'].replace(',', ' ') + form.initial['tags'] = clean_tags + else: + #attemp to get tags from search state + search_state = request.session.get('search_state', None) + if search_state.tags: + tags = ' '.join(search_state.tags) + form.initial['tags'] = tags + data = { 'active_tab': 'ask', 'page_class': 'ask-page', |