mirror of
https://github.com/Derpy-Leggies/OnlyLegs.git
synced 2025-06-29 03:26:16 +00:00
Very temporary user profiles
This commit is contained in:
parent
c417457d31
commit
271eb728dd
3 changed files with 41 additions and 19 deletions
|
@ -202,7 +202,7 @@
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Author</td>
|
<td>Author</td>
|
||||||
<td><a href="{{ url_for('gallery.profile_id', user_id=image.author_id) }}" class="link">{{ image.author_username }}</a></td>
|
<td><a href="{{ url_for('gallery.profile', id=image.author_id) }}" class="link">{{ image.author_username }}</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Upload date</td>
|
<td>Upload date</td>
|
||||||
|
|
|
@ -2,17 +2,29 @@
|
||||||
|
|
||||||
{% block nav_profile %}selected{% endblock %}
|
{% block nav_profile %}selected{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="banner">
|
<div class="banner small">
|
||||||
<img src="{{ url_for('static', filename='') }}" onload="imgFade(this)" style="opacity:0;"/>
|
|
||||||
<span></span>
|
|
||||||
|
|
||||||
<div class="banner-content">
|
<div class="banner-content">
|
||||||
<h1>Profile</h1>
|
<h1>{{ user.username }}</h1>
|
||||||
<p>Hello {{ current_user.username }}</p>
|
<p>Member since <span class="time">{{ user.created_at }}</span></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% if images %}
|
||||||
<h1>User</h1>
|
<div class="gallery-grid">
|
||||||
<p>{{user_id}}</p>
|
{% for image in images %}
|
||||||
|
<a id="image-{{ image.id }}" class="gallery-item" href="{{ url_for('gallery.image', image_id=image.id) }}" style="background-color: rgb({{ image.image_colours.0.0 }}, {{ image.image_colours.0.1 }}, {{ image.image_colours.0.2 }})">
|
||||||
|
<div class="image-filter">
|
||||||
|
<p class="image-subtitle"></p>
|
||||||
|
<p class="image-title"><span class="time">{{ image.created_at }}</span></p>
|
||||||
|
</div>
|
||||||
|
<img fetchpriority="low" alt="{{ image.post_alt }}" data-src="{{ url_for('api.file', file_name=image.file_name) }}?r=thumb" onload="this.classList.add('loaded');" id="lazy-load"/>
|
||||||
|
</a>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
|
<div class="big-text">
|
||||||
|
<h1>*crickets chirping*</h1>
|
||||||
|
<p>There are no images here yet, upload some!</p>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ Onlylegs Gallery - Routing
|
||||||
"""
|
"""
|
||||||
from flask import Blueprint, render_template, url_for, request
|
from flask import Blueprint, render_template, url_for, request
|
||||||
from werkzeug.exceptions import abort
|
from werkzeug.exceptions import abort
|
||||||
|
from flask_login import current_user
|
||||||
|
|
||||||
from sqlalchemy.orm import sessionmaker
|
from sqlalchemy.orm import sessionmaker
|
||||||
from gallery import db
|
from gallery import db
|
||||||
|
@ -81,12 +82,21 @@ def profile():
|
||||||
"""
|
"""
|
||||||
Profile overview, shows all profiles on the onlylegs gallery
|
Profile overview, shows all profiles on the onlylegs gallery
|
||||||
"""
|
"""
|
||||||
return render_template('profile.html', user_id='gwa gwa')
|
user_id = request.args.get('id', default=None, type=int)
|
||||||
|
|
||||||
|
# If there is no userID set, check if the user is logged in and display their profile
|
||||||
|
if not user_id:
|
||||||
|
if current_user.is_authenticated:
|
||||||
|
user_id = current_user.id
|
||||||
|
else:
|
||||||
|
abort(404)
|
||||||
|
|
||||||
@blueprint.route('/profile/<int:user_id>')
|
# Get the user's data
|
||||||
def profile_id(user_id):
|
user = db_session.query(db.Users).filter(db.Users.id == user_id).first()
|
||||||
"""
|
|
||||||
Shows user ofa given id, displays their uploads and other info
|
if not user:
|
||||||
"""
|
abort(404, 'User not found :c')
|
||||||
return render_template('profile.html', user_id=user_id)
|
|
||||||
|
images = db_session.query(db.Posts).filter(db.Posts.author_id == user_id).all()
|
||||||
|
|
||||||
|
return render_template('profile.html', user=user, images=images)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue