Skip to content

Instantly share code, notes, and snippets.

@adamdicarlo
Last active March 1, 2017 19:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save adamdicarlo/5366976 to your computer and use it in GitHub Desktop.
Save adamdicarlo/5366976 to your computer and use it in GitHub Desktop.
Show card counts for each list (column) in Trello. Bonus: If you have a card with the text "PLACEHOLDER," it will show how many cards come before it, and how many come after it.
$('.list').each(function() {
var $this = $(this);
var count = $this.find('.list-card').length;
var $title = $this.find('.list-title h2');
var tester = /.*PLACEHOLDER.*/;
var placeholderIndex = false;
// Determine the index of the PLACEHOLDER card, if there is one.
$this.find('.list-card a').each(function(index, el) {
if (tester.exec($(el).text()) !== null) {
placeholderIndex = index;
}
});
if (placeholderIndex !== false) {
var before = placeholderIndex;
var after = count - placeholderIndex - 1;
$title.text($title.text() + ' (' + before + ' | ' + after + ')');
}
else {
$title.text($title.text() + ' (' + count + ')');
}
});
@ramolec
Copy link

ramolec commented Nov 4, 2015

Hi, adam, I am trying to create a web page that appears the amount of cards I have in each list, but I'm not so good with that. Could you explain me how can I use your code to do this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment