diff --git a/js/api/jquery.eclipsefdn.api.js b/js/api/jquery.eclipsefdn.api.js index 9767698e891db9a731489a521843c696deda24c3..f7a2f3c14df13a825de4f1a3715da86080bd9b71 100644 --- a/js/api/jquery.eclipsefdn.api.js +++ b/js/api/jquery.eclipsefdn.api.js @@ -2376,7 +2376,13 @@ const eclipseFdnApi = (function ($, window, document, undefined) { } // make sure we have a promotion to display if (json.length > 0) { - writeFeaturedContainer(json[0], $container, type); + let count = $container.data('count'); + count = parseInt(count); + let items = json[0]; + if (count !== "undefined" && typeof count == 'number' && count >= 1) { + items = json.slice(0, count); + } + writeFeaturedContainer(items, $container, type); } else { var default_featured_story = { id: 'default-featured-story', @@ -2410,17 +2416,18 @@ const eclipseFdnApi = (function ($, window, document, undefined) { $container.data('template-id') || 'template-featured-' + type; var template = getMustacheTemplate( templateId, - '{{#content}}' + + '{{#featuredStory}}' + '

{{ title }}

' + '

{{ body }}

' + '' + - '{{/content}}' + '{{/featuredStory}}' ); var rendered = Mustache.render(template, { - content: item, + featuredStory: item, }); // set the container HTML to the rendered HTML $featuredContentContainer.html(rendered); + $featuredContentContainer.trigger('shown.ef.featured_story'); }; var convertDataToURLParameters = function (