Browse Source

- Extra configurability for forums lists
- Some styles for unregistered posts

Ralfp 12 years ago
parent
commit
23bad82cf1

+ 5 - 5
misago/forums/fixtures.py

@@ -29,7 +29,7 @@ def load_fixtures():
     post = Post.objects.create(
                                forum=forum,
                                thread=thread,
-                               user_name='Misago Project',
+                               user_name='MisagoProject',
                                ip='127.0.0.1',
                                agent='',
                                post='Welcome to Misago!',
@@ -37,11 +37,11 @@ def load_fixtures():
                                date=now,
                                )
     thread.start_post = post
-    thread.start_poster_name = 'Misago Project'
-    thread.start_poster_slug = 'misago-project'
+    thread.start_poster_name = 'MisagoProject'
+    thread.start_poster_slug = 'misagoproject'
     thread.last_post = post
-    thread.last_poster_name = 'Misago Project'
-    thread.last_poster_slug = 'misago-project'
+    thread.last_poster_name = 'MisagoProject'
+    thread.last_poster_slug = 'misagoproject'
     thread.save(force_update=True)
     forum.last_thread = thread
     forum.last_thread_name = thread.name

+ 4 - 0
misago/forums/forms.py

@@ -20,6 +20,7 @@ class CategoryForm(Form):
                                           ('half', _('Two forums per row')),
                                           ('quarter', _('Four forums per row')),
                                           ))
+    show_details = forms.BooleanField(widget=YesNoSwitch,required=False)
     
     layout = (
               (
@@ -36,6 +37,7 @@ class CategoryForm(Form):
                _("Display Options"),
                (
                 ('template', {'label': _("Category Layout"), 'help_text': _('Controls how this category is displayed on forums lists.')}),
+                ('show_details', {'label': _("Show Subforums Details"), 'help_text': _('Allows you to prevent this category subforums from displaying statistics, last post data, etc. ect. on forums lists.')}),
                 ('style', {'label': _("Category Style"), 'help_text': _('You can add custom CSS classess to this category, to change way it looks on board index.')}),
                 ),
               ),
@@ -63,6 +65,7 @@ class ForumForm(Form):
                                           ('half', _('Two forums per row')),
                                           ('quarter', _('Four forums per row')),
                                           ))
