diff --git a/trelloscrum.js b/trelloscrum.js index ba0e6f1..50db7be 100644 --- a/trelloscrum.js +++ b/trelloscrum.js @@ -757,6 +757,9 @@ function showPointPickerChecklist(location) { // then click our button so it all gets saved away $(".checklist-item-details .edit .js-save-edit").click(); + // updates points of a card based on all checklists items + updateCardTitle(); + return false })) @@ -778,11 +781,63 @@ function showPointPickerChecklist(location) { // then click our button so it all gets saved away $(".checklist-item-details .edit .js-save-edit").click(); + // updates points of a card based on all checklists items + updateCardTitle(); + return false })) }; +function updateCardTitle() +{ + // timeout to allow enough time for checklist item title to update + setTimeout(function() { + var $currentTitle = $('.window-title .window-title-text'); + var titleText = $currentTitle.text(); + var $title = $('.card-detail-title .edit textarea'); + $(".card-detail-title").addClass("editing"); + + var totals = calculateCheckListPoints(); + var newTitleValue = titleText.match(reg)?titleText.replace(reg, '('+totals.estimateTotal+') '):'('+totals.estimateTotal+') ' + titleText; + newTitleValue = newTitleValue.match(regC)?newTitleValue.replace(regC, ' ['+totals.consumedTotal+']'):newTitleValue + ' ['+totals.consumedTotal+']'; + $title[0].value = newTitleValue; + + // add edit button to card title edit controls + $('