Переглянути джерело

[templates] Remove sidebar, add dashboard links

Colin Powell 5 днів тому
батько
коміт
8a5486fb2c

+ 2 - 2
vrobbler/apps/webpages/models.py

@@ -67,10 +67,10 @@ class WebPage(ScrobblableMixin):
             self.save(update_fields=["extract"])
 
     def get_absolute_url(self):
-        return reverse("webpages:webpage-detail", kwargs={"slug": self.uuid})
+        return reverse("webpages:webpage_detail", kwargs={"slug": self.uuid})
 
     def get_read_url(self):
-        return reverse("webpages:webpage-read", kwargs={"slug": self.uuid})
+        return reverse("webpages:webpage_read", kwargs={"slug": self.uuid})
 
     @property
     def estimated_time_to_read_in_seconds(self):

+ 3 - 3
vrobbler/apps/webpages/urls.py

@@ -5,15 +5,15 @@ app_name = "webpages"
 
 
 urlpatterns = [
-    path("webpages/", views.WebPageListView.as_view(), name="webpage-list"),
+    path("webpages/", views.WebPageListView.as_view(), name="webpage_list"),
     path(
         "webpages/<slug:slug>/",
         views.WebPageDetailView.as_view(),
-        name="webpage-detail",
+        name="webpage_detail",
     ),
     path(
         "webpage/<slug:slug>/read/",
         views.WebPageReadView.as_view(),
-        name="webpage-read",
+        name="webpage_read",
     ),
 ]

+ 1 - 1
vrobbler/apps/webpages/views.py

