Browse Source

Update long play templates, remove chart

Colin Powell 2 years ago
parent
commit
b307054453

+ 2 - 1
vrobbler/apps/scrobbles/views.py

@@ -118,7 +118,7 @@ class RecentScrobbleList(ListView):
                 "all": list(live_charts(**track)),
             }
 
-        data["weekly_data"] = week_of_scrobbles(user=user)
+        # data["weekly_data"] = week_of_scrobbles(user=user)
         data["counts"] = scrobble_counts(user)
         data["imdb_form"] = ScrobbleForm
         data["export_form"] = ExportScrobbleForm
@@ -135,6 +135,7 @@ class ScrobbleLongPlaysView(TemplateView):
 
     def get_context_data(self, **kwargs):
         context_data = super().get_context_data(**kwargs)
+        context_data["view"] = self.request.GET.get("view", "grid")
         context_data["in_progress"] = get_long_plays_in_progress(
             self.request.user
         )

+ 2 - 2
vrobbler/settings.py

@@ -234,11 +234,11 @@ USE_TZ = True
 # Static files (CSS, JavaScript, Images)
 # https://docs.djangoproject.com/en/3.1/howto/static-files/
 
-STATIC_URL = "/static/"
+STATIC_URL = os.getenv("VROBBLER_STATIC_URL", "/static/")
 STATIC_ROOT = os.getenv(
     "VROBBLER_STATIC_ROOT", os.path.join(PROJECT_ROOT, "static")
 )
-MEDIA_URL = "/media/"
+MEDIA_URL = os.getenv("VROBBLER_MEDIA_URL", "/media/")
 MEDIA_ROOT = os.getenv(
     "VROBBLER_MEDIA_ROOT", os.path.join(PROJECT_ROOT, "media")
 )

+ 1 - 3
vrobbler/templates/base.html

@@ -13,7 +13,6 @@
         <link href="{% static 'css/bootstrap.min.css'  %}" rel="stylesheet">
         <script src="https://cdn.jsdelivr.net/npm/popper.js@1.12.9/dist/umd/popper.min.js" crossorigin="anonymous"></script>
         <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
