Peter Justin 9 лет назад
Родитель
Сommit
b468f31529
1 измененных файлов с 21 добавлено и 20 удалено
  1. 21 20
      flaskbb/templates/forum/search_result.html

+ 21 - 20
flaskbb/templates/forum/search_result.html

@@ -16,41 +16,41 @@
             {% trans %}Posts{% endtrans %}
         </div>
         <div class="panel-body topic-body">
-            {% for post in result['post'].all() %}
+            {% for post in result['post'] %}
             <div id="{{ post.id }}" class="row post-row clearfix">
 
                 <div class="author col-md-2 col-sm-3 col-xs-12">
                     <!-- Registered User -->
                     {% if post.user_id %}
-                    <div class="author-name"><h4><a href="{{ user.url }}">{{ user.username }}</a></h4></div>
+                    <div class="author-name"><h4><a href="{{ post.user.url }}">{{ post.user.username }}</a></h4></div>
 
                     <!-- check if user is online or not -->
-                    {% if user|is_online %}
+                    {% if post.user|is_online %}
                     <div class="author-online" data-toggle="tooltip" data-placement="top" title="online"></div>
                     {% else %}
                     <div class="author-offline" data-toggle="tooltip" data-placement="top" title="offline"></div>
                     {% endif %}
-                    <div class="author-title"><h5>{{ user.primary_group.name }}</h5></div>
+                    <div class="author-title"><h5>{{ post.user.primary_group.name }}</h5></div>
 
-                    {% if user.avatar %}
-                        <div class="author-avatar"><img src="{{ user.avatar }}" alt="avatar"></div>
+                    {% if post.user.avatar %}
+                        <div class="author-avatar"><img src="{{ post.user.avatar }}" alt="avatar"></div>
                     {% endif %}
 
-                    <div class="author-registered">{% trans %}Joined{% endtrans %}: {{ user.date_joined|format_date('%b %d %Y') }}</div>
-                    <div class="author-posts">{% trans %}Posts{% endtrans %}: {{ user.post_count }}</div>
+                    <div class="author-registered">{% trans %}Joined{% endtrans %}: {{ post.user.date_joined|format_date('%b %d %Y') }}</div>
+                    <div class="author-posts">{% trans %}Posts{% endtrans %}: {{ post.user.post_count }}</div>
                     <div class="author-pm">
                         {% if current_user.is_authenticated and post.user_id %}
-                        <a href="{{ url_for('message.new_conversation') }}?to_user={{ user.username }}">{% trans %}Message{% endtrans %}</a>
+                        <a href="{{ url_for('message.new_conversation') }}?to_user={{ post.user.username }}">{% trans %}Message{% endtrans %}</a>
                         {% endif %}
                     </div>
 
-                    {% if user.website %}
-                    <div class="author-website"><a href="{{ user.website }}" rel="nofollow">{% trans %}Website{% endtrans %}</a></div>
+                    {% if post.user.website %}
+                    <div class="author-website"><a href="{{ post.user.website }}" rel="nofollow">{% trans %}Website{% endtrans %}</a></div>
                     {% endif %}
 
                     {% else %}
                     <!-- user deleted or guest -->
-                    <div class="author-name"><h4><a href="{{ user.url }}">{{ post.username }}</a></h4></div>
+                    <div class="author-name"><h4><a href="{{ post.user.url }}">{{ post.username }}</a></h4></div>
                     <div class="author-title"><h5>{% trans %}Guest{% endtrans %}</h5></div>
                     {% endif %}
 
@@ -61,7 +61,7 @@
                     <div class="post-meta clearfix">
                         <div class="pull-left">
                             <!-- Creation date / Date modified -->
-                            <a href="{{ generate_post_url(post.topic, post, posts.page) }}">
+                            <a href="{{ post.url }}">
                                 {{ post.date_created|format_date('%d %B %Y - %H:%M') }}
                             </a>
                             {% if post.user_id and post.date_modified %}
@@ -74,22 +74,23 @@
 
                         <!-- Post number -->
                         <div class="pull-right">
-                            <strong>#{{ generate_post_id(posts, loop.index, flaskbb_config["POSTS_PER_PAGE"]) }}</strong>
+                            <strong>#{{ post.id }}</strong>
                         </div>
                     </div>
 
                     <div class="post-content post_body clearfix" id="pid{{ post.id }}">
                         {{ post.content|markup|safe }}
                     </div>
-
                 </div>
             </div>
-        {% else %}
-        <!-- cheating a bit here with page-row :P -->
-        <div class="row page-row clearfix">
-            <div class="col-md-12 col-sm-12 col-xs-12">{% trans %}No posts found matching your search criteria.{% endtrans %}</div>
+            {% else %}
+            <!-- cheating a bit here with page-row :P -->
+            <div class="row page-row clearfix">
+                <div class="col-md-12 col-sm-12 col-xs-12">{% trans %}No posts found matching your search criteria.{% endtrans %}</div>
+            </div>
+            {% endfor %}
         </div>
-        {% endfor %}
+    </div>
     {% endif %}
 
     {% if result['user'] %}