diff --git a/core/static/core/style.scss b/core/static/core/style.scss index 5db187ad..dc5e4eeb 100644 --- a/core/static/core/style.scss +++ b/core/static/core/style.scss @@ -48,8 +48,8 @@ a { .ib { display: inline-block; - padding: 2px; - margin: 2px; + padding: 1px; + margin: 1px; } .w_big { @@ -57,11 +57,11 @@ a { } .w_medium { - width: 45%; + width: 47%; } .w_small { - width: 20%; + width: 23%; } /*--------------------------------HEADER-------------------------------*/ @@ -271,11 +271,15 @@ code { } blockquote { - margin: 10px; - padding: 5px; + margin: 5px; + padding: 2px; border: solid 1px $black-color; } +blockquote h5:first-child { + font-size: 100%; +} + .edit-bar { display: block; margin: 4px; @@ -498,86 +502,132 @@ textarea { /*------------------------------FORUM----------------------------------*/ -.topic a, .forum a, .category a { - color: $black-color; -} - -.topic a:hover, .forum a:hover, .category a:hover { - color: #424242; - text-decoration: underline; -} - -.topic { - border: solid $primary-neutral-color 1px; - padding: 2px; - margin: 2px; -} - -.forum { - background: $primary-neutral-light-color; - padding: 2px; - margin: 2px; -} - -.category { - background: $secondary-color; -} - -.message { - padding: 2px; - margin: 2px; - background: $white-color; - &:nth-child(odd) { - background: $primary-neutral-light-color; - } - h5 { - font-size: 100%; - } - &.unread { - background: #d8e7f3; - } -} - -.msg_author.deleted { - background: #ffcfcf; -} - -.msg_content { - &.deleted { - background: #ffefef; - } - display: inline-block; - width: 80%; - vertical-align: top; -} - -.msg_author { - display: inline-block; - width: 19%; - text-align: center; - background: $primary-light-color; - img { - max-width: 70%; - margin: 0px auto; - } -} - -.msg_meta { - font-size: small; - list-style-type: none; - li { - padding: 2px; - margin: 2px; - } -} - -.forum_signature { - color: #C0C0C0; - border-top: 1px solid #C0C0C0; +#forum { a { + color: $black-color; + } + + a:hover { + color: #424242; + text-decoration: underline; + } + + .topic { + border: solid $primary-neutral-color 1px; + padding: 1px; + margin: 1px; + p { + margin: 1px; + font-size: smaller; + } + } + + .tools { + font-size: x-small; + border: none; + a { + padding: 1px; + } + } + + .title { + font-size: small; + font-weight: bold; + padding: 2px; + } + + .last_message date { + white-space: nowrap; + } + + .last_message span { + white-space: nowrap; + text-overflow: ellipsis; + overflow:hidden; + width: 100%; + display: block; + } + + .forum { + background: $primary-neutral-light-color; + padding: 1px; + margin: 1px; + p { + margin: 1px; + font-size: smaller; + } + } + + .category { + margin-top: 5px; + background: $secondary-color; + .title { + text-transform: uppercase; + } + } + + .message { + padding: 1px; + margin: 1px; + background: $white-color; + &:nth-child(odd) { + background: $primary-neutral-light-color; + } + .title { + font-size: 100%; + } + &.unread { + background: #d8e7f3; + } + } + + .msg_author.deleted { + background: #ffcfcf; + } + + .msg_content { + &.deleted { + background: #ffefef; + } + display: inline-block; + width: 80%; + vertical-align: top; + } + + .msg_author { + display: inline-block; + width: 19%; + text-align: center; + background: $primary-light-color; + img { + max-width: 70%; + margin: 0px auto; + } + } + + .msg_header { + display: inline-block; + width: 100%; + font-size: small; + } + + .msg_meta { + font-size: small; + list-style-type: none; + li { + padding: 1px; + margin: 1px; + } + } + + .forum_signature { color: #C0C0C0; - &:hover { - text-decoration: underline; + border-top: 1px solid #C0C0C0; + a { + color: #C0C0C0; + &:hover { + text-decoration: underline; + } } } } diff --git a/forum/templates/forum/forum.jinja b/forum/templates/forum/forum.jinja index f6e4e1ae..6d4886fe 100644 --- a/forum/templates/forum/forum.jinja +++ b/forum/templates/forum/forum.jinja @@ -6,13 +6,14 @@ {% endblock %} {% block content %} -
+
{% trans %}Forum{% endtrans %} {% for f in forum.get_parent_list()|reverse %} > {{ f }} {% endfor %} > {{ forum }} -
+
+

{{ forum.name }}

{% if user.is_in_group(settings.SITH_GROUP_FORUM_ADMIN_ID) or user.is_in_group(settings.SITH_GROUP_COM_ADMIN_ID) %} @@ -34,6 +35,7 @@

+ {{ display_forum(forum, user, True) }} {% for f in forum.children.all() %} {{ display_forum(f, user) }} {% endfor %} @@ -58,7 +60,13 @@ {% for t in topics %} {{ display_topic(t, user) }} {% endfor %} +

+ {% for p in topics.paginator.page_range %} + {{ p }} + {% endfor %} +

{% endif %} + {% endblock %} diff --git a/forum/templates/forum/last_unread.jinja b/forum/templates/forum/last_unread.jinja index 51fb1b7c..7489db2b 100644 --- a/forum/templates/forum/last_unread.jinja +++ b/forum/templates/forum/last_unread.jinja @@ -15,9 +15,17 @@ {% trans %}Mark all as read{% endtrans %} {% trans %}Refresh{% endtrans %}

- {% for t in forumtopic_list %} + {% for t in page_obj.object_list %} {{ display_topic(t, user, True) }} {% endfor %} + +

+ {% for p in paginator.page_range %} + + {{ p }} + + {% endfor %} +

{% endblock %} diff --git a/forum/templates/forum/macros.jinja b/forum/templates/forum/macros.jinja index d8b529f7..b89ce4c2 100644 --- a/forum/templates/forum/macros.jinja +++ b/forum/templates/forum/macros.jinja @@ -1,37 +1,43 @@ {% from 'core/macros.jinja' import user_profile_link %} -{% macro display_forum(forum, user) %} -
+{% macro display_forum(forum, user, is_root=False) %} +
- {% if not forum.is_category %} + {% if not is_root %}
-
+

{{ forum.topic_number }} -

-
+

+ @@ -48,33 +54,33 @@ {% else %} {% endif %} -
{{ topic.title }}
+
{{ topic.title }}

{{ topic.description }}

{% if user.can_edit(topic) %} - -
+
-
+

{{ user_profile_link(topic.author) }} -

-
+

+

{{ topic.messages.count() }} -

+

- +

{% endmacro %} @@ -92,26 +98,24 @@ {{ m.author.get_short_name() }}
-
- {% if m.title %} -
{{ m.title }}
- {% endif %} -
-
- - {% trans %}Reply as quote{% endtrans %} - {% if user.can_edit(m) %} - {% trans %}Edit{% endtrans %} - {% endif %} - {% if m.can_be_moderated_by(user) %} - {% if m.deleted %} - {% trans %}Undelete{% endtrans %} - {% else %} - {% trans %}Delete{% endtrans %} - {% endif %} - {% endif %} -
- {{ m.date|localtime|date(DATETIME_FORMAT) }} {{ m.date|localtime|time(DATETIME_FORMAT) }} +
+
{{ m.title }}
+
+ + {% trans %}Reply as quote{% endtrans %} + {% if user.can_edit(m) %} + {% trans %}Edit{% endtrans %} + {% endif %} + {% if m.can_be_moderated_by(user) %} + {% if m.deleted %} + {% trans %}Undelete{% endtrans %} + {% else %} + {% trans %}Delete{% endtrans %} + {% endif %} + {% endif %} +
+ {{ m.date|localtime|date(DATETIME_FORMAT) }} {{ m.date|localtime|time(DATETIME_FORMAT) }} +

diff --git a/forum/templates/forum/main.jinja b/forum/templates/forum/main.jinja index 243cbb12..ccca49cb 100644 --- a/forum/templates/forum/main.jinja +++ b/forum/templates/forum/main.jinja @@ -7,9 +7,10 @@ {% endblock %} {% block content %} -

- {% trans %}Forum{% endtrans %} > -

+

+{% trans %}Forum{% endtrans %} > +

+

{% trans %}Forum{% endtrans %}

{% trans %}View last unread messages{% endtrans %} @@ -19,14 +20,28 @@ {% trans %}New forum{% endtrans %}

{% endif %} +
+
+ {% trans %}Title{% endtrans %} +
+
+
+ {% trans %}Topics{% endtrans %} +
+
+ {% trans %}Last message{% endtrans %} +
+
+
{% for f in forum_list %} -
- {{ display_forum(f, user) }} +
+ {{ display_forum(f, user, True) }} {% for c in f.children.all() %} {{ display_forum(c, user) }} {% endfor %}
{% endfor %} +
{% endblock %} diff --git a/forum/templates/forum/topic.jinja b/forum/templates/forum/topic.jinja index 80c246b1..0e02b99e 100644 --- a/forum/templates/forum/topic.jinja +++ b/forum/templates/forum/topic.jinja @@ -35,6 +35,7 @@ > {{ topic }}

{{ topic.title }}

+

{{ topic.description }}

{% trans %}Reply{% endtrans %}

@@ -62,6 +63,7 @@ {{ p }} {% endfor %}

+
{% endblock %} diff --git a/forum/views.py b/forum/views.py index 5ef4ff5b..87005b87 100644 --- a/forum/views.py +++ b/forum/views.py @@ -59,6 +59,7 @@ class ForumMarkAllAsRead(RedirectView): class ForumLastUnread(ListView): model = ForumTopic template_name = "forum/last_unread.jinja" + paginate_by = settings.SITH_FORUM_PAGE_LENGTH / 2 def get_queryset(self): l = ForumMessage.objects.exclude(readers=self.request.user).filter( @@ -117,7 +118,16 @@ class ForumDetailView(CanViewMixin, DetailView): def get_context_data(self, **kwargs): kwargs = super(ForumDetailView, self).get_context_data(**kwargs) - kwargs['topics'] = self.object.topics.annotate(models.Max('messages__date')).order_by('-messages__date__max') + qs = self.object.topics.order_by('-_last_message__date').select_related('_last_message') + paginator = Paginator(qs, + settings.SITH_FORUM_PAGE_LENGTH) + page = self.request.GET.get('topic_page') + try: + kwargs["topics"] = paginator.page(page) + except PageNotAnInteger: + kwargs["topics"] = paginator.page(1) + except EmptyPage: + kwargs["topics"] = paginator.page(paginator.num_pages) return kwargs class TopicForm(forms.ModelForm): @@ -164,7 +174,7 @@ class ForumTopicDetailView(CanViewMixin, DetailView): kwargs['first_unread_message_id'] = msg.id except: kwargs['first_unread_message_id'] = float("inf") - paginator = Paginator(self.object.messages.select_related('author__avatar_pict').all(), + paginator = Paginator(self.object.messages.select_related('author__avatar_pict').order_by('date'), settings.SITH_FORUM_PAGE_LENGTH) page = self.request.GET.get('page') try: