Skip to content

Commit

Permalink
feat(youtrack): Add Toggl button to YouTrack Agile board issue modal
Browse files Browse the repository at this point in the history
Closes toggl#2316
  • Loading branch information
pkvach committed Sep 20, 2024
1 parent 362be1f commit 64959f4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/content/youtrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,25 @@ togglbutton.render('.yt-agile-card:not(.toggl)', { observe: true }, function (

container.appendChild(link);
});

// Agile board - issue modal
togglbutton.render('div[role="dialog"] div[data-test="fields-sidebar"]:not(.toggl)', { observe: true }, function (
elem
) {
const dialog = elem.closest('div[role="dialog"]');

const issueIdElem = dialog.querySelector('a[href*="issue/"]');
const issueId = issueIdElem ? issueIdElem.textContent.trim() : "";

const issueTitleElem = dialog.querySelector('h1');
const issueTitle = issueTitleElem ? issueTitleElem.textContent.trim() : "";

const link = togglbutton.createTimerLink({
className: 'youtrack-modal',
description: issueId + ' ' + issueTitle,
projectName: issueId.split('-')[0]
});

const container = elem.lastChild;
container.insertBefore(link, container.firstChild);
});
4 changes: 4 additions & 0 deletions src/styles/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@
margin-right: 30px;
}

.toggl-button.youtrack-modal {
padding: 6px 12px;
}

/********* ASANA *********/
.toggl-button.asana,
.toggl-button.asana-new {
Expand Down

0 comments on commit 64959f4

Please sign in to comment.