]> git.parisson.com Git - teleforma.git/commitdiff
Only show "show more" when there are more than 1 video
authorYoan Le Clanche <yoanl@pilotsystems.net>
Tue, 25 Aug 2020 14:06:31 +0000 (16:06 +0200)
committerYoan Le Clanche <yoanl@pilotsystems.net>
Tue, 25 Aug 2020 14:06:31 +0000 (16:06 +0200)
teleforma/static/teleforma/js/application.js

index 9fdcd275b38ae23849c1bf63df54359679efa9f5..5b7aac20a2615e2f58164b8f7383f467a8b3b4ed 100644 (file)
@@ -44,8 +44,14 @@ $(document).ready(function(){
      // add a "read more" button after first video and hide others vidéos by default
      $('.course_content.content_video table.listing').each(function(){
         var $this = $(this);
+
+        // do nothing if not enough videos
+        var numberOfVideos = $this.find('tr').length
+        if(numberOfVideos <= 2)
+            return
+
         $this.find('tr:not(:first)').hide();
-        // debugger;
+        
         var colspan = $(this).find('tr:first td').length
         var buttonRow = $('<tr><td class="show_more_videos" colspan="'+colspan+'"></td></tr>')
         var button = $('<a class="component_icon button icon_next">Voir les vidéos plus anciennes</a>').bind('click', function(){