from about import *
from faq import *
from form import *
+from view import *
from moderation import *
from users import *
from static import *
FORM_GRAVATAR_IN_COMMENTS = Setting('FORM_GRAVATAR_IN_COMMENTS', False, FORUM_SET, dict(
label = _("Show author gravatar in comments"),
help_text = _("Show the gravatar image of a comment author."),
-required=False))
\ No newline at end of file
+required=False))
+
+
+
--- /dev/null
+from base import Setting, SettingSet
+from django.utils.translation import ugettext_lazy as _
+
+""" view settings """
+VIEW_SET = SettingSet('view', _('View settings'), _("Set up how certain parts of the site are displayed."), 20)
+
+RECENT_TAGS_SIZE = Setting('RECENT_TAGS_SIZE', 25, VIEW_SET, dict(
+label = _("Recent tags block size"),
+help_text = _("The number of tags to display in the recent tags block in the front page.")))
+
+RECENT_AWARD_SIZE = Setting('RECENT_AWARD_SIZE', 15, VIEW_SET, dict(
+label = _("Recent awards block size"),
+help_text = _("The number of awards to display in the recent awards block in the front page.")))
+
+LIMIT_RELATED_TAGS = Setting('LIMIT_RELATED_TAGS', 0, VIEW_SET, dict(
+label = _("Limit related tags block"),
+help_text = _("Limit related tags block size in questions list pages. Set to 0 to display all all tags.")))
\ No newline at end of file
<h2>{% trans "Forum settings" %}</h2>
<ul>
<li><a href="{% url admin_set allsets.form.name %}">{{ allsets.form.title }}</a></li>
+ <li><a href="{% url admin_set allsets.view.name %}">{{ allsets.view.title }}</a></li>
<li><a href="{% url admin_set allsets.moderation.name %}">{{ allsets.moderation.title }}</a></li>
</ul>
</div>
from forum.models import Tag, Award\r
from forum import settings\r
\r
-#todo: move to settings\r
-RECENT_TAGS_SIZE = 25\r
-RECENT_AWARD_SIZE = 15\r
-\r
register = template.Library()\r
\r
@register.inclusion_tag('sidebar/recent_tags.html')\r
def recent_tags():\r
- return {'tags': Tag.active.order_by('-id')[:RECENT_TAGS_SIZE]}\r
+ return {'tags': Tag.active.order_by('-id')[:settings.RECENT_TAGS_SIZE]}\r
\r
@register.inclusion_tag('sidebar/recent_awards.html')\r
def recent_awards():\r
- return {'awards': Award.objects.order_by('-awarded_at')[:RECENT_AWARD_SIZE]}\r
+ return {'awards': Award.objects.order_by('-awarded_at')[:settings.RECENT_AWARD_SIZE]}\r
\r
@register.inclusion_tag('sidebar/user_blocks.html')\r
def sidebar_upper():\r
from django.utils.safestring import mark_safe\r
from forum.models import Tag, MarkedTag\r
from forum.templatetags import argument_parser\r
+from forum import settings\r
\r
register = template.Library()\r
\r
@register.inclusion_tag('question_list/related_tags.html')\r
def question_list_related_tags(questions):\r
if len(questions):\r
- return {'tags': Tag.objects.filter(nodes__id__in=[q.id for q in questions]).distinct()}\r
+ tags = Tag.objects.filter(nodes__id__in=[q.id for q in questions]).distinct()\r
+\r
+ if settings.LIMIT_RELATED_TAGS:\r
+ tags = tags[:settings.LIMIT_RELATED_TAGS]\r
+\r
+ return {'tags': tags}\r
else:\r
return {'tags': False}\r
\r
context['othersets'] = sorted(
[s for s in Setting.sets.values() if not s.name in
('basic', 'users', 'email', 'paths', 'extkeys', 'repgain', 'minrep', 'voting', 'badges', 'about', 'faq', 'sidebar',
- 'form', 'moderation', 'css', 'headandfoot', 'head')]
+ 'form', 'moderation', 'css', 'headandfoot', 'head', 'view')]
, lambda s1, s2: s1.weight - s2.weight)
unsaved = request.session.get('previewing_settings', {})