Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions contribute/community-tickets.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ layout: page-full-width
title: Community tickets
---

Below is a selection of tickets from
[Scala's bug tracker](https://issues.scala-lang.org/)
that we think are a good starting point for you, as the community.
Tickets in the Scala bug tracker [marked with "community" label](https://issues.scala-lang.org/issues/?jql=labels%20%3D%20%22community%22%20and%20status%20%3D%20open%20ORDER%20BY%20createdDate%20desc)
are ripe for the picking! Thanks to everyone who has [pitched in already](https://issues.scala-lang.org/issues/?jql=labels%20%3D%20%22community%22%20and%20resolution%20%3D%20fixed%20ORDER%20BY%20createdDate%20desc).

<div id="communitytickets"> </div>
Don't feel limited or compelled in your selection by this label, it is just intended as a starting
point. All tickets are fair game!

As outlined in the [contributing guide](./guide.html), it is prudent to share your plans to work
on tickets with us on [scala-internals](https://groups.google.com/forum/#!forum/scala-internals),
especially for non-trivial changes. That way you can get advice about how to attack the problem.
140 changes: 0 additions & 140 deletions resources/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -487,146 +487,6 @@ $(document).ready(function(){

});

/**************************
* Community tickets feed *
**************************/

$(document).ready(function(){
var $communityTicketsDiv = $('#communitytickets');

// Stop early if the element does not exist
if ($communityTicketsDiv.length == 0)
return;

var MAX_TICKETS_PER_PAGE = 20;

function escapeHTML(text) {
return text
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&#039;");
}

function truncateWords(text, words) {
return text.split(" ").splice(0, words).join(" ");
}

function doPopulateTicketsPane(data) {
var pageCount = Math.ceil(data.total / data.maxResults);
var currentPage = Math.floor(data.startAt / data.maxResults) + 1;

$("#communitytickets").empty();

var pagerList = $('<ul>');

for (var i = 0; i <= pageCount+1; i++) {
var page, buttonText;
if (i == 0) {
page = currentPage-1;
buttonText = '«';
} else if (i > pageCount) {
page = currentPage+1;
buttonText = '»';
} else {
page = i;
buttonText = i.toString();
}

var valid = (page >= 1) && (page <= pageCount);
var item;

if (valid) {
var clickFun = (function(startAt) {
return function() {
doAjaxQuery(startAt);
return false;
}
})((page-1) * data.maxResults);

var anchor = $('<a>', {
href: '#',
text: buttonText,
click: clickFun
});
item = $('<li>', {
class: page == currentPage ? 'active' : ''
}).append(anchor);
} else {
var anchor = $('<a>', {
href: '#',
text: buttonText,
click: function() {
return false;
}
});
item = $('<li>', {
class: 'disabled'
}).append(anchor);
}

pagerList.append(item);
}

$("#communitytickets").append(
$('<div>', {class: 'pagination'}).append(pagerList)
);

var issues = data.issues;
for (i = 0; i < issues.length; i++) {
var issue = issues[i];
var fields = issue.fields;

/* Note: if you want to add more fields (or remove some), be sure to
* update the query URL below, in doAjaxQuery(), so that the 'fields'
* parameter contains the list of fields you want to receive.
*/
var thisContent =
'<hr /><div class="tickets-item">' +
'<div class="tickets-title"><a href="https://issues.scala-lang.org/browse/'+issue.key+'">'+escapeHTML(fields.summary)+'</a></div>' +
'<div class="tickets-issuetype"><img src="'+fields.issuetype.iconUrl+'" /> '+escapeHTML(fields.issuetype.name)+'</div>' +
'<div class="tickets-priority"><img src="'+fields.priority.iconUrl+'" /> '+escapeHTML(fields.priority.name)+'</div>' +
'<div class="tickets-components">'+fields.components.map(function (component) {
return '<a href="https://issues.scala-lang.org/browse/SI/component/'+component.id+'">'+escapeHTML(component.name)+'</a>';
}).join(', ')+'</div>'+
'<div class="tickets-description">'+truncateWords(escapeHTML(fields.description), 50)+'</div>'+
// '<div class="tickets-data"><pre>'+JSON.stringify(issue, undefined, 2)+'</pre></div>' +
'</div>';

$("#communitytickets").append(thisContent);
}
};

function onAjaxSuccess(response, textStatus, jqXHR) {
doPopulateTicketsPane(response);
}

function onAjaxError(jqXHR, textStatus, errorThrown) {
// log the error to the console
console.error(
"Could not load community tickets from JIRA: " + textStatus, errorThrown);
}

function doAjaxQuery(startAt) {
/* Note: the 'fields' parameter contains the list of fields we use in
* the construction of the display, in doPopulateTicketsPane().
*/
$.ajax({
url: "https://issues.scala-lang.org/rest/api/2/search?jql=project+in+%28SI,SUGGEST%29+AND+status+%3D+Open+AND+labels+%3D+community+ORDER+BY+component&maxResults="+MAX_TICKETS_PER_PAGE+'&startAt='+startAt+'&fields=summary,issuetype,priority,components,description',
type: "GET",
dataType: "jsonp",
jsonp: 'jsonp-callback',
crossDomain: true,
success: onAjaxSuccess,
error: onAjaxError
});
}

doAjaxQuery(0);

});

/**************************
* Google Analytics *
**************************/
Expand Down