From 03dd8d61837d14dea54443b00cfd32e2b431d87a Mon Sep 17 00:00:00 2001 From: Eric Poirier Date: Thu, 18 Nov 2021 11:40:14 -0500 Subject: [PATCH 1/5] Update featured story carousel Signed-off-by: Eric Poirier --- content/_index.md | 9 +- js/main.js | 30 +- js/src/eclipseApi.js | 3 + js/templates/featured-story-custom.mustache | 24 ++ layouts/shortcodes/home/highlights.html | 43 +-- less/_components/homepage.less | 2 +- package.json | 2 +- static/documents/ecdtools.xml | 2 +- yarn.lock | 350 +++++++++++--------- 9 files changed, 267 insertions(+), 198 deletions(-) create mode 100644 js/templates/featured-story-custom.mustache diff --git a/content/_index.md b/content/_index.md index c361d1b..6ac4eb7 100644 --- a/content/_index.md +++ b/content/_index.md @@ -15,7 +15,14 @@ container: "container-fluid" header_wrapper_class: "featured-jumbotron-home" --- {{< home/powered-by >}} -{{< home/highlights >}} + +{{< home/highlights + id="featured-story-container" + publishTarget="ecd_tools" + templateId="featured-story-custom" + count="5" + templatePath="/js/templates/featured-story-custom.mustache" >}} + {{< home/projects highlight="ecd.openvsx:ecd.theia:ecd.jkube">}} {{< home/whats-new >}} {{< home/stats >}} diff --git a/js/main.js b/js/main.js index 9e4ba05..5077786 100644 --- a/js/main.js +++ b/js/main.js @@ -18,13 +18,27 @@ import './src/eclipseApi' import 'jquery-parallax.js/parallax.min.js' import './src/parallax' +const solsticeSliderHome = () => { + var owl = $('.solstice-slider-home'); + owl.owlCarousel({ + items:1, + autoplay:true, + autoplayTimeout:6000, + autoplayHoverPause:true, + autoplaySpeed: 2000, + loop:true, + }); +} -var owl = $('.solstice-slider-home'); -owl.owlCarousel({ - items:1, - autoplay:true, - autoplayTimeout:6000, - autoplayHoverPause:true, - autoplaySpeed: 2000, - loop:true, +$(window).on("load", function() { + solsticeSliderHome(); +}); + + + +$("body").on("shown.ef.featured_story", function(e) { + var owl = $('.solstice-slider-home'); + owl.trigger('destroy.owl.carousel'); + solsticeSliderHome(); + owl.trigger('refresh.owl.carousel'); }); \ No newline at end of file diff --git a/js/src/eclipseApi.js b/js/src/eclipseApi.js index 000cd64..e3bd2b1 100644 --- a/js/src/eclipseApi.js +++ b/js/src/eclipseApi.js @@ -19,6 +19,9 @@ const EclipseApi = (function($, document) { $("#event-list-container").eclipseFdnApi({ type: "filteredEvents" }); + $("#featured-story-custom").eclipseFdnApi({ + type: "featuredStory" + }); })(jQuery, document); export default EclipseApi; \ No newline at end of file diff --git a/js/templates/featured-story-custom.mustache b/js/templates/featured-story-custom.mustache new file mode 100644 index 0000000..35e4d5d --- /dev/null +++ b/js/templates/featured-story-custom.mustache @@ -0,0 +1,24 @@ +{{#featuredStory}} +
+
+
+
+
+ {{ #image }}{{ title }}{{ /image }} +
+
+
+
+

{{ title }}

+ {{ body }} +
+
+
+ +
+
+{{/featuredStory}} \ No newline at end of file diff --git a/layouts/shortcodes/home/highlights.html b/layouts/shortcodes/home/highlights.html index 485b211..264b6d3 100644 --- a/layouts/shortcodes/home/highlights.html +++ b/layouts/shortcodes/home/highlights.html @@ -10,33 +10,22 @@ SPDX-License-Identifier: EPL-2.0 --> +{{ $id := .Get "id" | default "featured-story-container" }} +{{ $templateId := .Get "templateId" }} +{{ $templatePath := .Get "templatePath" }} +{{ $publishTarget := .Get "publishTarget" }} +{{ $count := .Get "count" }} +{{ if and $templateId $templatePath }} + {{ .Page.Scratch.SetInMap "mustache-templates" $templateId $templatePath }} +{{ end }} -