-        <script src="https://code.jquery.com/jquery-3.3.1.js" integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60=" crossorigin="anonymous"></script>
         <script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.10/clipboard.min.js"></script>
         <style type="text/css">
         dl {
@@ -282,7 +281,6 @@
             </div>
         </div>
 
-        {% block extra_js %}
-        {% endblock %}
+        {% block extra_js %}{% endblock %}
     </body>
 </html>

+ 9 - 1
vrobbler/templates/books/book_detail.html

@@ -27,7 +27,13 @@
 </div>
 <div class="row">
     <p>{{object.scrobble_set.count}} scrobbles</p>
-    <p><a href="">Start playing</a></p>
+    <p>
+        {% if object.scrobble_set.last.long_play_complete == True %}
+        <a href="">Read again</a>
+        {% else %}
+        <a href="">Resume reading</a>
+        {% endif %}
+    </p>
 </div>
 <div class="row">
     <div class="col-md">
@@ -37,6 +43,7 @@
                 <thead>
                     <tr>
                         <th scope="col">Date</th>
+                        <th scope="col">Completed</th>
                         <th scope="col">Duration</th>
                         <th scope="col">Authors</th>
                     </tr>
@@ -45,6 +52,7 @@
                     {% for scrobble in object.scrobble_set.all|dictsortreversed:"timestamp" %}
                     <tr>
                         <td>{{scrobble.timestamp}}</td>
+                        <td>{% if scrobble.long_play_complete == True %}Yes{% endif %}</td>
                         <td>{% if scrobble.in_progress %}Now playing{% else %}{{scrobble.long_play_session_seconds|natural_duration}}{% endif %}</td>
                         <td>{% for author in scrobble.book.authors.all %}<a href="{{author.get_absolute_url}}">{{author}}</a>{% if not forloop.last %}, {% endif %}{% endfor %}</td>
                     </tr>

+ 16 - 12
vrobbler/templates/scrobbles/long_plays_in_progress.html

@@ -20,13 +20,15 @@
     {% if view == 'grid' %}
     <div>
         {% for media in in_progress %}
-        {% if media.cover %}
-        <dl style="width: 130px; float: left; margin-right:10px;">
-            <dd><img src="{{media.cover.url}}" width=120 height=120 /></dd>
+        {% if media.hltb_cover %}
+        <dl style="width: 205px; float: left; margin-right:10px;">
+            <dd><a href="{{media.get_absolute_url}}"><img src="{{media.hltb_cover.url}}" width=200 /></a></dd>
+            <dt><a href="{{media.get_absolute_url}}">{{media.title}}</a></dt>
         </dl>
-        {% elif media.hltb_cover %}
-        <dl style="width: 130px; float: left; margin-right:10px;">
-            <dd><img src="{{media.htlb_cover.url}}" width=120 height=120 /></dd>
+        {% elif media.cover %}
+        <dl style="width: 205px; float: left; margin-right:10px;">
+            <dd><a href="{{media.get_absolute_url}}"><img src="{{media.cover.url}}" width=200 /></a></dd>
+            <dt><a href="{{media.get_absolute_url}}">{{media.title}}</a></dt>
         </dl>
         {% endif %}
         {% endfor %}
@@ -58,13 +60,15 @@
     {% if view == 'grid' %}
     <div>
         {% for media in completed %}
-        {% if media.cover %}
-        <dl style="width: 130px; float: left; margin-right:10px;">
-            <dd><img src="{{media.cover.url}}" width=120 height=120 /></dd>
+        {% if media.hltb_cover %}
+        <dl style="width: 200px; float: left; margin-right:10px;">
+            <dd><a href="{{media.get_absolute_url}}"><img src="{{media.hltb_cover.url}}" width=200 /></a></dd>
+            <dt><a href="{{media.get_absolute_url}}">{{media.title}}</a></dt>
         </dl>
-        {% elif media.hltb_cover %}
-        <dl style="width: 130px; float: left; margin-right:10px;">
-            <dd><img src="{{media.htlb_cover.url}}" width=120 height=120 /></dd>
+        {% elif media.cover %}
+        <dl style="width: 200px; float: left; margin-right:10px;">
+            <dd><a href="{{media.get_absolute_url}}"><img src="{{media.cover.url}}" width=200 /></a></dd>
+            <dt><a href="{{media.get_absolute_url}}">{{media.title}}</a></dt>
         </dl>
         {% endif %}
         {% endfor %}

+ 3 - 5
vrobbler/templates/scrobbles/scrobble_list.html

@@ -78,7 +78,9 @@
         </div>
     </div>
 
+    {% if show_chart %}
     <canvas class="my-4 w-100" id="myChart" width="900" height="150"></canvas>
+    {% endif %}
 
     <div class="container">
 
@@ -631,13 +633,9 @@
 {% endblock %}
 
 {% block extra_js %}
-<script>
-    $('#importModal').on('shown.bs.modal', function () { $('#importInput').trigger('focus') });
-    $('#exportModal').on('shown.bs.modal', function () { $('#exportInput').trigger('focus') });
-</script>
 
 <script src="https://cdn.jsdelivr.net/npm/feather-icons@4.28.0/dist/feather.min.js" integrity="sha384-uO3SXW5IuS1ZpFPKugNNWqTZRRglnUJK6UAZ/gxOX80nxEkN9NcGZTftn6RzhGWE" crossorigin="anonymous"></script><script src="https://cdn.jsdelivr.net/npm/chart.js@2.9.4/dist/Chart.min.js" integrity="sha384-zNy6FEbO50N+Cg5wap8IKA4M/ZnLJgzc6w2NqACZaK0u0FXfOWRRJOnQtpZun8ha" crossorigin="anonymous"></script>
-<script><!-- comment ------------------------------------------------->
+<script>
     /* globals Chart:false, feather:false */
     (function () {
     'use strict'

+ 11 - 3
vrobbler/templates/videogames/videogame_detail.html

@@ -10,8 +10,8 @@
 <div class="row">
 
     {% if object.hltb_cover%}
-    <p style="float:left; width:402px; padding:0; border: 1px solid #ccc">
-        <img src="{{object.hltb_cover.url}}" width=400 />
+    <p style="float:left; width:202px; padding:0; border: 1px solid #ccc">
+        <img src="{{object.hltb_cover.url}}" width=200 />
     </p>
     {% endif %}
     <div style="float:left; width:600px; margin-left:10px; ">
@@ -28,7 +28,13 @@
 <div class="row">
     <p>{{object.scrobble_set.count}} scrobbles</p>
     <p>{{object.scrobble_set.last.playback_position|natural_duration}}{% if object.scrobble_set.last.long_play_complete %} and completed{% else %} spent playing{% endif %}</p>
-    <p><a href="">Resume long play</a></p>
+    <p>
+        {% if object.scrobble_set.last.long_play_complete == True %}
+        <a href="">Play again</a>
+        {% else %}
+        <a href="">Resume playing</a>
+        {% endif %}
+    </p>
 </div>
 <div class="row">
     <div class="col-md">
@@ -38,6 +44,7 @@
             <thead>
                 <tr>
                     <th scope="col">Date</th>
+                    <th scope="col">Completed</th>
                     <th scope="col">Duration</th>
                     <th scope="col">Platforms</th>
                 </tr>
@@ -46,6 +53,7 @@
                 {% for scrobble in object.scrobble_set.all|dictsortreversed:"timestamp" %}
                 <tr>
                     <td>{{scrobble.timestamp}}</td>
+                        <td>{% if scrobble.long_play_complete == True %}Yes{% endif %}</td>
                     <td>{% if scrobble.in_progress %}Now playing{% else %}{{scrobble.long_play_session_seconds|natural_duration}}{% endif %}</td>
                     <td>{% for platform in scrobble.video_game.platforms.all %}<a href="{{platform.get_absolute_url}}">{{platform}}</a>{% if not forloop.last %}, {% endif %}{% endfor %}</td>
                 </tr>