Browse Source

Reorganized templates

Rafał Pitoń 10 years ago
parent
commit
19d08b79a3

+ 0 - 0
misago/templates/misago/threads/editor.html → misago/templates/misago/posting/form.html


+ 0 - 0
misago/templates/misago/threads/replyform.html → misago/templates/misago/posting/replyform.html


+ 0 - 0
misago/templates/misago/threads/replyform_js.html → misago/templates/misago/posting/replyform_js.html


+ 0 - 0
misago/templates/misago/threads/threadstate.html → misago/templates/misago/posting/stateform.html


+ 0 - 0
misago/templates/misago/threads/thread.html → misago/templates/misago/thread/replies.html


+ 9 - 2
misago/templates/misago/threads/list.html

@@ -38,7 +38,11 @@
 
     <div class="threads-list">
 
-      {% include "misago/threads/list_actions.html" with is_upper=True %}
+      <div class="table-actions">
+        {% include "misago/threads/paginator.html" %}
+        {% include "misago/threads/sort.html" %}
+        {% include "misago/threads/reply_btn.html" %}
+      </div>
 
       <div class="table-panel">
         <ul class="list-group">
@@ -131,7 +135,10 @@
         </ul>
       </div>
 
-      {% include "misago/threads/list_actions.html" %}
+      <div class="table-actions">
+        {% include "misago/threads/paginator.html" %}
+        {% include "misago/threads/reply_btn.html" %}
+      </div>
 
     </div>
 

+ 0 - 86
misago/templates/misago/threads/list_actions.html

@@ -1,86 +0,0 @@
-{% load i18n misago_capture misago_pagination %}
-<div class="table-actions">
-
-  <ul class="pager pull-left">
-    <li class="page">
-      {% capture trimmed as page_strong %}
-      <strong>{{ page.number }}</strong>
-      {% endcapture %}
-      {% capture trimmed as pages_strong %}
-      <strong>{{ paginator.num_pages }}</strong>
-      {% endcapture %}
-      {% blocktrans with page=page_strong|safe pages=pages_strong|safe %}
-      Page {{ page }} of {{ pages }}
-      {% endblocktrans %}
-    </li>
-    {% if page.has_previous %}
-      <li>
-        <a href="{% pageurl link_name links_params %}" class="tooltip-top" title="{% trans "Go to first page" %}">
-          {% if page.number > 2 %}
-          {% trans "First" %}
-          {% else %}
-          <span class="glyphicon glyphicon-chevron-left"></span>
-          {% endif %}
-        </a>
-      </li>
-      {% if page.number > 2 %}
-      <li>
-        <a href="{% pageurl link_name links_params page.previous_page_number %}" class="tooltip-top" title="{% trans "Go to previous page" %}">
-          <span class="glyphicon glyphicon-chevron-left"></span>
-        </a>
-      </li>
-      {% endif %}
-    {% endif %}
-    {% if page.has_next %}
-      <li>
-        <a href="{% pageurl link_name links_params page.next_page_number %}" class="tooltip-top" title="{% trans "Go to next page" %}">
-          <span class="glyphicon glyphicon-chevron-right"></span>
-        </a>
-      </li>
-    {% endif %}
-  </ul>
-
-  {% if is_upper %}
-    <div class="btn-group pull-left">
-      <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
-        {% trans "Sort:" %} <strong>{{ order_name }}</strong>
-      </button>
-      <ul class="dropdown-menu" role="menu">
-        <li class="dropdown-title">
-          {% trans "Change sorting to:" %}
-        </li>
-        {% for order in order_by %}
-        <li>
-          <a href="{{ order.url }}">
-            {{ order.name }}
-          </a>
-        </li>
-        {% endfor %}
-      </ul>
-    </div>
-  {% endif %}
-
-  {% if forum.is_closed %}
-  <span class="btn btn-default disabled pull-right">
-    <span class="fa fa-lock"></span>
-    {% trans "This forum is closed." %}
-  </span>
-  {% else %}
-    {% if user.is_anonymous %}
-    <a href="{% url LOGIN_URL %}" class="btn btn-default pull-right">
-      <span class="fa fa-check-circle"></span>
-      {% trans "Sign in to start thread" %}
-    </a>
-    {% elif forum.acl.can_start_threads %}
-    <a href="{% url 'misago:start_thread' forum_slug=forum.slug forum_id=forum.id %}" class="btn btn-success pull-right">
-      <span class="fa fa-plus-circle"></span>
-      {% trans "Start thread" %}
-    </a>
-    {% else %}
-    <span class="btn btn-default btn-closed pull-right">
-      <span class="fa fa-ban"></span>
-      {% trans "Can't start threads" %}
-    </span>
-    {% endif %}
-  {% endif %}
-</div>

+ 39 - 0
misago/templates/misago/threads/paginator.html

