From 0804a62aec215fc876c84483fe20df5804364506 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex=20Hermida?= Date: Tue, 17 Apr 2018 12:14:52 +0200 Subject: [PATCH] Humanize dates in timeline --- app/locales/taiga/locale-en.json | 2 ++ .../components/due-date/due-date-button.jade | 3 +-- app/modules/history/history/history-diff.jade | 5 +++++ .../history/history-templates/history-due-date.jade | 13 +++++++++++++ .../user-timeline-item-title.service.coffee | 8 ++++++++ 5 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 app/modules/history/history/history-templates/history-due-date.jade diff --git a/app/locales/taiga/locale-en.json b/app/locales/taiga/locale-en.json index 8a3ea02a..07250a83 100644 --- a/app/locales/taiga/locale-en.json +++ b/app/locales/taiga/locale-en.json @@ -1225,6 +1225,7 @@ "CLIENT_REQUIREMENT": "Client Requirement", "BLOCKED": "Blocked", "VALUES": { + "NOT_SET": "not set", "UNASSIGNED": "unassigned" }, "FIELDS": { @@ -1234,6 +1235,7 @@ "TYPE": "type", "ASSIGNED_TO": "assigned to", "ASSIGNED_USERS": "assigned users", + "DUE_DATE": "due date", "MILESTONE": "sprint", "COLOR": "color" } diff --git a/app/modules/components/due-date/due-date-button.jade b/app/modules/components/due-date/due-date-button.jade index 20586453..b55c0efb 100644 --- a/app/modules/components/due-date/due-date-button.jade +++ b/app/modules/components/due-date/due-date-button.jade @@ -1,5 +1,4 @@ -a.due-date-button.button-gray.is-editable( - href="" +label.due-date-button.button-gray.is-editable( ng-if="vm.visible()" ng-disabled="vm.disabled()" ng-class="vm.color()" diff --git a/app/modules/history/history/history-diff.jade b/app/modules/history/history/history-diff.jade index 138d468f..158c0ce0 100644 --- a/app/modules/history/history/history-diff.jade +++ b/app/modules/history/history/history-diff.jade @@ -38,6 +38,11 @@ ) include history-templates/history-assigned-users +.diff-wrapper( + ng-if="vm.type == 'due_date'" +) + include history-templates/history-due-date + .diff-wrapper( ng-if="vm.type == 'tags'" ) diff --git a/app/modules/history/history/history-templates/history-due-date.jade b/app/modules/history/history/history-templates/history-due-date.jade new file mode 100644 index 00000000..a6847525 --- /dev/null +++ b/app/modules/history/history/history-templates/history-due-date.jade @@ -0,0 +1,13 @@ +.diff-status-wrapper + span.key( + translate="ACTIVITY.FIELDS.DUE_DATE" + ) + span.diff(ng-if="vm.diff[0]") {{vm.diff[0] | momentFormat:'DD MMM YYYY'}} + span.diff(ng-if="!vm.diff[0]" translate="ACTIVITY.VALUES.NOT_SET") + + tg-svg( + svg-icon="icon-arrow-right" + ) + + span.diff(ng-if="vm.diff[1]") {{vm.diff[1] | momentFormat:'DD MMM YYYY'}} + span.diff(ng-if="!vm.diff[1]" translate="ACTIVITY.VALUES.NOT_SET") \ No newline at end of file diff --git a/app/modules/user-timeline/user-timeline-item/user-timeline-item-title.service.coffee b/app/modules/user-timeline/user-timeline-item/user-timeline-item-title.service.coffee index f450fc8f..82571a3e 100644 --- a/app/modules/user-timeline/user-timeline-item/user-timeline-item-title.service.coffee +++ b/app/modules/user-timeline/user-timeline-item/user-timeline-item-title.service.coffee @@ -72,6 +72,14 @@ class UserTimelineItemTitle if value == null && timeline.getIn(["data", "value_diff", "key"]) == 'assigned_to' value = @translate.instant('ACTIVITY.VALUES.UNASSIGNED') + # due date + else if timeline.getIn(["data", "value_diff", "key"]) == 'due_date' + if value + prettyDate = @translate.instant("COMMON.PICKERDATE.FORMAT") + value = moment(value, "YYYY-MM-DD").format(prettyDate) + else + value = @translate.instant('ACTIVITY.VALUES.NOT_SET') + new_value = value else new_value = timeline.getIn(["data", "value_diff", "value"]).first().get(1)