From bf4a90cafbcdc4025bbb92462a84fcf30bca37ae Mon Sep 17 00:00:00 2001 From: Yoan Le Clanche Date: Tue, 25 Aug 2020 10:17:37 +0200 Subject: [PATCH] Display only first video on course page, with a button to show more. --- teleforma/static/teleforma/css/teleforma.css | 6 ++++++ teleforma/static/teleforma/js/application.js | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/teleforma/static/teleforma/css/teleforma.css b/teleforma/static/teleforma/css/teleforma.css index 1b9ff494..f9b6a063 100644 --- a/teleforma/static/teleforma/css/teleforma.css +++ b/teleforma/static/teleforma/css/teleforma.css @@ -1157,10 +1157,16 @@ a.image-link { padding:4px 8px 4px 26px; /*top right bottom left - last value depends on the icon size (default=16)*/ } +table.listing tbody td.show_more_videos { + text-align:center; + padding: 1.5em 0em; +} + .button, .button:visited, .button:hover{ font-weight: bold; border: 1px solid #e1e1e1; white-space:nowrap; + cursor: pointer; /* border-top: 1px solid #e1e1e1 !important; border-left: 1px solid #e1e1e1 !important; border-right: 1px solid #e1e1e1 !important; diff --git a/teleforma/static/teleforma/js/application.js b/teleforma/static/teleforma/js/application.js index c4e78678..9fdcd275 100644 --- a/teleforma/static/teleforma/js/application.js +++ b/teleforma/static/teleforma/js/application.js @@ -40,4 +40,21 @@ $(document).ready(function(){ }) } $('.tabs').tabs(); + + // 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); + $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(){ + $this.find('tr:not(:first)').show('fast'); + buttonRow.hide(); + }); + // $this.find('tr:first').appendAfter(buttonRow); + $this.find('tr:not(:first)').hide(); + buttonRow.find('td').append(button) + buttonRow.insertAfter($this.find('tr:first')) + }) }); \ No newline at end of file -- 2.39.5