Skip to content

Commit

Permalink
Add blocked task status
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidMStraub committed Aug 27, 2023
1 parent b8747e0 commit 542f162
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/GrampsjsTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export class GrampsjsTask extends GrampsjsTranslateMixin(LitElement) {
id="select-status"
@change="${this._handleStatusChange}"
>
${['Open', 'In Progress', 'Done'].map(
${['Open', 'In Progress', 'Blocked', 'Done'].map(
status => html`
<mwc-list-item
value="${status}"
Expand Down
9 changes: 7 additions & 2 deletions src/components/GrampsjsTasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ class GrampsjsTasks extends GrampsjsTranslateMixin(LitElement) {
color: #007bff;
}
.error {
.error,
.blocked {
color: #bf360c;
}
Expand Down Expand Up @@ -236,6 +237,7 @@ class GrampsjsTasks extends GrampsjsTranslateMixin(LitElement) {
>
<mwc-list-item>${this._('Open')}</mwc-list-item>
<mwc-list-item>${this._('In Progress')}</mwc-list-item>
<mwc-list-item>${this._('Blocked')}</mwc-list-item>
<mwc-list-item>${this._('Done')}</mwc-list-item>
</mwc-menu>
</div>
Expand Down Expand Up @@ -268,7 +270,7 @@ class GrampsjsTasks extends GrampsjsTranslateMixin(LitElement) {

_handleStatusSet(e) {
this.renderRoot.getElementById('prio-menu').select(null)
const values = {0: 'Open', 1: 'In Progress', 2: 'Done'}
const values = {0: 'Open', 1: 'In Progress', 2: 'Blocked', 3: 'Done'}
const value = values[e.detail.index]
if (value) {
this._updateAttributes(this._selected, 'Status', value)
Expand Down Expand Up @@ -309,6 +311,9 @@ class GrampsjsTasks extends GrampsjsTranslateMixin(LitElement) {
'In Progress': html`<mwc-icon class="progress" id="${id}"
>timelapse</mwc-icon
>`,
Blocked: html`<mwc-icon class="blocked" id="${id}"
>remove_circle</mwc-icon
>`,
Done: html`<mwc-icon class="done" id="${id}">check_circle</mwc-icon>`,
unknown: html`<mwc-icon class="" id="${id}">help</mwc-icon>`,
}
Expand Down
8 changes: 7 additions & 1 deletion src/views/GrampsjsViewTasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,13 @@ export class GrampsjsViewTasks extends GrampsjsView {
if ('data' in data) {
this.error = false
// sort
const labelOrder = {Open: 1, 'In Progress': 2, other: 3, Done: 4}
const labelOrder = {
Open: 1,
'In Progress': 2,
Blocked: 3,
other: 4,
Done: 5,
}
this._data = data.data.sort(
(a, b) =>
labelOrder[this._getAttribute(a, 'Status') || 'other'] -
Expand Down

0 comments on commit 542f162

Please sign in to comment.