user_accolor=profile_data["accolor"],
playlists=plist_data,
songs=songs,
+ user_has_pfp=(get_user_images_path(profile_userid)/"pfp.jpg").exists(),
song_list=render_template("song-list.html", songs=songs, is_profile_song_list=True))
@app.post("/edit-profile")
return song_comments
+ def user_has_pfp(self):
+ return (get_user_images_path(self.userid)/"pfp.jpg").exists()
+
@classmethod
def by_id(cls, songid):
songs = cls._from_db("select * from songs inner join users on songs.userid = users.userid where songid = ?", [songid])
// Get page content from JSON response
var data = await response.json();
- console.log(data);
document.getElementById("main").innerHTML = data.body;
document.title = data.title;
<h1 class="profile-name">{{ name }}</h1>
<!-- Profile Picture -->
+{% if user_has_pfp %}
<div class="big-pfp-container">
<img src="/pfp/{{ userid }}" onerror="hidePfp(this)" class="big-pfp">
</div>
+{% endif %}
<script>
function hidePfp(pfp) {
<div class="song" data-song="{{ song.json() }}">
<div class="song-main">
<!-- Profile Picture -->
+ {% if song.user_has_pfp() %}
<img class="small-pfp" src="/pfp/{{ song.userid }}" onerror="this.style.display = 'none'" />
+ {% endif %}
<div class="song-info">
NOW
- AJAX pages so songs can play during navigation
- - Nav bar
- Forms
- Back (history stack)
- Other on-site links (songs, profiles, tags, etc.)
- Update page colors
- - PFP on profile when missing PFP
- - Signout doesn't refresh navbar (should show sign in link)
- Break up main.py, test_offline.py
- Pinned profile playlists