From aa7939cbc71169578654396be8c5a0d959961a14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93scar=20Garc=C3=ADa=20Amor?= Date: Mon, 10 Jul 2017 14:25:19 +0200 Subject: [PATCH] WIP: Add some style to web frontend --- supysonic/frontend/playlist.py | 6 ++- supysonic/static/css/supysonic.css | 3 +- supysonic/templates/addfolder.html | 4 +- supysonic/templates/playlist.html | 41 +++++++++++++------ supysonic/templates/playlists.html | 63 ++++++++++++++++++++---------- supysonic/templates/users.html | 2 +- 6 files changed, 79 insertions(+), 40 deletions(-) diff --git a/supysonic/frontend/playlist.py b/supysonic/frontend/playlist.py index 1e6d950..6a60c12 100644 --- a/supysonic/frontend/playlist.py +++ b/supysonic/frontend/playlist.py @@ -22,11 +22,13 @@ from flask import request, session, flash, render_template, redirect, url_for import uuid from supysonic.web import app, store from supysonic.db import Playlist +from supysonic.managers.user import UserManager @app.route('/playlist') def playlist_index(): return render_template('playlists.html', mine = store.find(Playlist, Playlist.user_id == uuid.UUID(session.get('userid'))), - others = store.find(Playlist, Playlist.user_id != uuid.UUID(session.get('userid')))) + others = store.find(Playlist, Playlist.user_id != uuid.UUID(session.get('userid'))), + admin = UserManager.get(store, session.get('userid'))[1].admin) @app.route('/playlist/') def playlist_details(uid): @@ -41,7 +43,7 @@ def playlist_details(uid): flash('Unknown playlist') return redirect(url_for('playlist_index')) - return render_template('playlist.html', playlist = playlist) + return render_template('playlist.html', playlist = playlist, admin = UserManager.get(store, session.get('userid'))[1].admin) @app.route('/playlist/', methods = [ 'POST' ]) def playlist_update(uid): diff --git a/supysonic/static/css/supysonic.css b/supysonic/static/css/supysonic.css index 27c5101..fc28a08 100644 --- a/supysonic/static/css/supysonic.css +++ b/supysonic/static/css/supysonic.css @@ -30,7 +30,8 @@ body { margin-bottom: 0; } -#clients td { +#clients td, +#playlist td { vertical-align: middle; } diff --git a/supysonic/templates/addfolder.html b/supysonic/templates/addfolder.html index b251670..c391028 100644 --- a/supysonic/templates/addfolder.html +++ b/supysonic/templates/addfolder.html @@ -31,14 +31,14 @@
- +
- +
diff --git a/supysonic/templates/playlist.html b/supysonic/templates/playlist.html index 307dd1e..72cf381 100644 --- a/supysonic/templates/playlist.html +++ b/supysonic/templates/playlist.html @@ -18,27 +18,42 @@ along with this program. If not, see . -#} {% extends "layout.html" %} +{% block navbar_playlists %} +
  • Playlists (current)
  • +{% endblock %} + {% block body %} -

    Playlist "{{ playlist.name }}"

    + {% if playlist.user_id|str == session.get('userid') %}

    Edit

    - - - - - - - +
    NamePublic
    + + + + + + + + + +
    NamePublic
    {% endif %}

    Tracks

    - - - {% for t in playlist.tracks %} - - {% endfor %} +
    ArtistTitleAlbumLength
    {{ t.album.artist.name }}{{ t.title }}{{ t.album.name }}{{ t.duration_str() }}
    + + + + + {% for t in playlist.tracks %} + + {% endfor %} +
    ArtistTitleAlbumLength
    {{ t.album.artist.name }}{{ t.title }}{{ t.album.name }}{{ t.duration_str() }}
    {% endblock %} diff --git a/supysonic/templates/playlists.html b/supysonic/templates/playlists.html index d08e380..1d7f63e 100644 --- a/supysonic/templates/playlists.html +++ b/supysonic/templates/playlists.html @@ -18,34 +18,55 @@ along with this program. If not, see . -#} {% extends "layout.html" %} +{% block navbar_playlists %} +
  • Playlists (current)
  • +{% endblock %} + {% block body %} -

    My playlists

    + {% if not mine.count() %}

    You don't have any playlists.

    {% else %} - - - {% for p in mine %} - - - - - - - {% endfor %} +
    PlaylistTracksPublic
    {{ p.name }}{{ p.tracks.count() }}X
    + + + + + {% for p in mine %} + + + + + + + {% endfor %} +
    PlaylistTracksPublic
    {{ p.name }}{{ p.tracks.count() }}{% if p.public %}{% else %}{% endif %} +
    {% endif %} {% if others.count() %} -

    Others' playslits

    - - - {% for p in others %} - - - - - - {% endfor %} + +
    PlaylistOwnerTracks
    {{ p.name }}{{ p.user.name }}{{ p.tracks.count() }}
    + + + + + {% for p in others %} + + + + + + {% endfor %} +
    PlaylistOwnerTracks
    {{ p.name }}{{ p.user.name }}{{ p.tracks.count() }}
    {% endif %} {% endblock %} diff --git a/supysonic/templates/users.html b/supysonic/templates/users.html index 6d1fe7a..8b8f349 100644 --- a/supysonic/templates/users.html +++ b/supysonic/templates/users.html @@ -35,7 +35,7 @@ {% for user in users %} {{ user.name }}{{ user.mail }}{{ user.admin }}{{ user.last_play_date }} - + {% endfor %}