Skip to content

Instantly share code, notes, and snippets.

@iaindooley
iaindooley / allow_moves_from_users
Last active February 21, 2024 19:43
Allow moves from users
function restrictMovesOutOfLists(notification)
{
var notif = new Notification(notification);
var card = notif.movedCard();
bounceBackIfNotAllowed("from "+notif.listBefore().name(),notif.member().name());
}
function restrictMovesIntoLists(notification)
{
var notif = new Notification(notification);
@iaindooley
iaindooley / gist:1aef7ebc05ab2701366d020dc490209a
Created May 20, 2020 05:47
Total for field in list name
function updateListTotalForMovedCard(notification)
{
var notif = new Notification(notification);
var added = notif.addedCard();
if(parts = /(.+) \(([0-9]+)\)/.exec(notif.listAfter().name()))
{
notif.listAfter().setName(parts[1]+" ("+totalPointsForList(notif.listAfter())+")");
if(parts = /(.+) \(([0-9]+)\)/.exec(notif.listBefore().name()))
@iaindooley
iaindooley / gist:51e75dd7315c889fec0f37de3e091aa1
Created August 23, 2022 04:12
Init trellinator submodules for a BenkoBot repo
git submodule add git@github.com:iaindooley/benko-board-trellinator.git apps/benko-board-trellinator
git submodule add git@github.com:iaindooley/trellinator-libs.git apps/trellinator-libs
git submodule add git@github.com:iaindooley/trellinator.git apps/trellinator
git submodule init
git submodule update
@iaindooley
iaindooley / gist:d6d7143f7442ee6931b34ce467237687
Created March 3, 2021 22:58
Remove attachments from copied cards
function removeAttachmentsFromCopiedCard(notification)
{
new Notification(notification).copiedCard().attachments().each(function(att)
{
att.remove();
});
}
@iaindooley
iaindooley / gist:08dfe1c2a19156194ff533ee451d5e16
Created May 7, 2020 02:28
Copy template board and members
function copyTemplateBoardAndMembers(notification)
{
var created = new Notification(notification).createdCard();
created.attachLink(new Trellinator().board(created.currentList().name()).copy(created.name()).link());
}
@iaindooley
iaindooley / trello_subtasks
Created February 27, 2019 23:24
Trello Subtasks
function subtasks(notification)
{
var notif = new Notification(notification);
//If a new checklist item was added
var item = notif.addedChecklistItem();
//If this was not added by Trellinator, and it was added to a checklist
//called "Subtasks"
if(notif.member().notTrellinator() && (item.checklist().name() == "Subtasks"))
{
//Set the text of the item ...
@iaindooley
iaindooley / lock_card
Created January 14, 2019 01:19
Lock card
function lockCardInPlace(notification)
{
var notif = new Notification(notification);
if(notif.member().notTrellinator())
{
var card = notif.movedCard();
if(!card.allChecklistsComplete())
card.moveToList(notif.listBefore());
function notifyWithAttachments(notification)
{
var card = new Notification(notification).addedCard("Internal review");
try
{
card.postComment("@board ready for review. Here are the attachments\n\n"+card.attachments().find(function(att)
{
return att.link();
}).asArray().join("\n"));
new Notification(notification).addedLabel("Remove All Attachments").card().attachments().each(function(att)
{
att.remove();
});
function setNewCardId(notification)
{
new Notification(notification)
.createdCard()
.setCustomFieldValue("Unique ID",latestCardId());
}
function latestCardId()
{
var card = Card.findOrCreate(Board.findOrCreate("System Configuration").findOrCreateList("Card ID"),"Latest Card Count");