Skip to content

Instantly share code, notes, and snippets.

@robinwarren
Last active October 14, 2015 13:52
Show Gist options
  • Save robinwarren/80f34a018032d482949e to your computer and use it in GitHub Desktop.
Save robinwarren/80f34a018032d482949e to your computer and use it in GitHub Desktop.
//Called when we have loaded the labels for a board
var loadedLabels = function(labels) {
$.each(labels, function(index, label) {
var label = $("<p><span class='badge' style='background:" + label.color + ";'>" + label.uses + "</span> " + label.name + "</p>");
$('#labels').append(label)
});
};
//Listen to changes to the boards selector
$('#boards').change(function() {
var boardId = $("option:selected", this).val();
$('#labels').empty();
Trello.get(
'/boards/' + boardId + '/labels',
loadedLabels,
function() { console.log("Failed to load labels"); }
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment