Skip to content

Commit

Permalink
Merge pull request scala#253 from dickwall/doc/communitytickets
Browse files Browse the repository at this point in the history
Removed PHP issues page in favor of direct JIRA queries.
  • Loading branch information
sjrd committed Jan 27, 2015
2 parents a4ab9a9 + eb7b190 commit 8be302d
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 159 deletions.
10 changes: 0 additions & 10 deletions contribute/community-tickets.md

This file was deleted.

2 changes: 1 addition & 1 deletion contribute/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ title: Contributing guide

<div class="row">
<div class="span4 doc-block">
<h3><a href="{{ site.baseurl }}/contribute/community-tickets.html">Community issues</a></h3>
<h3><a href="{{ site.baseurl }}/contribute/#community-tickets">Community issues</a></h3>
<p>Get cracking on some easy to approach issues.</p>
</div>
<div class="span4 doc-block">
Expand Down
45 changes: 40 additions & 5 deletions contribute/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,44 @@ An easy but very important way to contribute to Scala is to

### Compiler and other tools

Want to dive into the hardcore business? Check out our
[selection of community tickets](./community-tickets.html),
which are good starting points to contributing to the compiler and
surrounding tools, like ScalaDoc.

More info in our [contributing guide](./guide.html).

### Community Tickets

The following links provide starting points for
various contributor activities:

<div class="container">
<div class="row">
<div class="span4 doc-block">
<h3><a href="https://issues.scala-lang.org/issues/?filter=13003">Documentation</a></h3>
<p>Help augment or correct the documentation.</p>
</div>
<div class="span4 doc-block">
<h3><a href="https://issues.scala-lang.org/issues/?filter=13001">Core Libraries</a></h3>
<p>Community bugs and enhancements on the core libs.</p>
</div>
</div>

<div class="row">
<div class="span4 doc-block">
<h3><a href="https://issues.scala-lang.org/issues/?filter=13002">Tools</a></h3>
<p>Help with the Scala tool chain.</p>
</div>
<div class="span4 doc-block">
<h3><a href="https://issues.scala-lang.org/issues/?filter=13000">Compiler</a></h3>
<p>Ready for a challenge? Here's the compiler bugs.</p>
</div>
</div>

<div class="row">
<div class="span4 doc-block">
<h3><a href="https://issues.scala-lang.org/issues/?filter=13004">Bugs</a></h3>
<p>All bugs marked with the label <em>community</em>.</p>
</div>
<div class="span4 doc-block">
<h3><a href="https://issues.scala-lang.org/issues/?filter=12111">All Issues</a></h3>
<p>Bugs + Enhancements marked with the label <em>community</em>.</p>
</div>
</div>
</div>
138 changes: 0 additions & 138 deletions resources/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -487,144 +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: "{{ site.baseurl }}/resources/php/community-tickets.php?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: "json",
success: onAjaxSuccess,
error: onAjaxError
});
}

doAjaxQuery(0);

});

/**************************
* Google Analytics *
**************************/
Expand Down
5 changes: 0 additions & 5 deletions resources/php/community-tickets.php

This file was deleted.

0 comments on commit 8be302d

Please sign in to comment.