Last active
February 25, 2019 22:43
-
-
Save iaindooley/3b5098e08fa2d92cbee6a1e1541de61a to your computer and use it in GitHub Desktop.
ToC Lists
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createNewListCard(notification) | |
{ | |
var notif = new Notification(notification); | |
var new_list = notif.addedList(); | |
if(new_list.name() == "ToC") | |
{ | |
notif.board().lists().each(function(list) | |
{ | |
if(list.name() != "ToC") | |
{ | |
Card.create(new_list,list.name()).addChecklist("Contents",function(checklist) | |
{ | |
list.cards().each(function(card) | |
{ | |
checklist.addItem(card.link()); | |
}); | |
}); | |
} | |
}); | |
} | |
else | |
{ | |
var list_card = Card.create(notif.board().list("ToC"),notif.addedList().name()); | |
notif.addedList().cards().each(function(card) | |
{ | |
list_card.addChecklist("Contents",function(list) | |
{ | |
list.addItem(card.link()); | |
}); | |
}); | |
} | |
} | |
function addCardToList(notification) | |
{ | |
var card = new Notification(notification).addedCard(); | |
if(card.currentList().name() == "ToC") | |
throw new InvalidActionException("Ignore this one"); | |
Card.findOrCreate(card.board().list("ToC"),card.currentList().name()).addChecklist("Contents",function(list) | |
{ | |
list.addItem(card.link()); | |
}); | |
} | |
function removeListCard(notification) | |
{ | |
var notif = new Notification(notification); | |
notif.board().list("ToC").card(notif.archivedList().name()).archive(); | |
} | |
function checkOffArchivedToCItem(notification) | |
{ | |
var notif = new Notification(notification); | |
notif.board().list("ToC").card(notif.archivedCard().currentList().name()).checkItemByName(notif.card().link()); | |
} | |
function archiveCheckedOffToCItem(notification) | |
{ | |
var notif = new Notification(notification); | |
var item = notif.completedChecklistItem(); | |
if(!notif.member().notTrellinator()) | |
throw new InvalidActionException("Ignore Trellinator checking off items"); | |
if(item.checklist().card().currentList().name() == "ToC") | |
new Card({link: item.name()}).archive(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment