Instantly share code, notes, and snippets.

View project_archive
function protectArchive(notification)
{
new Notification(notification).archivedCard().unArchive();
}
View alert_before_due
function scheduleAlertBeforeDue(notification,signature)
{
new Notification(notification).actionOnDueDateAdded("actionAlertBeforeDue",signature,function(date)
{
date.minusDays(7);
});
}
function actionAlertBeforeDue(notification)
{
View add_checklist_from_label
function addChecklistFromLabel(notification)
{
var label = new Notification(notification).addedLabel();
label.card().board().card("Checklist Templates").copyChecklist(label.name(),label.card());
}
View first_sat_2_months
function scheduleDueDate(notification,signature)
{
new Notification(notification).actionOnDueDateAdded("doStuffAndReschedule",signature);
}
function doStuffAndReschedule(notification)
{
new Notification(notification).card().postComment("Hey! Do something!").setDue(Trellinator.now().addMonths(2).on(1).next("Saturday"));
}
View copy_board
function newBoardFromTemplate(notification)
{
//When a card is added to the Project Kickoff list
var trigger_card = new Notification().addedCard(/Project Kickoff/);
//Find the template board
var template_board = Board.findOrCreate("Project Template");
//Copy this to a new board named after the created card in the "Work" team
var new_board = template_board.copy(trigger_card.name(),new Trellinator().team("Work"));
//Attach a link to the created board back to the trigger card
trigger_card.attachLink(new_board.link());
View bottom_checklists
function moveCompletedChecklistsToBottom(notification)
{
new Notification(notification).completedChecklist().setPosition("bottom");
}
View priority_level
function setDueAccordingToPriority(notification)
{
var notif = new Notification(notification);
var label = notif.addedLabel();
label.card().setDue(Trellinator.now().addDays(parseInt(notif.board().list("Priorities").card(label.name())).description()));
}
View 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());
View add_missing_checklist
function addChecklist()
{
var board = new Trellinator().board("My Board");
var template = board.card("Checklist Origin");
board.cards().each(function(card)
{
template.copyChecklist("Forgotten Checklist",card);
});
}
View assign_tickets
function assignTicketToPerson(notification)
{
var label = new Notification(notification).addedLabel();
label.card().attachLink(label.card().copyToList(new Trellinator().board(label.name()).findOrCreateList("Inbox")).link());
}