From b6d41664d5ea8baaf717a61716877ebecfc019ab Mon Sep 17 00:00:00 2001 From: Yoan Le Clanche Date: Tue, 25 Aug 2020 16:06:31 +0200 Subject: [PATCH] Only show "show more" when there are more than 1 video --- teleforma/static/teleforma/js/application.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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(){ -- 2.39.5