diff --git a/bower.json b/bower.json index 02cb1a22..375dfea1 100644 --- a/bower.json +++ b/bower.json @@ -10,7 +10,8 @@ "angular-ui-router": "0.2.8-bowratic-tedium", "angular-bootstrap": "0.10.0", "angular-local-storage": "0.0.1", - "angular-elastic": "2.3.2" + "angular-elastic": "2.3.2", + "angular-moment": "0.7.1" }, "devDependencies": { "angular-mocks": "1.2.13", diff --git a/src/app/storyboard/module.js b/src/app/storyboard/module.js index 05ec0380..a73b45f1 100644 --- a/src/app/storyboard/module.js +++ b/src/app/storyboard/module.js @@ -25,7 +25,11 @@ angular.module('storyboard', [ 'sb.services', 'sb.templates', 'sb.dashboard', 'sb.pages', 'sb.projects', 'sb.auth', 'sb.story', 'sb.profile', 'sb.notification', 'ui.router', - 'ui.bootstrap', 'monospaced.elastic']) + 'ui.bootstrap', 'monospaced.elastic', 'angularMoment']) + .constant('angularMomentConfig', { + preprocess: 'utc', + timezone: 'UTC', + }) .config(function ($provide, $urlRouterProvider, $locationProvider, $httpProvider, msdElasticConfig) { 'use strict'; diff --git a/src/app/templates/story/comments/story_created.html b/src/app/templates/story/comments/story_created.html index e300f6c5..5f0aab1f 100644 --- a/src/app/templates/story/comments/story_created.html +++ b/src/app/templates/story/comments/story_created.html @@ -1,6 +1,6 @@

- {{event.created_at | date: 'medium'}} - {{ author.full_name }} has created this story. + + {{ author.full_name }} has created this story.

diff --git a/src/app/templates/story/comments/story_details_changed.html b/src/app/templates/story/comments/story_details_changed.html index 7e826fba..b63275ae 100644 --- a/src/app/templates/story/comments/story_details_changed.html +++ b/src/app/templates/story/comments/story_details_changed.html @@ -1,6 +1,6 @@

- {{event.created_at | date: 'medium'}} - {{ author.full_name }} has updated this story. + + {{ author.full_name }} has updated this story.

diff --git a/src/app/templates/story/comments/task_assignee_changed.html b/src/app/templates/story/comments/task_assignee_changed.html index ab33ff36..f5aa9bbb 100644 --- a/src/app/templates/story/comments/task_assignee_changed.html +++ b/src/app/templates/story/comments/task_assignee_changed.html @@ -1,7 +1,7 @@

- {{event.created_at | date: 'medium'}} - {{author.full_name}} has updated assignee for task {{ event_info.task_title }}: - {{ event_info.old_assignee_fullname }} ==> {{ event_info.new_assignee_fullname }} + + {{author.full_name}} has updated assignee for task {{ event_info.task_title }}: + {{ event_info.old_assignee_fullname }} ==> {{ event_info.new_assignee_fullname }}

diff --git a/src/app/templates/story/comments/task_created.html b/src/app/templates/story/comments/task_created.html index ad5b1959..dd80ca69 100644 --- a/src/app/templates/story/comments/task_created.html +++ b/src/app/templates/story/comments/task_created.html @@ -1,6 +1,6 @@

- {{event.created_at | date: 'medium'}} + {{ author.full_name }} has created a task {{ event_info.task_title }}

diff --git a/src/app/templates/story/comments/task_deleted.html b/src/app/templates/story/comments/task_deleted.html index d47964a9..3755b252 100644 --- a/src/app/templates/story/comments/task_deleted.html +++ b/src/app/templates/story/comments/task_deleted.html @@ -1,6 +1,6 @@

- {{event.created_at | date: 'medium'}} - {{ author.full_name }} has deleted a task {{ event_info.task_title }} + + {{ author.full_name }} has deleted a task {{ event_info.task_title }}

diff --git a/src/app/templates/story/comments/task_details_changed.html b/src/app/templates/story/comments/task_details_changed.html index 4c47d6ed..f335e2e2 100644 --- a/src/app/templates/story/comments/task_details_changed.html +++ b/src/app/templates/story/comments/task_details_changed.html @@ -1,6 +1,6 @@

- {{event.created_at | date: 'medium'}} - {{ author.full_name }} has updated {{ event_info.task_title }} + + {{ author.full_name }} has updated {{ event_info.task_title }}

diff --git a/src/app/templates/story/comments/task_priority_changed.html b/src/app/templates/story/comments/task_priority_changed.html index 3634ae64..7d694f33 100644 --- a/src/app/templates/story/comments/task_priority_changed.html +++ b/src/app/templates/story/comments/task_priority_changed.html @@ -1,6 +1,6 @@

- {{event.created_at | date: 'medium'}} + {{author.full_name}} has updated a task {{ event_info.task_title }} priority: {{ event_info.old_priority }} ==> {{ event_info.new_priority }}

diff --git a/src/app/templates/story/comments/task_status_changed.html b/src/app/templates/story/comments/task_status_changed.html index ab18bccf..6bf0548f 100644 --- a/src/app/templates/story/comments/task_status_changed.html +++ b/src/app/templates/story/comments/task_status_changed.html @@ -1,7 +1,7 @@

- {{event.created_at | date: 'medium'}} - {{author.full_name}} has updated a task {{ event_info.task_title }} status: - {{ event_info.old_status }} ==> {{ event_info.new_status }} + + {{author.full_name}} has updated a task {{ event_info.task_title }} status: + {{ event_info.old_status }} ==> {{ event_info.new_status }}

diff --git a/src/app/templates/story/comments/template_switch.html b/src/app/templates/story/comments/template_switch.html index 3a62980c..111e37d9 100644 --- a/src/app/templates/story/comments/template_switch.html +++ b/src/app/templates/story/comments/template_switch.html @@ -30,7 +30,7 @@

Event of unknown type has occurred. - {{event.created_at | date: 'medium'}} +

diff --git a/src/app/templates/story/comments/user_comment.html b/src/app/templates/story/comments/user_comment.html index 357f278e..c3ce40c7 100644 --- a/src/app/templates/story/comments/user_comment.html +++ b/src/app/templates/story/comments/user_comment.html @@ -1,7 +1,7 @@

{{ author.full_name }} - {{event.created_at | date: 'medium'}} +

The author left a blank comment.

-
\ No newline at end of file + diff --git a/src/app/templates/story/detail.html b/src/app/templates/story/detail.html index 4819949b..80fefd77 100644 --- a/src/app/templates/story/detail.html +++ b/src/app/templates/story/detail.html @@ -61,12 +61,9 @@
Last updated: - - {{story.updated_at | date: 'longDate'}} - - - {{story.created_at | date: 'longDate'}} - + + + Never diff --git a/src/app/templates/util/time_moment.html b/src/app/templates/util/time_moment.html new file mode 100644 index 00000000..219b5737 --- /dev/null +++ b/src/app/templates/util/time_moment.html @@ -0,0 +1,3 @@ + + +{{eventdate | date:'yyyy-MM-dd HH:mm:ss Z'}} diff --git a/src/app/util/directive/time_moment.js b/src/app/util/directive/time_moment.js new file mode 100644 index 00000000..fbe756a7 --- /dev/null +++ b/src/app/util/directive/time_moment.js @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2013 Hewlett-Packard Development Company, L.P. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +/** + * A story status label that automatically selects color and text based on + * the bound-in story. + */ +angular.module('sb.util').directive('timeMoment', + function (DateUtil) { + 'use strict'; + + return { + restrict: 'A', + templateUrl: 'app/templates/util/time_moment.html', + scope: { + eventdate: '=' + }, + controller: function ($scope) { + + /** + * Helper method to update the needs_timeago propery + */ + function updateTimeAgo() { + $scope.needsTimeAgo = + DateUtil.needsTimeAgo($scope.eventdate); + } + + var unwatch = $scope.$watch(updateTimeAgo); + $scope.$on('$destroy', unwatch); + + updateTimeAgo(); + } + }; + } +); diff --git a/src/app/util/helpers/date_util.js b/src/app/util/helpers/date_util.js new file mode 100644 index 00000000..eefaa640 --- /dev/null +++ b/src/app/util/helpers/date_util.js @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2014 Hewlett-Packard Development Company, L.P. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +/** + * A collection of date utilities. + * + * @author Yolanda Robla + */ +angular.module('sb.util').factory('DateUtil', + function () { + 'use strict'; + + return { + + /** + * Helper to check if a date needs to be formatted using + * TimeAgo plugion, or displaying UTC date + * + * @param date The date to be checked. + * @returns {boolean} True if time ago needs to be used. + */ + needsTimeAgo: function (targetDate) { + if (targetDate) + { + var currentDate = new Date().getTime(); + var daydiff = (currentDate - Date.parse(targetDate))/ + (1000*60*60*24); + return (daydiff < 7); + } + else + { + return true; + } + } + }; + } +); diff --git a/src/app/util/module.js b/src/app/util/module.js index 40abfb9e..73465152 100644 --- a/src/app/util/module.js +++ b/src/app/util/module.js @@ -24,4 +24,4 @@ angular.module('sb.util', ['ui.router', 'LocalStorageModule']) angular.element.prototype.show = function () { this.removeClass('ng-hide'); }; - }); \ No newline at end of file + }); diff --git a/src/index.html b/src/index.html index 8a461235..b7e93122 100644 --- a/src/index.html +++ b/src/index.html @@ -35,6 +35,8 @@ + +