Skip to content

Commit

Permalink
fix(hubspot): Add toggl button to list view (#2341)
Browse files Browse the repository at this point in the history
  • Loading branch information
with-shrey authored Sep 30, 2024
1 parent 29e454e commit 6932a72
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 6932a72

Please sign in to comment.