Skip to content

Commit

Permalink
feat(nozbe): Add button to task list
Browse files Browse the repository at this point in the history
  • Loading branch information
shantanuraj committed May 9, 2019
1 parent d38bfa7 commit a361965
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
32 changes: 29 additions & 3 deletions src/scripts/content/nozbe.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
'use strict';

/**
* Nozbe detail view
*/
togglbutton.render(
'.details__attributes-right:not(.toggl)',
{ observe: true },
function (elem) {
const description = $('.details__title-name, js--displayEditForm').textContent;
const project = $('.details__attribute-name').textContent;
function renderNozbeDetailView (elem) {
const description = document.querySelector('.details .details__title-name').innerText.trim();
const project = document.querySelector('.details .details__attribute-name').innerText.trim();

const link = togglbutton.createTimerLink({
className: 'nozbe',
Expand All @@ -19,3 +22,26 @@ togglbutton.render(
elem.appendChild(div);
}
);

/**
* Nozbe task list
*/
togglbutton.render(
'.item.task:not(.toggl)',
{ observe: true },
function renderNozbeList (elem) {
const description = elem.querySelector('.task__name').innerText.trim();
const projectName = elem.querySelector('.task__project-name').innerText.trim();

const link = togglbutton.createTimerLink({
className: 'nozbe-list',
buttonType: 'minimal',
description,
projectName
});

const container = elem.querySelector('.task__icons-right');
const starIcon = container.querySelector('.task__star');
container.insertBefore(link, starIcon);
}
);
10 changes: 10 additions & 0 deletions src/styles/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1179,6 +1179,16 @@ a.toggl-button.workfront.min {
background-size: 24px 24px;
color: #151515 !important;
}
.toggl-button.nozbe-list {
visibility: hidden;
pointer-events: none;
}
.task:hover .toggl-button.nozbe-list,
.task:active .toggl-button.nozbe-list,
.task:focus .toggl-button.nozbe-list {
visibility: visible;
pointer-events: all;
}

/********* RallyDev *********/
.timer__container.togglContainer {
Expand Down

0 comments on commit a361965

Please sign in to comment.