@@ -0,0 +1,39 @@
+{% load i18n misago_capture misago_pagination %}
+<ul class="pager pull-left">
+  <li class="page">
+    {% capture trimmed as page_strong %}
+    <strong>{{ page.number }}</strong>
+    {% endcapture %}
+    {% capture trimmed as pages_strong %}
+    <strong>{{ paginator.num_pages }}</strong>
+    {% endcapture %}
+    {% blocktrans with page=page_strong|safe pages=pages_strong|safe %}
+    Page {{ page }} of {{ pages }}
+    {% endblocktrans %}
+  </li>
+  {% if page.has_previous %}
+    <li>
+      <a href="{% pageurl link_name links_params %}" class="tooltip-top" title="{% trans "Go to first page" %}">
+        {% if page.number > 2 %}
+        {% trans "First" %}
+        {% else %}
+        <span class="glyphicon glyphicon-chevron-left"></span>
+        {% endif %}
+      </a>
+    </li>
+    {% if page.number > 2 %}
+    <li>
+      <a href="{% pageurl link_name links_params page.previous_page_number %}" class="tooltip-top" title="{% trans "Go to previous page" %}">
+        <span class="glyphicon glyphicon-chevron-left"></span>
+      </a>
+    </li>
+    {% endif %}
+  {% endif %}
+  {% if page.has_next %}
+    <li>
+      <a href="{% pageurl link_name links_params page.next_page_number %}" class="tooltip-top" title="{% trans "Go to next page" %}">
+        <span class="glyphicon glyphicon-chevron-right"></span>
+      </a>
+    </li>
+  {% endif %}
+</ul>

+ 24 - 0
misago/templates/misago/threads/reply_btn.html

@@ -0,0 +1,24 @@
+{% load i18n %}
+{% if forum.is_closed %}
+<span class="btn btn-default disabled pull-right">
+  <span class="fa fa-lock"></span>
+  {% trans "This forum is closed." %}
+</span>
+{% else %}
+  {% if user.is_anonymous %}
+  <a href="{% url LOGIN_URL %}" class="btn btn-default pull-right">
+    <span class="fa fa-check-circle"></span>
+    {% trans "Sign in to start thread" %}
+  </a>
+  {% elif forum.acl.can_start_threads %}
+  <a href="{% url 'misago:start_thread' forum_slug=forum.slug forum_id=forum.id %}" class="btn btn-success pull-right">
+    <span class="fa fa-plus-circle"></span>
+    {% trans "Start thread" %}
+  </a>
+  {% else %}
+  <span class="btn btn-default btn-closed pull-right">
+    <span class="fa fa-ban"></span>
+    {% trans "Can't start threads" %}
+  </span>
+  {% endif %}
+{% endif %}

+ 18 - 0
misago/templates/misago/threads/sort.html

@@ -0,0 +1,18 @@
+{% load i18n %}
+<div class="btn-group pull-left">
+  <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
+    {% trans "Sort:" %} <strong>{{ order_name }}</strong>
+  </button>
+  <ul class="dropdown-menu" role="menu">
+    <li class="dropdown-title">
+      {% trans "Change sorting to:" %}
+    </li>
+    {% for order in order_by %}
+    <li>
+      <a href="{{ order.url }}">
+        {{ order.name }}
+      </a>
+    </li>
+    {% endfor %}
+  </ul>
+</div>

+ 3 - 3
misago/threads/forms/reply.py

@@ -9,8 +9,8 @@ from misago.markup import common_flavour
 class ReplyForm(forms.Form):
     is_main = True
     legend = _("Reply")
-    template = "misago/threads/replyform.html"
-    js_template = "misago/threads/replyform_js.html"
+    template = "misago/posting/replyform.html"
+    js_template = "misago/posting/replyform_js.html"
 
     post = forms.CharField(label=_("Message body"), required=False)
 
@@ -120,7 +120,7 @@ class PrefixedThreadForm(ThreadForm):
 class FullThreadStateForm(forms.Form):
     is_supporting = True
     legend = _("Thread options")
-    template = "misago/threads/threadstate.html"
+    template = "misago/posting/stateform.html"
 
     weight = forms.TypedChoiceField(label=_("Thread weight"), initial=0,
                                     widget=forms.RadioSelect,

+ 1 - 7
misago/threads/views/generic/base.py

@@ -72,12 +72,6 @@ class PostMixin(object):
 
 
 class ViewBase(ForumMixin, ThreadMixin, PostMixin, View):
-    templates_dir = ''
-    template = ''
-
-    def final_template(self):
-        return '%s/%s' % (self.templates_dir, self.template)
-
     def process_context(self, request, context):
         """
         Simple hook for extending and manipulating template context.
@@ -86,5 +80,5 @@ class ViewBase(ForumMixin, ThreadMixin, PostMixin, View):
 
     def render(self, request, context=None, template=None):
         context = self.process_context(request, context or {})
-        template = template or self.final_template()
+        template = template or self.template
         return render(request, template, context)

+ 1 - 1
misago/threads/views/generic/posting.py

@@ -21,7 +21,7 @@ class EditorView(ViewBase):
     """
     Basic view for starting/replying/editing
     """
-    template = 'editor.html'
+    template = 'misago/posting/form.html'
 
     def find_mode(self, request, *args, **kwargs):
         """

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

@@ -12,7 +12,7 @@ class ThreadView(ViewBase):
     """
     Basic view for threads
     """
-    template = 'thread.html'
+    template = 'misago/thread/replies.html'
 
     def dispatch(self, request, *args, **kwargs):
         relations = ['forum', 'starter', 'last_poster', 'first_post']

+ 1 - 1
misago/threads/views/generic/threadslists.py

@@ -94,7 +94,7 @@ class ForumView(OrderThreadsMixin, ThreadsView):
     """
     Basic view for threads lists
     """
-    template = 'list.html'
+    template = 'misago/threads/list.html'
 
     def get_threads(self, request, forum, kwargs, order_by=None, limit=None):
         queryset = self.get_threads_queryset(request, forum)

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

@@ -2,7 +2,7 @@ from misago.threads.views import generic
 
 
 class ThreadsMixin(object):
-    templates_dir = 'misago/threads'
+    pass
 
 
 class ForumView(ThreadsMixin, generic.ForumView):