+    show_details = forms.BooleanField(widget=YesNoSwitch,required=False)
     
     layout = (
               (
@@ -86,6 +89,7 @@ class ForumForm(Form):
                _("Display Options"),
                (
                 ('template', {'label': _("Subforums Layout"), 'help_text': _('Controls how this forum displays subforums list.')}),
+                ('show_details', {'label': _("Show Subforums Details"), 'help_text': _("Allows you to prevent this forum's subforums from displaying statistics, last post data, etc. ect. on subforums list.")}),
                 ('style', {'label': _("Forum Style"), 'help_text': _('You can add custom CSS classess to this forum to change way it looks on forums lists.')}),
                 ),
               ),

+ 2 - 1
misago/forums/models.py

@@ -108,7 +108,8 @@ class Forum(MPTTModel):
     prune_start = models.PositiveIntegerField(default=0)
     prune_last = models.PositiveIntegerField(default=0)
     redirect = models.CharField(max_length=255,null=True,blank=True)
-    template = models.CharField(max_length=255,null=True,blank=True)
+    template = models.CharField(default='row',max_length=255,null=True,blank=True)
+    show_details = models.BooleanField(default=True)
     style = models.CharField(max_length=255,null=True,blank=True)
     closed = models.BooleanField(default=False)
     

+ 5 - 1
misago/forums/views.py

@@ -83,9 +83,10 @@ class NewCategory(FormWidget):
     def submit_form(self, form, target):
         new_forum = Forum(
                      name=form.cleaned_data['name'],
-                     template=form.cleaned_data['template'],
                      slug=slugify(form.cleaned_data['name']),
                      type='category',
+                     template=form.cleaned_data['template'],
+                     show_details=form.cleaned_data['show_details'],
                      style=form.cleaned_data['style'],
                      closed=form.cleaned_data['closed'],
                      )
@@ -119,6 +120,7 @@ class NewForum(FormWidget):
                      slug=slugify(form.cleaned_data['name']),
                      type='forum',
                      template=form.cleaned_data['template'],
+                     show_details=form.cleaned_data['show_details'],
                      style=form.cleaned_data['style'],
                      closed=form.cleaned_data['closed'],
                      prune_start=form.cleaned_data['prune_start'],
@@ -249,6 +251,7 @@ class Edit(FormWidget):
             initial['redirect'] = model.redirect
         else:
             initial['template'] = model.template
+            initial['show_details'] = model.show_details
             initial['style'] = model.style
             initial['closed'] = model.closed
             
@@ -265,6 +268,7 @@ class Edit(FormWidget):
             target.redirect = form.cleaned_data['redirect']
         else:
             target.template = form.cleaned_data['template']
+            target.show_details = form.cleaned_data['show_details']
             target.style = form.cleaned_data['style']
             target.closed = form.cleaned_data['closed']
             

+ 1 - 1
misago/threads/views/thread.py

@@ -18,7 +18,7 @@ class ThreadView(BaseView):
         self.forum = self.thread.forum
         self.request.acl.forums.allow_forum_view(self.forum)
         self.request.acl.threads.allow_thread_view(self.request.user, self.thread)
-        self.parents = Forum.objects.forum_parents(self.forum.pk)
+        self.parents = Forum.objects.forum_parents(self.forum.pk, True)
         self.tracker = ThreadsTracker(self.request.user, self.forum)
     
     def fetch_posts(self, page):

+ 2 - 1
static/sora/css/sora.css

@@ -978,7 +978,8 @@ td.lead-cell{color:#555555;font-weight:bold;}
 .posts-list{margin-top:12px;margin-bottom:20px;}.posts-list .well-post{margin:0px;margin-bottom:16px;overflow:auto;padding:16px 0px;}.posts-list .well-post .post-author{overflow:auto;float:left;width:286px;position:relative;bottom:4px;}.posts-list .well-post .post-author .avatar-normal{float:left;margin:4px 0px;margin-left:16px;width:80px;height:80px;-webkit-box-shadow:0px 0px 4px #999999;-moz-box-shadow:0px 0px 4px #999999;box-shadow:0px 0px 4px #999999;}
 .posts-list .well-post .post-author .post-bit{float:left;margin-left:12px;padding-top:4px;font-weight:bold;font-size:120%;}.posts-list .well-post .post-author .post-bit p{margin:0px;}
 .posts-list .well-post .post-author .post-bit .lead{font-size:150%;}
-.posts-list .well-post .post-author .post-bit .user-title{color:#555555;}
+.posts-list .well-post .post-author .post-bit span.lead{color:#cccccc;}
+.posts-list .well-post .post-author .post-bit .user-title{color:#999999;}
 .posts-list .well-post .post-author .post-bit .post-date{margin-top:4px;color:#999999;font-size:70%;font-weight:normal;}
 .posts-list .well-post .post-content{margin-left:286px;padding:0px 16px;}.posts-list .well-post .post-content .post-extra{overflow:auto;float:right;margin-bottom:12px;}.posts-list .well-post .post-content .post-extra .post-perma{margin-left:8px;color:#999999;}
 .posts-list .well-post .post-content .post-extra .label{margin-left:8px;padding:4px 5px;font-size:100%;}

+ 5 - 1
static/sora/css/sora/threads.less

@@ -140,8 +140,12 @@
           font-size: 150%;
         }
         
+        span.lead {
+          color: lighten(@grayLight, 20%);
+        }
+        
         .user-title {
-          color: @gray;
+          color: @grayLight;
         }
         
         .post-date {

+ 2 - 2
templates/sora/macros.html

@@ -60,7 +60,7 @@
         <h3><a href="{{ forum.type|url(slug=forum.slug, forum=forum.id) }}"{% if forum.type != 'redirect' and forum.is_read %} class="read-forum"{% endif %}>{{ forum.name }}</a></h3>
         {% if forum.description %}<div class="muted">{{ forum.description }}</div>{% endif %}
       </div>
-      {% if category.template != 'quarter' %}
+      {% if category.show_details and category.template != 'quarter' %}
       {% if forum.type == 'redirect' %}
       <div class="pull-right forum-stat stat-redirects">
         <span class="stat {% if forum.redirects_delta > 0 %}positive{% else %}stag{% endif %}">{% if forum.redirects_delta > 0 %}+{{ forum.redirects_delta }}{% else %}{{ forum.redirects }}{% endif %}</span> <span class="muted">{% trans %}clicks{% endtrans %}</span>
@@ -71,7 +71,7 @@
       </div>
       {% if category.template != 'half' %}
       <div class="pull-right forum-stat stat-threads">
-        <span class="stat {% if forum.threads_delta > 0 %}positive{% else %}stag{% endif %}">{% if forum.posts_delta > 0 %}+{{ forum.threads_delta }}{% else %}{{ forum.threads }}{% endif %}</span> <span class="muted">{% trans %}threads{% endtrans %}</span>
+        <span class="stat {% if forum.threads_delta > 0 %}positive{% else %}stag{% endif %}">{% if forum.threads_delta > 0 %}+{{ forum.threads_delta }}{% else %}{{ forum.threads }}{% endif %}</span> <span class="muted">{% trans %}threads{% endtrans %}</span>
       </div>
       {% endif %}
       {% endif %}