profile.html 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. {% extends "cranefly/layout.html" %}
  2. {% import "cranefly/macros.html" as macros with context %}
  3. {% block title %}{{ macros.page_title(profile.username) }}{% endblock %}
  4. {% block container %}
  5. <div class="user-profile{% if profile.get_style() %} user-profile-{{ profile.get_style() }}{% endif %}">
  6. <div class="page-header header-primary user-profile-header">
  7. <div class="container">
  8. {{ messages_list(messages) }}
  9. <div class="header-row">
  10. {% if profile.id == user.id and not user.avatar_ban %}
  11. <a href="{{ url('usercp_avatar') }}"><img src="{{ profile.get_avatar() }}" class="header-avatar tooltip-right" title="{% trans %}Click to jump to your Avatar Settings{% endtrans %}"></a>
  12. {% else %}
  13. <img src="{{ profile.get_avatar() }}" class="header-avatar">
  14. {% endif %}
  15. <div class="header-side">
  16. <h1>{{ profile.username }} <small>{% if profile.title or profile.rank.title -%}
  17. <strong>{% if profile.title %}{{ _(profile.title) }}{% elif profile.rank.title %}{{ _(profile.rank.title) }}{% endif %}</strong>; {% endif %}
  18. {%- if online and (not hidden or acl.users.can_see_hidden_users()) -%}
  19. {%- if profile.hide_activity -%}
  20. {% trans %}Online, hidden{% endtrans %}
  21. {%- else -%}
  22. {% trans %}Online{% endtrans %}
  23. {%- endif %}
  24. {%- else -%}
  25. {% trans %}Offline{% endtrans %}
  26. {%- endif -%}, {% if not hidden or acl.users.can_see_hidden_users() -%}
  27. {%- if online -%}
  28. {% trans last_click=online.last|reltimesince|low %}last click {{ last_click }}{% endtrans %}
  29. {%- elif profile.last_date -%}
  30. {% trans last_visit=profile.last_date|reltimesince|low %}last seen {{ last_visit }}{% endtrans %}
  31. {%- else -%}
  32. {% trans %}never visited{% endtrans %}
  33. {%- endif -%}
  34. {%- else -%}
  35. {% trans %}hiding activity{% endtrans %}
  36. {%- endif %}</small></h1>
  37. <ul class="nav nav-tabs header-tabs">
  38. {% for link in tabs %}
  39. <li{% if link.active %} class="active"{% endif %}>
  40. <a href="{{ url(link.route, user=profile.pk, username=profile.username_slug) }}">{{ link.name }}</a>
  41. </li>
  42. {% endfor %}
  43. {% if user.is_authenticated() and user.pk != profile.pk %}
  44. <li class="pull-right">
  45. <form class="form-inline" action="{% if ignores %}{{ url('unignore_user', user=profile.id) }}{% else %}{{ url('ignore_user', user=profile.id) }}{% endif %}" method="post">
  46. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  47. <input type="hidden" name="fallback" value="{{ fallback }}">
  48. <button type="submit" class="btn btn-icon tooltip-top{% if ignores %} btn-inverse{% endif %}" title="{% if ignores %}{% trans user=profile.username %}Remove {{ user }} from ignored{% endtrans %}{% else %}{% trans user=profile.username %}Add {{ user }} to ignored{% endtrans %}{% endif %}">
  49. <i class="icon-ban-circle"></i>
  50. </button>
  51. </form>
  52. </li>
  53. <li class="pull-right">
  54. <form class="form-inline" action="{% if follows %}{{ url('unfollow_user', user=profile.id) }}{% else %}{{ url('follow_user', user=profile.id) }}{% endif %}" method="post">
  55. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  56. <input type="hidden" name="fallback" value="{{ fallback }}">
  57. <button type="submit" class="btn btn-icon tooltip-top{% if follows %} btn-success{% endif %}" title="{% if follows %}{% trans user=profile.username %}Stop following {{ user }}{% endtrans %}{% else %}{% trans user=profile.username %}Start following {{ user }}{% endtrans %}{% endif %}">
  58. <i class="icon-heart"></i>
  59. </button>
  60. </form>
  61. </li>
  62. {% if acl.private_threads.can_start() %}
  63. <li class="pull-right">
  64. <a href="{{ url('private_thread_start_with', username=profile.username_slug, user=profile.pk) }}" class="btn btn-icon tooltip-top" title="{% trans user=profile.username %}Start private thread with {{ user }}{% endtrans %}"><i class="icon-envelope"></i></a>
  65. </li>
  66. {% endif %}
  67. <li class="pull-right">
  68. <form class="form-inline form-destroy-user" action="{{ url('destroy_user', username=profile.username_slug, user=profile.pk) }}" method="post">
  69. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  70. <button type="submit" class="btn btn-icon tooltip-top" title="{% trans user=profile.username %}Destroy {{ user }}'s user account, deleting it, its threads and soft-deleting it's replies in other threads.{% endtrans %}">
  71. <i class="icon-remove"></i>
  72. </button>
  73. </form>
  74. </li>
  75. {% endif %}
  76. </ul>
  77. </div>
  78. </div>
  79. </div>
  80. </div>
  81. <div class="container container-primary">
  82. {% block tab %}{% endblock %}
  83. </div>
  84. </div>
  85. {% endblock %}
  86. {% macro draw_graph() %}
  87. <script src="{{ STATIC_URL }}cranefly/js/d3.min.js"></script>
  88. <script type="text/javascript">
  89. var data = [{{ (',').join(graph) }}];
  90. {% if graph_max %}
  91. var max = {{ graph_max }};
  92. {% else %}
  93. var max = 1;
  94. {% endif %}
  95. var barWidth = 8;
  96. var width = (barWidth + 2) * data.length;
  97. var height = 40;
  98. // add the canvas to the DOM
  99. var barDemo = d3.select("#user-graph")
  100. .append("svg")
  101. .attr("width", "100%")
  102. .attr("height", 40)
  103. .attr("preserveAspectRatio", 'none')
  104. .attr("viewBox", "0 0 " + width + " " + height);
  105. barDemo.selectAll("rect")
  106. .data(data)
  107. .enter()
  108. .append("rect")
  109. .attr("shape-rendering", 'crispEdges')
  110. .attr("x", function(datum, index) { return (2 + barWidth) * index; })
  111. .attr("y", function(datum) { return height - ((datum / max) * height) - 2; })
  112. .attr("height", function(datum) { return ((datum / max) * (height)) + 2; })
  113. .attr("width", barWidth)
  114. .attr("fill", "#DDD");
  115. </script>
  116. {% endmacro %}
  117. {% block javascripts %}
  118. {{ super() }}
  119. <script type="text/javascript">
  120. $('.form-destroy-user').submit(function() {
  121. var decision = confirm("{% trans %}Are you sure you want to destroy this member's account? This action is not reversible!{% endtrans %}");
  122. return decision;
  123. });
  124. </script>
  125. {% endblock %}