Skip to content
This repository has been archived by the owner on Nov 7, 2022. It is now read-only.

Add "deadline" and "finisheddate" attributes for the card. #46

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/boards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ export interface BoardCard {
* The time, the card has been created.
*/
creation_time?: string;
/**
* The (optional) date, the cards's deadline date.
*/
deadline?: string;
/**
* The (optional) date, the cards has been finished.
*/
finisheddate?: string;
Copy link
Owner

@mkloubert mkloubert Jun 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finished_date

/**
* The (optional) description (data).
*/
Expand Down Expand Up @@ -572,6 +580,16 @@ export class KanbanBoard extends vscode_helpers.DisposableBase {
<input type="text" class="form-control" id="vsckb-new-card-assigned-to">
</div>

<div class="form-group vsckb-card-deadline">
<label for="vsckb-new-card-deadline">Deadline</label>
<input type="text" class="form-control" id="vsckb-new-card-deadline">
</div>

<div class="form-group vsckb-card-finisheddate">
<label for="vsckb-new-card-finisheddate">Finished Date</label>
<input type="text" class="form-control" id="vsckb-new-card-finisheddate">
</div>

<div class="row">
<div class="col col-12">
<ul class="nav nav-pills vsckb-card-description-details-tablist" id="vsckb-new-card-description-details-tablist" role="tablist">
Expand Down Expand Up @@ -721,6 +739,16 @@ export class KanbanBoard extends vscode_helpers.DisposableBase {
<input type="text" class="form-control" id="vsckb-edit-card-assigned-to">
</div>

<div class="form-group vsckb-card-deadline">
<label for="vsckb-edit-card-deadline">Deadline</label>
<input type="text" class="form-control" id="vsckb-edit-card-deadline">
</div>

<div class="form-group vsckb-card-finisheddate">
<label for="vsckb-edit-card-finisheddate">Finished Date</label>
<input type="text" class="form-control" id="vsckb-edit-card-finisheddate">
</div>

<div class="row">
<div class="col col-12">
<ul class="nav nav-pills vsckb-card-description-details-tablist" id="vsckb-edit-card-description-details-tablist" role="tablist">
Expand Down
2 changes: 1 addition & 1 deletion src/res/css/board.css
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ body main .row .col .vsckb-card .card-body {
padding: 2px 8px;
}

.vsckb-kanban-card .vsckb-kanban-card-info .vsckb-kanban-card-category {
.vsckb-kanban-card .vsckb-kanban-card-info .vsckb-kanban-card-category .vsckb-kanban-card-deadline .vsckb-kanban-card-finisheddate {
clear: both;
display: block;
font-size: 0.75em;
Expand Down
74 changes: 74 additions & 0 deletions src/res/js/board.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@ function vsckb_edit_card(i, opts) {
const CATEGORY_FIELD = WIN.find('#vsckb-edit-card-category');
CATEGORY_FIELD.val( vsckb_to_string(i.category).trim() );

const DEADLINE_FIELD = WIN.find('#vsckb-edit-card-deadline');
DEADLINE_FIELD.val( vsckb_to_string(i.deadline).trim() );

const FINISHED_FIELD = WIN.find('#vsckb-edit-card-finisheddate');
FINISHED_FIELD.val( vsckb_to_string(i.finisheddate).trim() );
Copy link
Owner

@mkloubert mkloubert Jul 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finished_date


const ASSIGNED_TO_FIELD = WIN.find('#vsckb-edit-card-assigned-to');
ASSIGNED_TO_FIELD.val( vsckb_to_string(user) );

Expand Down Expand Up @@ -188,13 +194,25 @@ function vsckb_edit_card(i, opts) {
category = undefined;
}

let deadline = vsckb_to_string( DEADLINE_FIELD.val() ).trim();
if ('' === deadline) {
deadline = undefined;
}

let finisheddate = vsckb_to_string( FINISHEDDATE_FIELD.val() ).trim();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: should be FINISHED_FIELD

if ('' === finisheddate) {
finisheddate = undefined;
}

i.assignedTo = vsckb_get_assigned_to_val(ASSIGNED_TO_FIELD);
i.title = TITLE;
i.description = vsckb_get_card_description_markdown( descriptionField );
i.details = vsckb_get_card_description_markdown( detailsField );
i.prio = PRIO;
i.type = type;
i.category = category;
i.deadline = deadline;
i.finisheddate = finisheddate;
Copy link
Owner

@mkloubert mkloubert Jun 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finished_date

i.references = references;

vsckb_save_board();
Expand Down Expand Up @@ -821,6 +839,16 @@ function vsckb_refresh_card_view(onAdded) {
}
}

let deadline;
if (card.deadline) {
deadline = card.deadline;
}

let finisheddate;
if (card.finisheddate) {
Copy link
Owner

@mkloubert mkloubert Jun 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finished_date

finisheddate = card.finisheddate;
Copy link
Owner

@mkloubert mkloubert Jul 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finished_date

}

let assignedTo;
if (card.assignedTo) {
assignedTo = card.assignedTo.name;
Expand Down Expand Up @@ -899,6 +927,8 @@ function vsckb_refresh_card_view(onAdded) {
assigned_to: assignedTo,
cat: card.category,
category: card.category,
deadline: card.deadline,
finisheddate: card.finisheddate,
Copy link
Owner

@mkloubert mkloubert Jul 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finished_date

description: GET_MARKDOWN_VALUE(card.description),
details: GET_MARKDOWN_VALUE(card.details),
'false': false,
Expand Down Expand Up @@ -946,6 +976,9 @@ function vsckb_refresh_card_view(onAdded) {
'<div class="vsckb-kanban-card-info bg-white text-dark">' +
'<div class="vsckb-kanban-card-title font-weight-bold" />' +
'<div class="vsckb-kanban-card-category" />' +
'<div class="vsckb-kanban-card-assignedto" />' +
'<div class="vsckb-kanban-card-deadline" />' +
'<div class="vsckb-kanban-card-finisheddate" />' +
'<div class="vsckb-kanban-card-progress" />' +
'<div class="vsckb-kanban-card-body" />' +
'</div>' +
Expand All @@ -963,6 +996,15 @@ function vsckb_refresh_card_view(onAdded) {
const NEW_ITEM_CATEGORY = NEW_ITEM.find('.vsckb-kanban-card-category');
NEW_ITEM_CATEGORY.hide();

const NEW_ITEM_ASSIGNEDTO = NEW_ITEM.find('.vsckb-kanban-card-assignedto');
NEW_ITEM_ASSIGNEDTO.hide();

const NEW_ITEM_DEADLINE = NEW_ITEM.find('.vsckb-kanban-card-deadline');
NEW_ITEM_DEADLINE.hide();

const NEW_ITEM_FINISHEDDATE = NEW_ITEM.find('.vsckb-kanban-card-finisheddate');
NEW_ITEM_FINISHEDDATE.hide();

const NEW_ITEM_PROGRESS = NEW_ITEM.find('.vsckb-kanban-card-progress');
NEW_ITEM_PROGRESS.hide();

Expand Down Expand Up @@ -1086,6 +1128,24 @@ function vsckb_refresh_card_view(onAdded) {
NEW_ITEM_CATEGORY.show();
}

let assignedto = "Assigned to: " + vsckb_to_string(i.assignedTo.name).trim();
if ('' !== assignedto) {
NEW_ITEM_ASSIGNEDTO.text( assignedto );
NEW_ITEM_ASSIGNEDTO.show();
}

let deadline = "Deadline: " + vsckb_to_string(i.deadline).trim();
if ('' !== deadline) {
NEW_ITEM_DEADLINE.text( deadline );
NEW_ITEM_DEADLINE.show();
}

let finisheddate = "Finished Date: " + vsckb_to_string(i.finisheddate).trim();
Copy link
Owner

@mkloubert mkloubert Jul 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finished_date

if ('' !== assignedto) {
NEW_ITEM_FINISHEDDATE.text( finisheddate );
NEW_ITEM_FINISHEDDATE.show();
}

vsckb_append_card_content(
i.description, NEW_ITEM_INFO_BODY,
() => {
Expand Down Expand Up @@ -1799,6 +1859,8 @@ jQuery(() => {
const PRIO_FIELD = WIN.find('#vsckb-new-card-prio');

const CATEGORY_FIELD = WIN.find('#vsckb-new-card-category');
const DEADLINE_FIELD = WIN.find('#vsckb-new-card-deadline');
const FINISHEDDATE_FIELD = WIN.find('#vsckb-new-card-finisheddate');

WIN.attr('vsckb-type', TYPE);

Expand Down Expand Up @@ -1838,6 +1900,16 @@ jQuery(() => {
category = undefined;
}

let deadline = vsckb_to_string( DEADLINE_FIELD.val() ).trim();
if ('' === deadline) {
deadline = undefined;
}

let finisheddate = vsckb_to_string( FINISHEDDATE_FIELD.val() ).trim();
if ('' === finisheddate) {
finisheddate = undefined;
}

let simpleIDs;
if (boardSettings) {
simpleIDs = boardSettings.simpleIDs;
Expand All @@ -1855,6 +1927,8 @@ jQuery(() => {
const NEW_CARD = {
assignedTo: vsckb_get_assigned_to_val( ASSIGNED_TO_FIELD ),
category: category,
deadline: deadline,
finisheddate: finisheddate,
Copy link
Owner

@mkloubert mkloubert Jun 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finished_date

creation_time: CREATION_TIME.toISOString(),
description: vsckb_get_card_description_markdown( descriptionField ),
details: vsckb_get_card_description_markdown( detailsField ),
Expand Down
9 changes: 9 additions & 0 deletions src/workspaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1069,6 +1069,15 @@ async function exportBoardCardsTo(opts: ExportBoardCardsToOptions) {
META['Category'] = category;
}

let deadline = vscode_helpers.toStringSafe(C.deadline).trim();
if ('' !== deadline) {
META['Deadline'] = deadline;
}
let finisheddate = vscode_helpers.toStringSafe(C.finisheddate).trim();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finished_date

if ('' !== finisheddate) {
META['Finisheddate'] = finisheddate;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Finished date"

}

let creationTime = vscode_helpers.toStringSafe(C.creation_time).trim();
if ('' !== creationTime) {
try {
Expand Down