Commits

Italo Maia committed 68e8700

Included thread breadcrumb, updated paginate.html and updated profile

  • Participants
  • Parent commits c2a1353

Comments (0)

Files changed (3)

forum/templates/forum/paginate.html

 <div class="paginate">
-    <a {% if page_obj.has_previous %}
-        href="?page=1
-{% if request.GET.order_by %}&order_by={{ request.GET.order_by }}{% endif %}"
-        {% endif %}>⇐</a>
+    <a {% if object_list.has_previous %}href="?page=1"{% endif %}>⇐</a>
+    <a {% if object_list.has_previous %}href="?page={{ object_list.previous_page_number }}"{% endif %}>←</a>
         
-        <a {% if page_obj.has_previous %}
-        href="?page={{ page_obj.previous_page_number }}
-{% if request.GET.order_by %}&order_by={{ request.GET.order_by }}{% endif %}"
-        {% endif %}>←</a>
-        
-        <span style="cursor:default">ω</span>
-        <a {% if page_obj.has_next %}
-        href="?page={{ page_obj.next_page_number }}
-{% if request.GET.order_by %}&order_by={{ request.GET.order_by }}{% endif %}"
-        {% endif %}>→</a>
-        <a {% if page_obj.has_next %}
-        href="?page=last
-{% if request.GET.order_by %}&order_by={{ request.GET.order_by }}{% endif %}"
-        {% endif %}>⇒</a>
+    <span style="cursor:default">ω</span>
+
+    <a {% if object_list.has_next %}href="?page={{ object_list.next_page_number }}"{% endif %}>→</a>
+    <a {% if object_list.has_next %}href="?page={{ object_list.paginator.num_pages }}"{% endif %}>⇒</a>
 </div>

forum/templates/forum/profile.html

 {% load i18n %}
 
 {% block forum_content %}
-<aside class="user_profile">
-    <div class="avatar">
-        <img src="{{ profile.get_avatar_url }}" alt='{% trans "avatar image" %}' title='{% trans "Avatar image for" %} {{ forum_user }}' />
-    </div>
-    {% if is_owner %}
-    <div class="menu">
-        <a id="edit_avatar" title='{% trans "Change your avatar image" %}'
-           href="{% url forum:edit_profile profile.nickname %}">{% trans "Edit avatar" %}</a>
-    </div>
-    {% endif %}
-</aside><!--
+<div class="user_profile">
+    <header>
+        <h3>
+            {% if profile %}
+            <a href='{{ profile.get_absolute_url }}'>{{ profile }}</a>
+            {% else %}Who are you? @.o{% endif %}
+        </h3>
+    </header>
 
---><section class="user_profile">
-    <h2 class="username">
-        <a href='{{ profile.get_absolute_url }}'>{{ profile }}</a>
-    </h2>
-    {% block section %}
-    <ul class="profile_list">
-        <li>
-            <label for="id_profile">{% trans "Profile created at" %}</label>
-            <span id="id_profile">{{ profile.creation_time|date }}</span>
-        </li>
-        <li>
-            <label for="id_reputation">{% trans "Reputation" %}</label>
-            <span id="id_reputation">{{ profile.reputation }}</span>
-        </li>
-        <li>
-            <label for="id_total_threads">{% trans "Threads" %}</label>
-            <span id="id_total_threads">{{ profile.threads_counter }}</span>
-        </li>
-        <li>
-            <label for="id_total_replies">{% trans "Replies" %}</label>
-            <span id="id_total_replies">{{ profile.replies_counter }}</span>
-        </li>
-    </ul>
-    {% if not is_owner %}
-    <a class="send_pvt" title='{% trans "send private message" %}'
-       href='{% url forum:send_message profile.nickname %}'>Send message</a>
-    {% endif %}
+    <aside>
+        <div class="avatar">
+            <img src="{{ profile.get_avatar_url }}" alt='{% trans "avatar image" %}' title='{% trans "Avatar image for" %} {{ forum_user }}' />
+        </div>
+        {% if is_self %}
+            <div class="menu">
+                <a id="edit_avatar" title='{% trans "Change your avatar image" %}'
+                   href="{% url forum:edit_profile %}">{% trans "Edit avatar" %}</a>
+            </div>
+        {% endif %}
+    </aside><!--
+
+ --><section>
+    {% block profile_content %}
+        <ul class="profile_list">
+            <li>
+                <label for="id_profile">{% trans "Profile created at" %}</label>
+                <span id="id_profile">{{ profile.creation_time|date }}</span>
+            </li>
+            <li>
+                <label for="id_gender">{% trans "Gender" %}</label>
+                <span id="id_gender">{{ profile.get_gender_display }}</span>
+            </li>
+            <li>
+                <label for="id_reputation">{% trans "Reputation" %}</label>
+                <span id="id_reputation">{{ profile.reputation }}</span>
+            </li>
+            <li>
+                <label for="id_total_threads">{% trans "Threads" %}</label>
+                <span id="id_total_threads">{{ profile.threads_counter }}</span>
+            </li>
+            <li>
+                <label for="id_total_replies">{% trans "Replies" %}</label>
+                <span id="id_total_replies">{{ profile.replies_counter }}</span>
+            </li>
+            {% if profile.message %}
+            <li>
+                <label>{% trans "Signature" %}</label>
+                <div>
+                    {{ profile.html|safe }}
+                </div>
+            </li>
+            {% endif %}
+        </ul>
+        {% if not is_self %}
+            <a class="send_pvt" title='{% trans "send private message" %}'
+               href='{% url forum:send_message profile.nickname %}'>Send message</a>
+        {% endif %}
     {% endblock %}
-</section>
+    </section>
 
-{% endblock %}
+</div>
+{% endblock %}

forum/templates/forum/thread.html

 {% extends "forum/base.html" %}
-{% load i18n %}
+{% load i18n cache %}
 
 {% block forum_content %}
-{% include "forum/parent_tree.html" %}
+{% cache 30 forum_breadcrumbs_thread %}
+    {% include "forum/parent_tree.html" %}
+{% endcache %}
 
 <section class="thread">
     {% if thread.image %}
 
 {% for user_reply in object_list %}
 {% with user_reply.author as author %}
-{% with author.forum_profile as author_profile %}
 <article class="thread_reply">
     <header>
         {{ user_reply.created|date }} <strong><a href="{{ thread.get_absolute_url }}">{{ thread.title }}</a></strong>
     </header>
     <aside class="avatar">
-        <img src="{{ author_profile.get_avatar_url }}" alt="user avatar" />
+        <img src="{{ author.get_avatar_url }}" alt="user avatar" />
     </aside>
     <section>
         <header>
     </section>
 </article>
 {% endwith %}
-{% endwith %}
 {% endfor %}{# END replies #}
 
-<div id="thread_actions">
+{% include "forum/paginate.html" %}
+
+<div class="actions">
     <a href='{% url forum:reply forum.id thread.id %}'>{% trans "Reply" %}</a>
 </div>