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
…2333)

Closes #2316
  • Loading branch information
pkvach authored Sep 23, 2024
1 parent 6b17085 commit 1c11be0
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 1c11be0

Please sign in to comment.