You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
3.0 KiB

  1. {% extends "base.html" %}
  2. {% import "_macros.html" as macros %}
  3. {% block title %}Flasky - {{ user.username }}{% endblock %}
  4. {% block page_content %}
  5. <div class="page-header">
  6. <img class="img-rounded profile-thumbnail" src="{{ user.gravatar(size=256) }}">
  7. <div class="profile-header">
  8. <h1>{{ user.username }}</h1>
  9. {% if user.name or user.location %}
  10. <p>
  11. {% if user.name %}
  12. {{ user.name }}{% endif %}
  13. {% if user.location %}from
  14. <a href="https://maps.google.com/?q={{ user.location }}">
  15. {{ user.location }}</a>
  16. {% endif %}
  17. </p>
  18. {% endif %}
  19. {% if user.is_administrator %}
  20. <p><a href="mailto:{{ user.email }}">{{ user.email }}</a></p>
  21. {% endif %}
  22. {% if user.about_me %}
  23. <p>{{ user.about_me }}</p>
  24. {% endif %}
  25. <p>
  26. Member since {{ moment(user.member_since).format('L') }}.
  27. Last seen {{ moment(user.last_seen).fromNow() }}.
  28. <p>{{ user.posts.count() }} blog post{% if user.posts.count() > 1 %}s{% endif %}.</p>
  29. </p>
  30. <p>
  31. {% if current_user.can(Permission.FOLLOW) and user != current_user %}
  32. {% if not current_user.is_following(user) %}
  33. <a href="{{ url_for('.follow', username=user.username) }}"
  34. class="btn btn-primary">Follow</a>
  35. {% else %}
  36. <a href="{{ url_for('.unfollow', username=user.username) }}"
  37. class="btn btn-primary">Unfollow</a>
  38. {% endif %}
  39. {% endif %}
  40. <a href="{{ url_for('.followers', username=user.username) }}">
  41. Followers: <span class="badge">{{ user.followers.count() - 1 }}</span>
  42. </a>
  43. <a href="{{ url_for('.followed_by', username=user.username) }}">
  44. Following: <span class="badge">{{ user.followed.count() - 1 }}</span>
  45. </a>
  46. {% if current_user.is_authenticated and user != current_user and
  47. user.is_following(current_user) %}
  48. | <span class="label label-default">Follows you</span>
  49. {% endif %}
  50. </p>
  51. <p>
  52. {% if user == current_user %}
  53. <a class="btn btn-default" href="{{ url_for('.edit_profile') }}">Edit Profile</a>
  54. {% endif %}
  55. {% if current_user.is_administrator %}
  56. <a class="btn btn-danger" href="{{ url_for('.edit_profile_admin', id=user.id) }}">Edit Profile [Admin]</a>
  57. {% endif %}
  58. </p>
  59. </div>
  60. </div>
  61. <h3>Posts by {{ user.username }}</h3>
  62. {% include '_posts.html' %}
  63. {% if pagination %}
  64. <div class="pagination">
  65. {{ macros.pagination_widget(pagination, '.user', username=user.username) }}
  66. </div>
  67. {% endif %}
  68. {% endblock %}