diff options
26 files changed, 133 insertions, 42 deletions
diff --git a/askbot/conf/badges.py b/askbot/conf/badges.py index b113af2e..53292b05 100644 --- a/askbot/conf/badges.py +++ b/askbot/conf/badges.py @@ -4,13 +4,15 @@ user in response to various actions by the same users or others """ from askbot.conf.settings_wrapper import settings +from askbot.conf.super_groups import REP_AND_BADGES from askbot.deps.livesettings import ConfigurationGroup, IntegerValue from django.utils.translation import ugettext as _ BADGES = ConfigurationGroup( 'BADGES', _('Badge settings'), - ordering=2 + ordering=2, + super_group = REP_AND_BADGES ) settings.register( diff --git a/askbot/conf/email.py b/askbot/conf/email.py index 5402cad0..195c14ee 100644 --- a/askbot/conf/email.py +++ b/askbot/conf/email.py @@ -2,6 +2,7 @@ Email related settings """ from askbot.conf.settings_wrapper import settings +from askbot.conf.super_groups import LOGIN_USERS_COMMUNICATION from askbot.deps import livesettings from askbot import const from django.utils.translation import ugettext as _ @@ -12,6 +13,7 @@ EMAIL_SUBJECT_PREFIX = getattr(django_settings, 'EMAIL_SUBJECT_PREFIX', '') EMAIL = livesettings.ConfigurationGroup( 'EMAIL', _('Email and email alert settings'), + super_group = LOGIN_USERS_COMMUNICATION ) settings.register( diff --git a/askbot/conf/external_keys.py b/askbot/conf/external_keys.py index 8912b0ff..a673534a 100644 --- a/askbot/conf/external_keys.py +++ b/askbot/conf/external_keys.py @@ -1,14 +1,15 @@ """External service key settings""" from askbot import const from askbot.conf.settings_wrapper import settings +from askbot.conf.super_groups import EXTERNAL_SERVICES from askbot.deps import livesettings from django.utils.translation import ugettext as _ from django.conf import settings as django_settings EXTERNAL_KEYS = livesettings.ConfigurationGroup( 'EXTERNAL_KEYS', - _('Keys to connect the site with external ' - 'services like Facebook, etc.') + _('Keys for external services'), + super_group = EXTERNAL_SERVICES ) settings.register( diff --git a/askbot/conf/flatpages.py b/askbot/conf/flatpages.py index 3237b45d..62413797 100644 --- a/askbot/conf/flatpages.py +++ b/askbot/conf/flatpages.py @@ -3,11 +3,13 @@ Q&A forum flatpages (about, etc.) """ from askbot.conf.settings_wrapper import settings from askbot.deps.livesettings import ConfigurationGroup, LongStringValue +from askbot.conf.super_groups import CONTENT_AND_UI from django.utils.translation import ugettext as _ FLATPAGES = ConfigurationGroup( 'FLATPAGES', - _('Flatpages - about, privacy policy, etc.') + _('Flatpages - about, privacy policy, etc.'), + super_group = CONTENT_AND_UI ) settings.register( diff --git a/askbot/conf/forum_data_rules.py b/askbot/conf/forum_data_rules.py index 4a07f3be..80af2f5b 100644 --- a/askbot/conf/forum_data_rules.py +++ b/askbot/conf/forum_data_rules.py @@ -3,12 +3,14 @@ Settings for askbot data display and entry """ from askbot.conf.settings_wrapper import settings from askbot.deps import livesettings -from django.utils.translation import ugettext as _ from askbot import const +from askbot.conf.super_groups import DATA_AND_FORMATTING +from django.utils.translation import ugettext as _ FORUM_DATA_RULES = livesettings.ConfigurationGroup( 'FORUM_DATA_RULES', - _('Data entry and display') + _('Data entry and display rules'), + super_group = DATA_AND_FORMATTING ) settings.register( diff --git a/askbot/conf/license.py b/askbot/conf/license.py index 73001c2d..20a2743f 100644 --- a/askbot/conf/license.py +++ b/askbot/conf/license.py @@ -2,6 +2,7 @@ clause used in askbot instances""" from askbot import const from askbot.conf.settings_wrapper import settings +from askbot.conf.super_groups import CONTENT_AND_UI from askbot.deps import livesettings from askbot.skins import utils as skin_utils from django.utils.translation import ugettext as _ @@ -9,7 +10,8 @@ from django.conf import settings as django_settings LICENSE_SETTINGS = livesettings.ConfigurationGroup( 'LICENSE_SETTINGS', - _('License settings') + _('Content LicensContent License'), + super_group = CONTENT_AND_UI ) settings.register( diff --git a/askbot/conf/login_providers.py b/askbot/conf/login_providers.py index a97baa9d..0cc20a9a 100644 --- a/askbot/conf/login_providers.py +++ b/askbot/conf/login_providers.py @@ -2,6 +2,7 @@ External service key settings """ from askbot.conf.settings_wrapper import settings +from askbot.conf.super_groups import LOGIN_USERS_COMMUNICATION from askbot.deps import livesettings from django.utils.translation import ugettext as _ from django.conf import settings as django_settings @@ -9,7 +10,8 @@ from askbot.skins import utils as skin_utils LOGIN_PROVIDERS = livesettings.ConfigurationGroup( 'LOGIN_PROVIDERS', - _('Login provider setings') + _('Login provider setings'), + super_group = LOGIN_USERS_COMMUNICATION ) settings.register( diff --git a/askbot/conf/markup.py b/askbot/conf/markup.py index e4202f05..09ce4543 100644 --- a/askbot/conf/markup.py +++ b/askbot/conf/markup.py @@ -3,15 +3,17 @@ Settings that modify processing of user text input """ from askbot.conf.settings_wrapper import settings +from askbot.conf.super_groups import DATA_AND_FORMATTING from askbot.deps.livesettings import ConfigurationGroup from askbot.deps.livesettings import BooleanValue, StringValue, LongStringValue -from django.utils.translation import ugettext as _ from askbot import const +from django.utils.translation import ugettext as _ import re MARKUP = ConfigurationGroup( 'MARKUP', - _('Markup formatting') + _('Markup in posts'), + super_group = DATA_AND_FORMATTING ) def regex_settings_validation(*args): diff --git a/askbot/conf/minimum_reputation.py b/askbot/conf/minimum_reputation.py index 4d181e48..d184be0b 100644 --- a/askbot/conf/minimum_reputation.py +++ b/askbot/conf/minimum_reputation.py @@ -3,13 +3,15 @@ Settings for minimum reputation required for a variety of actions on the askbot askbot """ from askbot.conf.settings_wrapper import settings +from askbot.conf.super_groups import REP_AND_BADGES from askbot.deps import livesettings from django.utils.translation import ugettext as _ MIN_REP = livesettings.ConfigurationGroup( 'MIN_REP', - _('Minimum reputation required to perform actions'), - ordering=0 + _('Karma thresholds'), + ordering=0, + super_group = REP_AND_BADGES ) settings.register( diff --git a/askbot/conf/reputation_changes.py b/askbot/conf/reputation_changes.py index 3ea7c4c0..40475a8b 100644 --- a/askbot/conf/reputation_changes.py +++ b/askbot/conf/reputation_changes.py @@ -6,10 +6,12 @@ users or others from askbot.conf.settings_wrapper import settings from askbot.deps.livesettings import ConfigurationGroup, IntegerValue from django.utils.translation import ugettext as _ +from askbot.conf.super_groups import REP_AND_BADGES REP_CHANGES = ConfigurationGroup( 'REP_CHANGES', - _('Reputation loss and gain rules'), + _('Karma loss and gain rules'), + super_group = REP_AND_BADGES, ordering=2 ) diff --git a/askbot/conf/sidebar_main.py b/askbot/conf/sidebar_main.py index 57f9848d..a45fdc3c 100644 --- a/askbot/conf/sidebar_main.py +++ b/askbot/conf/sidebar_main.py @@ -5,10 +5,12 @@ 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 askbot.conf.super_groups import CONTENT_AND_UI SIDEBAR_MAIN = ConfigurationGroup( 'SIDEBAR_MAIN', - _('Sidebar widget settings - main page'), + _('Main page sidebar'), + super_group = CONTENT_AND_UI ) settings.register( diff --git a/askbot/conf/sidebar_profile.py b/askbot/conf/sidebar_profile.py index 7c6b1a57..e635629a 100644 --- a/askbot/conf/sidebar_profile.py +++ b/askbot/conf/sidebar_profile.py @@ -5,10 +5,12 @@ 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 askbot.conf.super_groups import CONTENT_AND_UI SIDEBAR_PROFILE = ConfigurationGroup( 'SIDEBAR_PROFILE', - _('Sidebar widget settings - profile page'), + _('User profile sidebar'), + super_group = CONTENT_AND_UI ) settings.register( diff --git a/askbot/conf/sidebar_question.py b/askbot/conf/sidebar_question.py index 93bd5349..4416823d 100644 --- a/askbot/conf/sidebar_question.py +++ b/askbot/conf/sidebar_question.py @@ -5,10 +5,11 @@ 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 askbot.conf.super_groups import CONTENT_AND_UI SIDEBAR_QUESTION = ConfigurationGroup( 'SIDEBAR_QUESTION', - _('Sidebar widget settings - question page'), + _('Question page sidebar'), + super_group = CONTENT_AND_UI ) settings.register( diff --git a/askbot/conf/site_modes.py b/askbot/conf/site_modes.py index e79169e7..a88103b4 100644 --- a/askbot/conf/site_modes.py +++ b/askbot/conf/site_modes.py @@ -5,6 +5,7 @@ Site modes settings: Default - for sites that already have a momentum. """ from askbot.conf.settings_wrapper import settings +from askbot.conf.super_groups import REP_AND_BADGES from askbot.deps.livesettings import ConfigurationGroup, BooleanValue from django.utils.translation import ugettext as _ @@ -60,7 +61,8 @@ def bootstrap_callback(current_value, new_value): SITE_MODES = ConfigurationGroup( 'SITE_MODES', - _('Site modes'), + _('Bootstrap mode'), + super_group = REP_AND_BADGES ) settings.register( diff --git a/askbot/conf/site_settings.py b/askbot/conf/site_settings.py index e1f54d39..8cd73b3d 100644 --- a/askbot/conf/site_settings.py +++ b/askbot/conf/site_settings.py @@ -3,12 +3,14 @@ Q&A website settings - title, desctiption, basic urls keywords """ from askbot.conf.settings_wrapper import settings +from askbot.conf.super_groups import CONTENT_AND_UI from askbot.deps import livesettings from django.utils.translation import ugettext as _ QA_SITE_SETTINGS = livesettings.ConfigurationGroup( 'QA_SITE_SETTINGS', - _('Q&A forum website parameters and urls') + _('URLS, keywords & greetings'), + super_group = CONTENT_AND_UI ) settings.register( diff --git a/askbot/conf/skin_general_settings.py b/askbot/conf/skin_general_settings.py index 8521bf87..ad439060 100644 --- a/askbot/conf/skin_general_settings.py +++ b/askbot/conf/skin_general_settings.py @@ -8,10 +8,12 @@ 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 +from askbot.conf.super_groups import CONTENT_AND_UI GENERAL_SKIN_SETTINGS = ConfigurationGroup( 'GENERAL_SKIN_SETTINGS', - _('Skin and User Interface settings'), + _('Logos and HTML <head> parts'), + super_group = CONTENT_AND_UI ) settings.register( diff --git a/askbot/conf/social_sharing.py b/askbot/conf/social_sharing.py index db01fb49..9a0f8ad4 100644 --- a/askbot/conf/social_sharing.py +++ b/askbot/conf/social_sharing.py @@ -2,12 +2,14 @@ Social sharing settings """ from askbot.conf.settings_wrapper import settings +from askbot.conf.super_groups import EXTERNAL_SERVICES from askbot.deps.livesettings import ConfigurationGroup, BooleanValue from django.utils.translation import ugettext as _ SOCIAL_SHARING = ConfigurationGroup( 'SOCIAL_SHARING', _('Sharing content on social networks'), + super_group = EXTERNAL_SERVICES ) settings.register( diff --git a/askbot/conf/spam_and_moderation.py b/askbot/conf/spam_and_moderation.py index 375fbdd5..e841ebf7 100644 --- a/askbot/conf/spam_and_moderation.py +++ b/askbot/conf/spam_and_moderation.py @@ -3,10 +3,12 @@ from django.utils.translation import ugettext as _ from askbot import const from askbot.deps import livesettings from askbot.conf.settings_wrapper import settings +from askbot.conf.super_groups import EXTERNAL_SERVICES SPAM_AND_MODERATION = livesettings.ConfigurationGroup( 'SPAM_AND_MODERATION', - _('Spam control and content moderation') + _('Akismet spam protection'), + super_group = EXTERNAL_SERVICES ) settings.register( diff --git a/askbot/conf/super_groups.py b/askbot/conf/super_groups.py new file mode 100644 index 00000000..19b8c20a --- /dev/null +++ b/askbot/conf/super_groups.py @@ -0,0 +1,14 @@ +from django.utils.translation import ugettext as _ +from askbot.deps.livesettings import SuperGroup +from askbot.deps.livesettings import config_register_super_group + +REP_AND_BADGES = SuperGroup(_('Reputation, Badges, Votes & Flags')) +CONTENT_AND_UI = SuperGroup(_('Static Content, URLS & UI')) +DATA_AND_FORMATTING = SuperGroup(_('Data rules & Formatting')) +EXTERNAL_SERVICES = SuperGroup(_('External Services')) +LOGIN_USERS_COMMUNICATION = SuperGroup(_('Login, Users & Communication')) +config_register_super_group(REP_AND_BADGES) +config_register_super_group (LOGIN_USERS_COMMUNICATION) +config_register_super_group(DATA_AND_FORMATTING) +config_register_super_group(EXTERNAL_SERVICES) +config_register_super_group(CONTENT_AND_UI) diff --git a/askbot/conf/user_settings.py b/askbot/conf/user_settings.py index 10de5d95..1fdfb42f 100644 --- a/askbot/conf/user_settings.py +++ b/askbot/conf/user_settings.py @@ -2,13 +2,15 @@ User policy settings """ from askbot.conf.settings_wrapper import settings +from askbot.conf.super_groups import LOGIN_USERS_COMMUNICATION from askbot.deps import livesettings from django.utils.translation import ugettext as _ from askbot import const USER_SETTINGS = livesettings.ConfigurationGroup( 'USER_SETTINGS', - _('User settings') + _('User settings'), + super_group = LOGIN_USERS_COMMUNICATION ) settings.register( diff --git a/askbot/conf/vote_rules.py b/askbot/conf/vote_rules.py index 211177e6..5d275708 100644 --- a/askbot/conf/vote_rules.py +++ b/askbot/conf/vote_rules.py @@ -5,13 +5,15 @@ and offensive flags. For example number of times a person can vote each day, etc. """ from askbot.conf.settings_wrapper import settings +from askbot.conf.super_groups import REP_AND_BADGES from askbot.deps.livesettings import ConfigurationGroup, IntegerValue from django.utils.translation import ugettext as _ VOTE_RULES = ConfigurationGroup( 'VOTE_RULES', - _('Limits applicable to votes and moderation flags'), - ordering=1, + _('Vote and flag limits'), + ordering = 1, + super_group = REP_AND_BADGES ) settings.register( diff --git a/askbot/deps/livesettings/functions.py b/askbot/deps/livesettings/functions.py index 99e5cc87..7517cb9f 100644 --- a/askbot/deps/livesettings/functions.py +++ b/askbot/deps/livesettings/functions.py @@ -15,6 +15,7 @@ class ConfigurationSettings(object): class __impl(object): def __init__(self): self.settings = values.SortedDotDict() + self.super_groups = list() self.prereg = {} def __getitem__(self, key): @@ -74,6 +75,10 @@ class ConfigurationSettings(object): """Return ordered list""" return self.settings.values() + def get_super_groups(self): + """Return ordered list of super groups""" + return self.super_groups + def has_config(self, group, key): if isinstance(group, values.ConfigurationGroup): group = group.key @@ -92,6 +97,11 @@ class ConfigurationSettings(object): else: self.prereg[k] = [choice] + def register_super_group(self, super_group): + """Registers the super group""" + if super_group not in self.super_groups: + self.super_groups.append(super_group) + def register(self, value): g = value.group if not isinstance(g, values.ConfigurationGroup): @@ -194,6 +204,9 @@ def config_register(value): """ return ConfigurationSettings().register(value) +def config_register_super_group(super_group): + return ConfigurationSettings().register_super_group(super_group) + def config_register_list(*args): for value in args: config_register(value) diff --git a/askbot/deps/livesettings/templates/livesettings/group_settings.html b/askbot/deps/livesettings/templates/livesettings/group_settings.html index 0c326cc6..8c13a48d 100644 --- a/askbot/deps/livesettings/templates/livesettings/group_settings.html +++ b/askbot/deps/livesettings/templates/livesettings/group_settings.html @@ -62,20 +62,24 @@ <p>{% trans "You don't have permission to edit values." %}</p> {% endif %} </div> -{% if all_groups %} -<div id="content-related"> - <div class="module"> - <h2>{% trans "Setting groups" %}</h2> - <ul> - {% for g in all_groups %} - {% ifequal g.key group.key %} - <li><b>{{g.name}}</b></li> - {% else %} - <li><a href="{% url group_settings g.key %}">{{g.name}}</a></li> - {% endifequal %} - {% endfor %} - </ul> +{% if all_super_groups %} + <div id="content-related"> + {% for super_group in all_super_groups %} + <div class="module"> + <h2>{{ super_group.name }}</h2> + <ul> + {% for g in super_group.groups %} + {% if g.keys|length %} + {% ifequal g.key group.key %} + <li><b>{{g.name}}</b></li> + {% else %} + <li><a href="{% url group_settings g.key %}">{{g.name}}</a></li> + {% endifequal %} + {% endif %} + {% endfor %} + </ul> + </div> + {% endfor %} </div> -</div> {% endif %} {% endblock %} diff --git a/askbot/deps/livesettings/values.py b/askbot/deps/livesettings/values.py index 6372e656..9587a16d 100644 --- a/askbot/deps/livesettings/values.py +++ b/askbot/deps/livesettings/values.py @@ -19,9 +19,10 @@ import logging import signals import os -__all__ = ['BASE_GROUP', 'ConfigurationGroup', 'Value', 'BooleanValue', 'DecimalValue', 'DurationValue', +__all__ = ['BASE_GROUP', 'BASE_SUPER_GROUP', 'ConfigurationGroup', 'Value', 'BooleanValue', + 'DecimalValue', 'DurationValue', 'FloatValue', 'IntegerValue', 'ModuleValue', 'PercentValue', 'PositiveIntegerValue', 'SortedDotDict', - 'StringValue', 'ImageValue', 'LongStringValue', 'MultipleStringValue', 'URLValue'] + 'StringValue', 'SuperGroup', 'ImageValue', 'LongStringValue', 'MultipleStringValue', 'URLValue'] _WARN = {} @@ -48,6 +49,24 @@ class SortedDotDict(SortedDict): vals.sort() return vals +class SuperGroup(object): + """Aggregates ConfigurationGroup's into super-groups + that are used only for the presentation in the UI""" + def __init__(self, name, ordering = 0): + self.name = name + self.ordering = ordering + self.groups = list() + + def append(self, group): + """adds instance of :class:`ConfigurationGroup` + to the super group + """ + if group not in self.groups: + self.groups.append(group) + + +BASE_SUPER_GROUP = SuperGroup(_('Main')) + class ConfigurationGroup(SortedDotDict): """A simple wrapper for a group of configuration values""" def __init__(self, key, name, *args, **kwargs): @@ -66,6 +85,8 @@ class ConfigurationGroup(SortedDotDict): self.name = name self.ordering = kwargs.pop('ordering', 1) self.requires = kwargs.pop('requires', None) + self.super_group = kwargs.pop('super_group', BASE_SUPER_GROUP) + self.super_group.append(self) if self.requires: reqval = kwargs.pop('requiresvalue', key) if not is_list_or_tuple(reqval): diff --git a/askbot/deps/livesettings/views.py b/askbot/deps/livesettings/views.py index 0c1bcfd8..918c6602 100644 --- a/askbot/deps/livesettings/views.py +++ b/askbot/deps/livesettings/views.py @@ -13,7 +13,7 @@ log = logging.getLogger('configuration.views') def group_settings(request, group, template='livesettings/group_settings.html'): # Determine what set of settings this editor is used for - + use_db, overrides = get_overrides(); mgr = ConfigurationSettings() @@ -56,7 +56,7 @@ def group_settings(request, group, template='livesettings/group_settings.html'): form = None return render_to_response(template, { - 'all_groups': mgr.groups(), + 'all_super_groups': mgr.get_super_groups(), 'title': title, 'group' : settings, 'form': form, diff --git a/askbot/doc/source/changelog.rst b/askbot/doc/source/changelog.rst index de788e76..b22839e0 100644 --- a/askbot/doc/source/changelog.rst +++ b/askbot/doc/source/changelog.rst @@ -4,6 +4,7 @@ Changes in Askbot Development version (not yet published) --------------------------------------- * Show unused vote count (Tomasz Zielinski) +* Categorized live settings (Evgeny) 0.7.26 (Current Version) ------------------------ |