@@ -32,7 +32,7 @@ class WebPageReadView(
         if latest_scrobble.played_to_completion:
             redirect(
                 reverse(
-                    "webpages:webpage-detail", kwargs={"slug": webpage.uuid}
+                    "webpages:webpage_detail", kwargs={"slug": webpage.uuid}
                 )
             )
         return super().get(*args, **kwargs)

+ 0 - 77
vrobbler/templates/base.html

@@ -208,85 +208,8 @@
                         {% endfor %}
                         </ul>
                         {% endif %}
-                        <ul class="nav flex-column">
-                            <li class="nav-item">
-                                <a class="nav-link active" aria-current="page" href="/">
-                                <span data-feather="music"></span>
-                                Dashboard
-                                </a>
-                            </li>
-                            {% if user.is_authenticated %}
-                            <li class="nav-item">
-                                <a class="nav-link" aria-current="page" href="/charts/">
-                                <span data-feather="bar-chart"></span>
-                                Charts
-                                </a>
-                            </li>
-                            <li class="nav-item">
-                                <a class="nav-link" aria-current="page" href="/locations/">
-                                <span data-feather="map"></span>
-                                Locations
-                                </a>
-                            </li>
-                            <li class="nav-item">
-                                <a class="nav-link" href="/long-plays/">
-                                <span data-feather="playv"></span>
-                                Long plays
-                                </a>
-                            </li>
-                            <li class="nav-item">
-                                <a class="nav-link" href="/moods/">
-                                <span data-feather="smiley"></span>
-                                Moods
-                                </a>
-                            </li>
-                            <li class="nav-item">
-                                <a class="nav-link" href="/books/">
-                                <span data-feather="book"></span>
-                                Books
-                                </a>
-                            </li>
-                            <li class="nav-item">
-                                <a class="nav-link" href="/video-games/">
-                                <span data-feather="video"></span>
-                                Video games
-                                </a>
-                            </li>
-                            <li class="nav-item">
-                                <a class="nav-link" href="/board-games/">
-                                <span data-feather="board"></span>
-                                Board games
-                                </a>
-                            </li>
-                            <li class="nav-item">
-                                <a class="nav-link" href="/trails/">
-                                <span data-feather="trail"></span>
-                                Trails
-                                </a>
-                            </li>
-                            <li class="nav-item">
-                                <a class="nav-link" href="/beers/">
-                                <span data-feather="beer"></span>
-                                Beers
-                                </a>
-                            </li>
-                            <li class="nav-item">
-                                <a class="nav-link" href="/imports/">
-                                <span data-feather="log"></span>
-                                Imports
-                                </a>
-                            </li>
-                            <li class="nav-item">
-                                <a class="nav-link" href="/admin/">
-                                <span data-feather="key"></span>
-                                Admin
-                                </a>
-                            </li>
-                            {% endif %}
-                        </ul>
                         {% block extra_nav %}
                         {% endblock %}
-                        <hr/>
 
                         {% if now_playing_list and user.is_authenticated %}
                         <ul>

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

@@ -45,7 +45,7 @@
                     {% for scrobble in scrobbles.all|dictsortreversed:"timestamp" %}
                     <tr>
                         <td><a href="{{scrobble.get_absolute_url}}">{{scrobble.local_timestamp}}</a></td>
-                        <td>{% if scrobble.long_play_complete == True %}Yes{% endif %}</td>
+                        <td>{% if scrobble.logdata.long_play_complete == True %}Yes{% endif %}</td>
                         <td>{% if scrobble.in_progress %}Now reading{% else %}{{scrobble.session_pages_read}}{% 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>

+ 33 - 11
vrobbler/templates/scrobbles/_last_scrobbles.html

@@ -7,62 +7,78 @@
 </div>
 <div class="row">
     <div class="col-md">
+        <h3><a href="{% url 'music:tracks_list' %}">Tracks</a></h3>
         {% if Track %}
-        <h2>Music</h2>
         {% with scrobbles=Track count=Track_count time=Track_time %}
         {% include "scrobbles/_scrobble_table.html" %}
         {% endwith %}
+        {% else %}
+        No tracks today
         {% endif %}
     </div>
     <div class="col-md">
 
+        <h3><a href="{% url 'tasks:task_list' %}">Tasks</a></h3>
         {% if Task %}
-        <h2>Latest tasks</h2>
         {% with scrobbles=Task count=Task_count time=Task_time %}
         {% include "scrobbles/_scrobble_table.html" %}
         {% endwith %}
+        {% else %}
+        <p>No tasks today</p>
         {% endif %}
 
+        <h3><a href="{% url 'videos:movie_list' %}">Videos</a></h3>
         {% if Video %}
-        <h2>Videos</h2>
         {% with scrobbles=Video count=Video_count time=Video_time %}
         {% include "scrobbles/_scrobble_table.html" %}
         {% endwith %}
+        {% else %}
+        <p>No videos today</p>
         {% endif %}
 
+        <h3><a href="{% url 'webpages:webpage_list' %}">Web pages</a></h3>
         {% if WebPage %}
-        <h4>Web pages</h4>
         {% with scrobbles=WebPage count=WebPage_count time=WebPage_time %}
         {% include "scrobbles/_scrobble_table.html" %}
         {% endwith %}
+        {% else%}
+        <p>No web page read today</p>
         {% endif %}
 
+        <h3><a href="{% url 'sports:event_list' %}">Sport events</a></h3>
         {% if SportEvent %}
-        <h2>Sports</h2>
         {% with scrobbles=SportEvent count=SportEvent_count time=SportEvent_time %}
         {% include "scrobbles/_scrobble_table.html" %}
         {% endwith %}
+        {% else %}
+        <p>No sports today</p>
         {% endif %}
 
+        <h3><a href="{% url 'podcasts:podcast_list' %}">Podcasts</a></h3>
         {% if PodcastEpisode %}
-        <h2>Latest podcasts</h2>
         {% with scrobbles=PodcastEpisode count=PodcastEpisode_count time=PodcastEpisode_time %}
         {% include "scrobbles/_scrobble_table.html" %}
         {% endwith %}
+        {% else %}
+        <p>No podcasts today</p>
         {% endif %}
 
+        <h3><a href="{% url "videogames:videogame_list" %}">Video games</a></h3>
         {% if VideoGame %}
-        <h4>Video games</h4>
         {% with scrobbles=VideoGame count=VideoGame_count time=VideoGame_time %}
         {% include "scrobbles/_scrobble_table.html" %}
         {% endwith %}
+        {% else %}
+        <p>No video games today</p>
         {% endif %}
 
+        <h3><a href="{% url "boardgames:boardgame_list" %}">Board games</a></h3>
         {% if BoardGame %}
-        <h4>Board games</h4>
         {% with scrobbles=BoardGame count=BoardGame_count time=BoardGame_time %}
         {% include "scrobbles/_scrobble_table.html" %}
         {% endwith %}
+        {% else %}
+        <p>No board games today</p>
         {% endif %}
 
         {% if Beer %}
@@ -72,25 +88,31 @@
         {% endwith %}
         {% endif %}
 
+        <h3><a href="{% url 'bricksets:brickset_list' %}">Brick sets</a></h3>
         {% if BrickSet %}
-        <h4>Brick sets</h4>
         {% with scrobbles=BrickSet count=BrickSet_count time=BrickSet_time %}
         {% include "scrobbles/_scrobble_table.html" %}
         {% endwith %}
+        {% else %}
+        <p>No brick sets today</p>
         {% endif %}
 
+        <h3><a href="{% url 'puzzles:puzzle_list' %}">Puzzles</aa></h3>
         {% if Puzzle %}
-        <h4>Puzzles</h4>
         {% with scrobbles=Puzzle count=Puzzle_count time=Puzzle_time %}
         {% include "scrobbles/_scrobble_table.html" %}
         {% endwith %}
+        {% else %}
+        <p>No puzzles today</p>
         {% endif %}
 
+        <h3><a href="{% url 'books:book_list' %}">Books</a></h3>
         {% if Book %}
-        <h4>Books</h4>
         {% with scrobbles=Book count=Book_count time=Book_time %}
         {% include "scrobbles/_scrobble_table.html" %}
         {% endwith %}
+        {% else %}
+        <p>No books today</p>
         {% endif %}
 
     </div>

+ 8 - 0
vrobbler/templates/scrobbles/scrobble_list.html

@@ -56,6 +56,14 @@
         <h1 class="h2">{% if date %}{{date|naturaltime}}{% else %}{{title}}{% endif %}</h1>
         <div class="btn-toolbar mb-2 mb-md-0">
             {% if user.is_authenticated %}
+            <div class="btn-group me-2">
+                <form action="/admin/" method="get">
+                    <button type="submit" class="btn btn-sm btn-outline-secondary">
+                        <span data-feather="key"></span>
+                        Admin
+                    </button>
+                </form>
+            </div>
             <div class="btn-group me-2">
                 {% if user.profile.lastfm_username and not user.profile.lastfm_auto_import %}
                 <form action="{% url 'scrobbles:lastfm-import' %}" method="get">

+ 2 - 2
vrobbler/templates/tasks/task_detail.html

@@ -54,7 +54,7 @@
                 <thead>
                     <tr>
                         <th scope="col">Date</th>
-                        <th scope="col">Description</th>
+                        <th scope="col">Title</th>
                         <th scope="col">Notes</th>
                         <th scope="col">Source</th>
                     </tr>
@@ -63,7 +63,7 @@
                     {% for scrobble in scrobbles.all|dictsortreversed:"timestamp" %}
                     <tr>
                         <td><a href="{{scrobble.get_absolute_url}}">{{scrobble.local_timestamp}}</a></td>
-                        <td><a href="{{scrobble.get_media_source_url}}">{{scrobble.logdata.description}}</a></td>
+                        <td><a href="{{scrobble.get_media_source_url}}">{{scrobble.logdata.title}}</a></td>
                         <td>{{scrobble.logdata.notes_as_str|safe}}</td>
                         <td>{{scrobble.source}}</td>
                     </tr>