Roslund/KanbanForge

Create a card modal for when a card is clicked [4/6]

Icepool opened this issue · 3 comments

Description:
Create a model that's displayed when card is clicked.
Make it show the information returned from the AJAX request in the function called ajaxGetCard.
You could tie the returned data to the modal via jQuery.

This issue only relates to the design part, there's already an AJAX request and API defined for this.

Function call: ajaxGetCard(7)
Returned JSON object example:

[
  {
    "id": 7,
    "artifact_id": "artf1073",
    "category_id": 4,
    "swimlane_id": null,
    "created_at": "2017-12-16 15:48:06",
    "updated_at": "2017-12-16 15:48:06",
    "assignedTo": "enari",
    "description": "Artifact Description",
    "title": "Title of Aritifact",
    "teamforgeCreatedDate": "2017-12-13T07:40:32.000+0000",
    "status": "Open"
  }
] 

You'll have the timestamp from "updated_at", with which you can calculate the "edited days ago".
The following code is one way to do this in PHP:

$cardLastUpdate = new DateTime($card['updated_at']);
$currentDate = new DateTime(date("Y-m-d H:i:s"));
$dateInterval = $cardLastUpdate->diff($currentDate);

echo $dateInterval->format('Last updated: %d days ago');

The issue is dependent on the AJAX requests and the API in issue #85 , which is now done.

Updated the description.
The functionality releted to this is implemented now and will be in master once #174 has been reviewed and accepted.

pull request #176

Reviewed, looks good on my end. Well done.
The only thing I can think of as an improvement at the moment is perhaps to scroll the viewer up if they are too far down. (If the model renders when you've scrolled down you'll have to scroll up to see the upper portion of content)
As this isn't a requirement I'll close the issue with this comment.