blob: a2c40da23dff0c5ab695cbe33403facea9731d58 [file] [log] [blame]
(function($, document) {
// 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>"
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>" +
"</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.");
}
});
})(jQuery, document);