progress
authorRadek Czajka <rczajka@rczajka.pl>
Mon, 5 Feb 2024 08:20:44 +0000 (09:20 +0100)
committerRadek Czajka <rczajka@rczajka.pl>
Mon, 5 Feb 2024 08:20:44 +0000 (09:20 +0100)
src/catalogue/models/book.py
src/catalogue/templates/catalogue/book_text.html
src/wolnelektury/settings/static.py
src/wolnelektury/static/2022/styles/layout/_text.scss

index b2d960b..10e9d22 100644 (file)
@@ -331,6 +331,9 @@ class Book(models.Model):
             total += app_settings.GET_MP3_LENGTH(media.file.path)
         return int(total)
 
+    def get_time(self):
+        return round(self.xml_file.size / 1000 * 40)
+    
     def has_media(self, type_):
         if type_ in Book.formats:
             return bool(getattr(self, "%s_file" % type_))
index a494e24..421d439 100644 (file)
 
 
 {% block main %}
-  <div id="global-progress" class="l-container">
+  <div id="global-progress" class="l-container" data-t="{{ book.get_time }}">
     <div class="bar">
       <span class="piece" style="flex-grow: 100;">
         <span class="filled"></span>
       </span>
     </div>
     <div class="progress-text">
-      Szacowany czas do końca: <span class="progress-text-value">56 min</span>
+      Szacowany czas do końca: <span class="progress-text-value">-</span>
     </div>
   </div>
 
index dfc84d1..b3edb72 100644 (file)
@@ -76,6 +76,7 @@ PIPELINE = {
                 'js/book_text/references.js',
                 'js/book_text/settings.js',
                 'js/book_text/toc.js',
+                'js/book_text/progress.js',
 
                 'js/contrib/jquery.countdown.js', 'js/contrib/jquery.countdown-pl.js',
                 'js/contrib/jquery.countdown-de.js', 'js/contrib/jquery.countdown-uk.js',
index 20aa174..8959c62 100644 (file)
@@ -1,5 +1,4 @@
 #global-progress {
-    display: none;
     position: sticky;
     top: 0;
     background: white;