Revert "Bug 570555 - Update script to fetch featured committer and project"
This reverts commit 3e7ead839777c33c292ec12fa4b5cc403a2be26a.
diff --git a/js/data.json b/js/data.json
new file mode 100644
index 0000000..7801e96
--- /dev/null
+++ b/js/data.json
@@ -0,0 +1,20 @@
+{
+ "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 a2c40da..3e399c9 100644
--- a/js/featured-projects-committer.js
+++ b/js/featured-projects-committer.js
@@ -1,74 +1,38 @@
(function($, document) {
+ //your code here;
+ $.getJSON("/home/js/data.json", function(data){
+ const committers = data.committers
+ const projects = data.projects
- // Set the Newsletter Edition
- var edition = "2021-05";
-
- // Set the Url
- var url = "https://newsroom.eclipse.org/api/edition?parameters[date]=" + edition;
- if (window.location.origin == "https://eclipse.dev.docker" || window.location.origin == "https://staging.eclipse.org") {
- var url = "https://newsroom-staging.eclipse.org/api/edition?parameters[date]=" + edition;
- }
-
- $.ajax({
- url: url,
- type: 'GET',
- dataType: 'json',
- beforeSend: function (xhr){
- if (window.location.origin == "https://eclipse.dev.docker" || window.location.origin == "https://staging.eclipse.org") {
- xhr.setRequestHeader('Authorization', "Basic " + btoa("testuser:plaintext"));
- }
- },
- 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>"
+ 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>"
var content = " <div class='col-xs-16'>" +
- "<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>" +
+ "<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>" +
"</div>"
-
- var result = "<div class='item clearfix block-summary-item featured-blocks-match-height-by-row'>" + image + content + "</div>"
-
+
+ var result = "<div class='item clearfix block-summary-item match-height-item-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