Revert "Revert "Bug 570555 - Update script to fetch featured committer and project""
Change-Id: I000da9b23102ef1d0be929c39b76187a5b84d760
This reverts commit f4ad720360dffb7728c836e5916df38758efc79a.
diff --git a/js/data.json b/js/data.json
deleted file mode 100644
index 7801e96..0000000
--- a/js/data.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "committers": [
- {
- "name": "Philip Langer",
- "Committer to": "Eclipse EMF.cloud, Eclipse GLSP, Eclipse Sprotty, Eclipse EMF Compare, Eclipse EMFStore, Eclipse Papyrus-RT, Eclipse Papyrus",
- "Committer since": "2016",
- "image": "/home/images/featured_contents/featured_committers/philip.jpg",
- "url": "/community/eclipse_newsletter/2021/april/4.php"
- }
- ],
-
- "projects": [
- {
- "name": "Eclipse SUMO",
- "description": "Eclipse SUMO is an open source, highly portable, microscopic and continuous multi-modal traffic simulation package designed to handle large networks.",
- "image": "/home/images/featured_contents/featured_projects/sumo.png",
- "url": "https://www.eclipse.org/sumo/"
- }
- ]
-}
\ No newline at end of file
diff --git a/js/featured-projects-committer.js b/js/featured-projects-committer.js
index 3e399c9..998b2b1 100644
--- a/js/featured-projects-committer.js
+++ b/js/featured-projects-committer.js
@@ -1,38 +1,66 @@
(function($, document) {
- //your code here;
- $.getJSON("/home/js/data.json", function(data){
- const committers = data.committers
- const projects = data.projects
- for (let i=0; i<committers.length; i++) {
- var image = "<div class='col-xs-8 padding-0 eclipsefdn-user-display-circle'><img class='img img-responsive' src=" + committers[i].image + "></div>"
+ // Set the Newsletter Edition
+ var edition = "2021-05";
+
+ // Set the Url
+ var url = "https://newsroom.eclipse.org/api/edition?parameters[date]=" + edition;
+
+ $.ajax({
+ url: url,
+ type: 'GET',
+ dataType: 'json',
+ success: function(data, status) {
+ const committer = data.editions[0].featured_committer
+ const project = data.editions[0].featured_project
+
+ var image = "<div class='col-xs-8 padding-0 eclipsefdn-user-display-circle'><img class='img img-responsive' src=" + committer.picture + "></div>"
var content = " <div class='col-xs-16'>" +
- "<h3 class='h4'><strong>" + committers[i].name + "</strong></h3>" +
- "<div class=\"match-height-item margin-bottom-5\" data-mh=\"featured-content\"><p><strong>Committer to: </strong>" + committers[i]["Committer to"] + "</p>" +
- "<p><strong>Committer since: </strong>" + committers[i]["Committer since"] + "</p></div>" +
- "<a class='btn btn-primary' href='" + committers[i].url + "' title='Subscribe to our RSS-feed'> Read more </a>" +
+ "<h3 class='h4'><strong>" + committer.name + "</strong></h3>" +
+ "<div class=\"featured-blocks-match-height margin-bottom-5\" data-mh=\"featured-content\"><p>" + committer.body + "</p>" +
+ "</div>" +
+ "<a class='btn btn-primary' href='" + committer.url + "' title='Subscribe to our RSS-feed'> Read more </a>" +
"</div>"
-
- var result = "<div class='item clearfix block-summary-item match-height-item-by-row'>" + image + content + "</div>"
-
+
+ var result = "<div class='item clearfix block-summary-item featured-blocks-match-height-by-row'>" + image + content + "</div>"
+
$('#commiters-container').append(result)
+
+ var project_id = project.id;
+ var project_id = project_id.replace(".", "_");
+
+ $.ajax({
+ url: "https://projects.eclipse.org/api/projects/" + project_id,
+ type: 'GET',
+ dataType: 'json',
+ success: function (data, status) {
+
+ var image = "<div class='col-xs-8 padding-0'><img class='img img-responsive' src=" + data[0].logo + "></div>"
+ var content = " <div class='col-xs-16'>" +
+ "<h3 class='h4'><strong>" + data[0].name + "</strong></h3>" +
+ "<div class=\"featured-blocks-match-height margin-bottom-5\" data-mh=\"featured-content\"><p>" + project.body + "</p></div>" +
+ "<a class='btn btn-primary' href='" + project.url + "' title='Subscribe to our RSS-feed'> Read more </a>" +
+ "</div>"
+
+ var result = "<div class='item clearfix block-summary-item featured-blocks-match-height-by-row'>" + image + content + "</div>"
+
+ $('#projects-container').append(result);
+ }
+ });
+
+ $('.featured-blocks-match-height-by-row').matchHeight();
+ $('.featured-blocks-match-height').matchHeight({
+ byRow: false
+ });
+ },
+ error: function() {
+ console.log("An error has occurred.");
}
-
- for (let i=0; i<projects.length; i++) {
- var image = "<div class='col-xs-8 padding-0'><img class='img img-responsive' src=" + projects[i].image + "></div>"
- var content = " <div class='col-xs-16'>" +
- "<h3 class='h4'><strong>" + projects[i].name + "</strong></h3>" +
- "<div class=\"match-height-item margin-bottom-5\" data-mh=\"featured-content\"><p>" + projects[i].description + "</p></div>" +
- "<a class='btn btn-primary' href='" + projects[i].url + "' title='Subscribe to our RSS-feed'> Read more </a>" +
- "</div>"
-
- var result = "<div class='item clearfix block-summary-item match-height-item-by-row'>" + image + content + "</div>"
-
- $('#projects-container').append(result)
- }
-
- }).fail(function(){
- console.log("An error has occurred.");
});
+
- })(jQuery, document);
\ No newline at end of file
+ })(jQuery, document);
+
+
+
+
\ No newline at end of file