diff --git a/app/coffee/modules/common/components.coffee b/app/coffee/modules/common/components.coffee index c0fbfcef..84d5504f 100644 --- a/app/coffee/modules/common/components.coffee +++ b/app/coffee/modules/common/components.coffee @@ -46,6 +46,33 @@ DateRangeDirective = -> module.directive("tgDateRange", DateRangeDirective) +############################################################################# +## Date Selector Directive (using pikaday) +############################################################################# + +DateSelectorDirective =-> + link = ($scope, $el, $attrs, $model) -> + selectedDate = null + $el.picker = new Pikaday({ + field: $el[0] + format: "DD MMM YYYY" + onSelect: (date) => + selectedDate = date + onOpen: => + $el.picker.setDate(selectedDate) if selectedDate? + }) + + $scope.$watch $attrs.ngModel, (val) -> + $el.picker.setDate(val) if val? + + return { + link: link + require: "ngModel" + } + +module.directive("tgDateSelector", DateSelectorDirective) + + ############################################################################# ## Sprint Progress Bar Directive ############################################################################# @@ -76,30 +103,48 @@ module.directive("tgSprintProgressbar", SprintProgressBarDirective) ############################################################################# -## Date Selector Directive (using pikaday) +## Created-by display directive ############################################################################# -DateSelectorDirective =-> - link = ($scope, $el, $attrs, $model) -> - selectedDate = null - $el.picker = new Pikaday({ - field: $el[0] - format: "DD MMM YYYY" - onSelect: (date) => - selectedDate = date - onOpen: => - $el.picker.setDate(selectedDate) if selectedDate? - }) +CreatedByDisplayDirective = -> + # Display the owner information (full name and photo) and the date of + # creation of an object (like USs, tasks and issues). + # + # Example: + # div.us-created-by(tg-created-by-display, ng-model="us") + # + # Requirements: + # - model object must have the attributes 'created_date' and 'owner' + # - scope.usersById object is required. - $scope.$watch $attrs.ngModel, (val) -> - $el.picker.setDate(val) if val? + template = _.template(""" +