96 lines
		
	
	
		
			4.4 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			96 lines
		
	
	
		
			4.4 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
{% from 'common/macros.html' import timestamp %}
 | 
						|
{% extends 'base.html' %}
 | 
						|
{% block title %}{{ target_user.username }}'s profile{% endblock %}
 | 
						|
{% block content %}
 | 
						|
<div class="darkbg">
 | 
						|
  <h1 class="thread-title"><i>{{ target_user.username }}</i>'s profile</h1>
 | 
						|
  {% if active_user.id == target_user.id %}
 | 
						|
    <div class="user-actions">
 | 
						|
      <a class="linkbutton" href="{{ url_for("users.settings", username = active_user.username) }}">Settings</a>
 | 
						|
      <form method="post" action="{{ url_for("users.log_out") }}">
 | 
						|
        <input class="warn" type="submit" value="Log out">
 | 
						|
      </form>
 | 
						|
    </div>
 | 
						|
    {% if active_user.is_guest() %}
 | 
						|
      <h2>You are a guest. A Moderator needs to approve your account before you will be able to post.</h2>
 | 
						|
    {% endif %}
 | 
						|
  {% endif %}
 | 
						|
  {% if active_user and active_user.is_mod() and not target_user.is_system() %}
 | 
						|
    <h1 class="thread-title">Moderation controls</h1>
 | 
						|
    {% if target_user.is_guest() %}
 | 
						|
      <p>This user is a guest. They signed up on {{ timestamp(target_user['created_at']) }}</p>
 | 
						|
      <form class="modform" method="post" action="{{ url_for("users.confirm_user", user_id=target_user.id) }}">
 | 
						|
        <input type="submit" value="Confirm user">
 | 
						|
      </form>
 | 
						|
    {% else %}
 | 
						|
      <p>This user signed up on {{ timestamp(target_user['created_at']) }} and was confirmed on {{ timestamp(target_user['confirmed_on']) }}</p>
 | 
						|
      {% if (target_user.permission | int) < (active_user.permission | int) %}
 | 
						|
        <form class="modform" method="post" action="{{ url_for("users.guest_user", user_id=target_user.id) }}">
 | 
						|
          <input class="warn" type="submit" value="Demote user to guest (soft ban)">
 | 
						|
        </form>
 | 
						|
      {% endif %}
 | 
						|
      {% if active_user.is_admin() and not target_user.is_mod() %}
 | 
						|
        <form class="modform" method="post" action="{{ url_for("users.mod_user", user_id=target_user.id) }}">
 | 
						|
          <input class="warn" type="submit" value="Promote user to moderator">
 | 
						|
        </form>
 | 
						|
      {% elif target_user.is_mod() and (target_user.permission | int) < (active_user.permission | int) %}
 | 
						|
        <form class="modform" method="post" action="{{ url_for("users.demod_user", user_id=target_user.id) }}">
 | 
						|
          <input class="critical" type="submit" value="Demote user to regular user">
 | 
						|
        </form>
 | 
						|
      {% endif %}
 | 
						|
    {% endif %}
 | 
						|
  {% endif %}
 | 
						|
</div>
 | 
						|
<div class="user-info">
 | 
						|
  <div class="user-page-usercard">
 | 
						|
    <div class="usercard-inner">
 | 
						|
      <img class="avatar" src="{{ target_user.get_avatar_url() }}">
 | 
						|
      <strong class="big">{{ target_user.username }}</strong>
 | 
						|
      {% if target_user.status %}
 | 
						|
        <em class="user-status">{{ target_user.status }}</em>
 | 
						|
      {% endif %}
 | 
						|
      {% if target_user.signature_rendered %}
 | 
						|
        Signature:
 | 
						|
        <div>{{ target_user.signature_rendered | safe }}</div>
 | 
						|
      {% endif %}
 | 
						|
    </div>
 | 
						|
  </div>
 | 
						|
  <div class="user-page-stats">
 | 
						|
    {% with stats = target_user.get_post_stats() %}
 | 
						|
      <ul class="user-stats-list">
 | 
						|
        <li>Permission: {{ target_user.permission | permission_string }}</li>
 | 
						|
        <li>Posts created: {{ stats.post_count }}</li>
 | 
						|
        <li>Threads started: {{ stats.thread_count }}</li>
 | 
						|
        {% if stats.latest_thread_title %}
 | 
						|
          <li>Latest started thread: <a href="{{ url_for("threads.thread", slug = stats.latest_thread_slug) }}">{{ stats.latest_thread_title }}</a>
 | 
						|
        {% endif %}
 | 
						|
        {% if stats.inviter_username %}
 | 
						|
          <li>Invited by <a href="{{ url_for('users.page', username=stats.inviter_username) }}">{{ stats.inviter_username }}</a></li>
 | 
						|
        {% endif %}
 | 
						|
      </ul>
 | 
						|
    {% endwith %}
 | 
						|
    Latest posts:
 | 
						|
    {% with posts = target_user.get_latest_posts() %}
 | 
						|
      <div class="user-page-posts">
 | 
						|
        {% for post in posts %}
 | 
						|
          <div class="post-content-container">
 | 
						|
            <div class="post-info">
 | 
						|
              <a href="{{ url_for("threads.thread", slug=post.thread_slug, after=post.id) }}" title="permalink"><i>
 | 
						|
              {% if (post.edited_at | int) > (post.created_at | int) %}
 | 
						|
                Edited on {{ timestamp(post.edited_at) }}
 | 
						|
              {% else %}
 | 
						|
                Posted on {{ timestamp(post.edited_at) }}
 | 
						|
              {% endif %}
 | 
						|
              </i></a>
 | 
						|
            </div>
 | 
						|
            <div class="post-content user-page-post-preview">
 | 
						|
              <div class="post-inner wider">{{ post.content | safe }}</div>
 | 
						|
            </div>
 | 
						|
          </div>
 | 
						|
        {% endfor %}
 | 
						|
      </div>
 | 
						|
    {% endwith %}
 | 
						|
  </div>
 | 
						|
</div>
 | 
						|
{% endblock %}
 |