Skip to content

Commit

Permalink
fix(hubspot): Add toggl button to list view
Browse files Browse the repository at this point in the history
  • Loading branch information
with-shrey committed Sep 27, 2024
1 parent 29e454e commit ff1d927
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/content/hubspot.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,28 @@ togglbutton.render(
}
}
);

// This generic implementation works for most objects details page
togglbutton.render(
'td[data-table-external-id*="name-"]:not(.toggl)',
{ observe: true },
$container => {
try {
function descriptionSelector() {
return $('[data-test-id="truncated-object-label"]', $container).textContent.trim();
}

const link = togglbutton.createTimerLink({
className: 'hubspot-list-item',
description: descriptionSelector,
buttonType: 'minimal'
});
const rowContainer = document.createElement('div');
rowContainer.setAttribute('class', 'flex-row align-center');
rowContainer.appendChild(link);
$('.media', $container).prepend(rowContainer);
} catch (e) {
console.error(e)
}
}
);

0 comments on commit ff1d927

Please sign in to comment.