From: Yoan Le Clanche Date: Tue, 25 Aug 2020 14:06:31 +0000 (+0200) Subject: Only show "show more" when there are more than 1 video X-Git-Tag: 1.4.3~46 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=b6d41664d5ea8baaf717a61716877ebecfc019ab;p=teleforma.git Only show "show more" when there are more than 1 video --- diff --git a/teleforma/static/teleforma/js/application.js b/teleforma/static/teleforma/js/application.js index 9fdcd275..5b7aac20 100644 --- a/teleforma/static/teleforma/js/application.js +++ b/teleforma/static/teleforma/js/application.js @@ -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 = $('') var button = $('Voir les vidéos plus anciennes').bind('click', function(){