askrobots / dbbasic-examples
Public
Example DBBasic apps (an API, a blog and a microblog) and a template for new DBBasic modules.
danq9
Add official module template for creating DBBasic packages
17cf88a
1 year, 1 month ago
History
profile.html · 1.2 KB · 45 lines
| 1 | {% extends "base.html" %} |
| 2 | |
| 3 | {% block title %}@{{ profile_user.username }} - Microblog{% endblock %} |
| 4 | |
| 5 | {% block nav %} |
| 6 | {% if current_user %} |
| 7 | <nav> |
| 8 | <a href="/">Home</a> |
| 9 | <a href="/profile/{{ current_user.username }}">Profile</a> |
| 10 | <a href="/logout">Logout</a> |
| 11 | </nav> |
| 12 | {% else %} |
| 13 | <nav> |
| 14 | <a href="/">Home</a> |
| 15 | <a href="/login">Login</a> |
| 16 | <a href="/register">Register</a> |
| 17 | </nav> |
| 18 | {% endif %} |
| 19 | {% endblock %} |
| 20 | |
| 21 | {% block content %} |
| 22 | <h2>@{{ profile_user.username }}</h2> |
| 23 | <p>{{ profile_user.fullname or 'No bio yet' }}</p> |
| 24 | <p><strong>{{ posts|length }}</strong> posts · <strong>{{ follower_count }}</strong> followers · <strong>{{ following_count }}</strong> following</p> |
| 25 | |
| 26 | {% if current_user and current_user.username != profile_user.username %} |
| 27 | {% if is_following %} |
| 28 | <a href="/unfollow/{{ profile_user.username }}" class="button">Unfollow</a> |
| 29 | {% else %} |
| 30 | <a href="/follow/{{ profile_user.username }}" class="button">Follow</a> |
| 31 | {% endif %} |
| 32 | {% endif %} |
| 33 | |
| 34 | <h3>Posts</h3> |
| 35 | {% if posts %} |
| 36 | {% for post in posts %} |
| 37 | <div class="post"> |
| 38 | <div class="post-meta">{{ post.created }}</div> |
| 39 | <div>{{ post.content }}</div> |
| 40 | </div> |
| 41 | {% endfor %} |
| 42 | {% else %} |
| 43 | <p>No posts yet</p> |
| 44 | {% endif %} |
| 45 | {% endblock %} |