mirror of
https://github.com/Derpy-Leggies/OnlyLegs.git
synced 2024-12-29 10:56:10 +00:00
Add options to profile
Upload profile picture Change username
This commit is contained in:
parent
8334b5cf98
commit
a1d0ac9f90
|
@ -88,7 +88,7 @@ class User(db.Model, UserMixin): # pylint: disable=too-few-public-methods, C010
|
||||||
alt_id = db.Column(db.String, unique=True, nullable=False, default=str(uuid4()))
|
alt_id = db.Column(db.String, unique=True, nullable=False, default=str(uuid4()))
|
||||||
|
|
||||||
picture = db.Column(db.String, default=None)
|
picture = db.Column(db.String, default=None)
|
||||||
colour = db.Column(db.String, default=None)
|
colour = db.Column(db.PickleType, default=None)
|
||||||
banner = db.Column(db.String, default=None)
|
banner = db.Column(db.String, default=None)
|
||||||
|
|
||||||
username = db.Column(db.String, unique=True, nullable=False)
|
username = db.Column(db.String, unique=True, nullable=False)
|
||||||
|
|
|
@ -1,5 +1,21 @@
|
||||||
{% extends 'layout.html' %}
|
{% extends 'layout.html' %}
|
||||||
|
{% block head %}
|
||||||
|
{% if user.picture %}
|
||||||
|
<meta property="og:image" content="{{ url_for('api.media', path='pfp/' + user.picture) }}"/>
|
||||||
|
{% endif %}
|
||||||
|
{% if user.colour %}
|
||||||
|
<meta name="theme-color" content="rgb({{ user.colour.0 }}, {{ user.colour.1 }}, {{ user.colour.2 }})"/>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.banner-picture {
|
||||||
|
background-color: rgb({{ user.colour.0 }}, {{ user.colour.1 }}, {{ user.colour.2 }}) !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{% endblock %}
|
||||||
{% block nav_profile %}selected{% endblock %}
|
{% block nav_profile %}selected{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="banner">
|
<div class="banner">
|
||||||
|
@ -11,7 +27,7 @@
|
||||||
<span class="banner-filter"></span>
|
<span class="banner-filter"></span>
|
||||||
<div class="banner-content">
|
<div class="banner-content">
|
||||||
{% if user.picture %}
|
{% if user.picture %}
|
||||||
<img class="banner-picture" src="{{ url_for('static', filename='icon.png') }}" alt="Profile picture" onload="imgFade(this)" style="opacity:0;"/>
|
<img class="banner-picture" src="{{ url_for('api.media', path='pfp/' + user.picture) }}" alt="Profile picture" onload="imgFade(this)" style="opacity:0;"/>
|
||||||
{% else %}
|
{% else %}
|
||||||
<img class="banner-picture" src="{{ url_for('static', filename='icon.png') }}" alt="Profile picture" onload="imgFade(this)" style="opacity:0;"/>
|
<img class="banner-picture" src="{{ url_for('static', filename='icon.png') }}" alt="Profile picture" onload="imgFade(this)" style="opacity:0;"/>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -37,7 +53,7 @@
|
||||||
<div class="image-filter">
|
<div class="image-filter">
|
||||||
<p class="image-title"><span class="time">{{ image.created_at }}</span></p>
|
<p class="image-title"><span class="time">{{ image.created_at }}</span></p>
|
||||||
</div>
|
</div>
|
||||||
<img fetchpriority="low" alt="{{ image.alt }}" data-src="{{ url_for('api.file', file_name=image.filename) }}?r=thumb" onload="this.classList.add('loaded');" id="lazy-load"/>
|
<img fetchpriority="low" alt="{{ image.alt }}" data-src="{{ url_for('api.media', path='uploads/' + image.filename) }}?r=thumb" onload="this.classList.add('loaded');" id="lazy-load"/>
|
||||||
</a>
|
</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -17,4 +17,14 @@
|
||||||
<div class="settings-content">
|
<div class="settings-content">
|
||||||
<h1>Gwa Gwa</h1>
|
<h1>Gwa Gwa</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<form method="POST" action="{{ url_for('api.user_picture', user_id=current_user.id) }}" enctype="multipart/form-data">
|
||||||
|
<input type="file" name="file">
|
||||||
|
<input type="submit" value="Upload">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<form method="POST" action="{{ url_for('api.user_username', user_id=current_user.id) }}" enctype="multipart/form-data">
|
||||||
|
<input type="text" name="name">
|
||||||
|
<input type="submit" value="Upload">
|
||||||
|
</form>
|
||||||
{% endblock %}
|
{% endblock %}
|
Loading…
Reference in a new issue