Commits

Wilson Xu committed ea7bd92

Use bootstrap table.

Comments (0)

Files changed (3)

fbone/templates/index.html

-{% from 'macros/_misc.html' import render_pagination, render_users %}
+{% from 'macros/_misc.html' import render_pagination, render_user_table %}
 
-{% set page_title = _('All Users') %}
+{% set page_title = _('Home Page') %}
 
 {% extends 'layout.html' %}
 
 {% block body %}
-<p>index</p>
+{{ render_user_table(pagination.items) }}
 {{ render_pagination(pagination=pagination, endpoint='frontend.index') }}
 {% endblock %}

fbone/templates/macros/_misc.html

     </div>
 {% endmacro %}
 
-{% macro render_users(users) %}
-<ul>
-    {% for user in users %}
-    <li><a href="{{ url_for('user.show', name=user.name) }}">{{ user.name }}</a> ({{ user.email }})</li>
-    {% endfor %}
-</ul>
+{% macro render_user_table(users) %}
+<table>
+    <thead>
+        <tr>
+            <td>#</td>
+            <td>Username</td>
+            <td>Email</td>
+        </tr>
+    </thead>
+    <tbody>
+        {% for user in users %}
+        <tr>
+            <td>{{ loop.index }}</td>
+            <td><a href="{{ url_for('user.show', name=user.name) }}">{{ user.name }}</a></td>
+            <td>{{ user.email }}</td>
+        </tr>
+        {% endfor %}
+    </tbody>
+</table>
 {% endmacro %}
 
 {% macro render_pagination(pagination, endpoint) %}

fbone/templates/search.html

-{% from 'macros/_misc.html' import render_pagination, render_users %}
+{% from 'macros/_misc.html' import render_pagination, render_user_table %}
 
 {% extends 'layout.html' %}
 
 {% block body %}
     {% if pagination and pagination.pages > 0 %}
         <p>{% trans total=pagination.total, keywords=keywords %}<strong>{{ total }}</strong> found for your search "<strong>{{ keywords }}</strong>".{% endtrans %}</p>
-        {{ render_users(pagination.items) }}
+        {{ render_user_table(pagination.items) }}
         {{ render_pagination(pagination, 'frontend.search') }}
     {% else %}
         <p>{% trans keywords=keywords %}Sorry, Nothing found for your search "<strong>{{ keywords }}</strong>".{% endtrans %}</p>