Bug #685: Show creation date of an item

stable
David Barragán Merino 2014-08-27 16:14:18 +02:00
parent 738e66d333
commit 9b857c172e
9 changed files with 52 additions and 66 deletions

View File

@ -272,52 +272,6 @@ AssignedToDirective = ($rootscope, $confirm) ->
module.directive("tgAssignedTo", ["$rootScope", "$tgConfirm", AssignedToDirective]) module.directive("tgAssignedTo", ["$rootScope", "$tgConfirm", AssignedToDirective])
#############################################################################
## Created by directive
#############################################################################
CreatedByDirective = ->
# TODO: i18n
template = _.template("""
<div class="user-avatar">
<img src="<%= owner.photo %>" alt="<%- owner.full_name_display %>" />
</div>
<div class="created-by">
<span class="assigned-title">Created by</span>
<a href="" title="edit assignment" class="user-assigned">
<%- owner.full_name_display %>
</a>
<span class="assigned-title"><%- date %></span>
</div>
""")
link = ($scope, $el, $attrs, $model) ->
renderAssignedTo = (instance) ->
owner = {}
date = null
if instance?
ownerId = instance.owner
date = moment(instance.created_date).format("DD MMM YYYY HH:mm")
owner = $scope.usersById?[ownerId]
html = template({owner: owner, date: date})
$el.html(html)
$scope.$watch $attrs.ngModel, (instance) ->
renderAssignedTo(instance)
return {
link:link,
require:"ngModel"
}
module.directive("tgCreatedBy", CreatedByDirective)
############################################################################# #############################################################################
## Common list directives ## Common list directives
############################################################################# #############################################################################

View File

@ -226,6 +226,16 @@ IssueStatusDirective = () ->
</span> </span>
<span class="us-detail-status" style="color:<%= status.color %>"><%= status.name %></span> <span class="us-detail-status" style="color:<%= status.color %>"><%= status.name %></span>
</h1> </h1>
<div class="us-created-by">
<div class="user-avatar">
<img src="<%= owner.photo %>" alt="<%- owner.full_name_display %>" />
</div>
<div class="created-by">
<span class="created-title">Created by <%- owner.full_name_display %></span>
<span class="created-date"><%- date %></span>
</div>
</div>
<div class="issue-data"> <div class="issue-data">
<div class="type-data <% if (editable) { %>clickable<% } %>"> <div class="type-data <% if (editable) { %>clickable<% } %>">
<span class="level" style="background-color:<%= type.color %>"></span> <span class="level" style="background-color:<%= type.color %>"></span>
@ -298,11 +308,15 @@ IssueStatusDirective = () ->
editable = $attrs.editable? editable = $attrs.editable?
renderIssuestatus = (issue) -> renderIssuestatus = (issue) ->
owner = $scope.usersById?[issue.owner]
date = moment(issue.created_date).format("DD MMM YYYY HH:mm")
type = $scope.typeById[issue.type] type = $scope.typeById[issue.type]
status = $scope.statusById[issue.status] status = $scope.statusById[issue.status]
severity = $scope.severityById[issue.severity] severity = $scope.severityById[issue.severity]
priority = $scope.priorityById[issue.priority] priority = $scope.priorityById[issue.priority]
html = template({ html = template({
owner: owner
date: date
editable: editable editable: editable
status: status status: status
severity: severity severity: severity

View File

@ -219,6 +219,17 @@ TaskStatusDirective = () ->
<% } %> <% } %>
<span class="us-detail-status" style="color:<%= status.color %>"><%= status.name %></span> <span class="us-detail-status" style="color:<%= status.color %>"><%= status.name %></span>
</h1> </h1>
<div class="us-created-by">
<div class="user-avatar">
<img src="<%= owner.photo %>" alt="<%- owner.full_name_display %>" />
</div>
<div class="created-by">
<span class="created-title">Created by</span>
<span class="created-user"><%- owner.full_name_display %></span>
<span class="created-date"><%- date %></span>
</div>
</div>
<div class="issue-data"> <div class="issue-data">
<div class="status-data <% if (editable) { %>clickable<% } %>"> <div class="status-data <% if (editable) { %>clickable<% } %>">
<span class="level" style="background-color:<%= status.color %>"></span> <span class="level" style="background-color:<%= status.color %>"></span>
@ -243,8 +254,12 @@ TaskStatusDirective = () ->
editable = $attrs.editable? editable = $attrs.editable?
renderTaskstatus = (task) -> renderTaskstatus = (task) ->
owner = $scope.usersById?[task.owner]
date = moment(task.created_date).format("DD MMM YYYY HH:mm")
status = $scope.statusById[task.status] status = $scope.statusById[task.status]
html = template({ html = template({
owner: owner
date: date
editable: editable editable: editable
status: status status: status
}) })

View File

@ -239,6 +239,18 @@ UsStatusDetailDirective = () ->
</span> </span>
</div> </div>
<div class="us-created-by">
<div class="user-avatar">
<img src="<%= owner.photo %>" alt="<%- owner.full_name_display %>" />
</div>
<div class="created-by">
<span class="created-title">Created by</span>
<span class="created-user"><%- owner.full_name_display %></span>
<span class="created-date"><%- date %></span>
</div>
</div>
<ul class="points-per-role"> <ul class="points-per-role">
<li class="total"> <li class="total">
<span class="points"><%- totalPoints %></span> <span class="points"><%- totalPoints %></span>
@ -301,6 +313,8 @@ UsStatusDetailDirective = () ->
return _.reduce(values, (acc, num) -> acc + num) return _.reduce(values, (acc, num) -> acc + num)
renderUsstatus = (us) -> renderUsstatus = (us) ->
owner = $scope.usersById?[us.owner]
date = moment(us.created_date).format("DD MMM YYYY HH:mm")
status = $scope.statusById[us.status] status = $scope.statusById[us.status]
rolePoints = _.clone(_.filter($scope.project.roles, "computable"), true) rolePoints = _.clone(_.filter($scope.project.roles, "computable"), true)
_.map rolePoints, (v, k) -> _.map rolePoints, (v, k) ->
@ -313,6 +327,8 @@ UsStatusDetailDirective = () ->
usProgress = 0 usProgress = 0
usProgress = 100 * totalClosedTasks / totalTasks if totalTasks > 0 usProgress = 100 * totalClosedTasks / totalTasks if totalTasks > 0
html = template({ html = template({
owner: owner
date: date
editable: editable editable: editable
status: status status: status
totalPoints: us.total_points totalPoints: us.total_points

View File

@ -51,7 +51,6 @@ block content
sidebar.menu-secondary.sidebar sidebar.menu-secondary.sidebar
section.us-status(tg-issue-status, ng-model="issue", editable="true") section.us-status(tg-issue-status, ng-model="issue", editable="true")
section.us-assigned-to(tg-assigned-to, ng-model="issue", editable="true") section.us-assigned-to(tg-assigned-to, ng-model="issue", editable="true")
section.us-created-by(tg-created-by, ng-model="issue")
section.watchers(tg-watchers, ng-model="issue", editable="true") section.watchers(tg-watchers, ng-model="issue", editable="true")
section.us-detail-settings section.us-detail-settings

View File

@ -51,5 +51,4 @@ block content
sidebar.menu-secondary.sidebar sidebar.menu-secondary.sidebar
section.us-status(tg-issue-status, ng-model="issue") section.us-status(tg-issue-status, ng-model="issue")
section.us-assigned-to(tg-assigned-to, ng-model="issue") section.us-assigned-to(tg-assigned-to, ng-model="issue")
section.us-created-by(tg-created-by, ng-model="issue")
section.watchers(tg-watchers, ng-model="issue") section.watchers(tg-watchers, ng-model="issue")

View File

@ -51,7 +51,6 @@ block content
sidebar.menu-secondary.sidebar sidebar.menu-secondary.sidebar
section.us-status(tg-task-status, ng-model="task") section.us-status(tg-task-status, ng-model="task")
section.us-assigned-to(tg-assigned-to, ng-model="task") section.us-assigned-to(tg-assigned-to, ng-model="task")
section.us-created-by(tg-created-by, ng-model="task")
section.watchers(tg-watchers, ng-model="task") section.watchers(tg-watchers, ng-model="task")
section.us-detail-settings section.us-detail-settings

View File

@ -51,7 +51,6 @@ block content
sidebar.menu-secondary.sidebar sidebar.menu-secondary.sidebar
section.us-status(tg-us-status-detail, ng-model="us", editable="true") section.us-status(tg-us-status-detail, ng-model="us", editable="true")
section.us-assigned-to(tg-assigned-to, ng-model="us", editable="true") section.us-assigned-to(tg-assigned-to, ng-model="us", editable="true")
section.us-created-by(tg-created-by, ng-model="us")
section.watchers(tg-watchers, ng-model="us", editable="true") section.watchers(tg-watchers, ng-model="us", editable="true")
section.us-detail-settings section.us-detail-settings

View File

@ -1,24 +1,25 @@
.us-created-by { .us-created-by {
@include table-flex(); @include table-flex();
margin-top: .5rem; margin-top: .5rem;
margin-bottom: 1rem;
position: relative; position: relative;
.user-avatar { .user-avatar {
@include table-flex-child(1, 0); @include table-flex-child(0, 40px, 0);
img { img {
border-radius: 8%; border-radius: 8%;
width: 100%; width: 100%;
} }
} }
.created-by { .created-by {
@include table-flex-child(3, 0); @include table-flex-child(3, 70px, 0);
margin-left: 1rem; margin-left: .5rem;
margin-top: 5px; .created-title,
.assigned-title { .created-date {
@extend %small; @extend %small;
color: $gray-light; color: $gray-light;
display: block; display: block;
} }
.user-assigned { .created-user {
@extend %large; @extend %large;
color: $green-taiga; color: $green-taiga;
cursor: default; cursor: default;
@ -26,15 +27,5 @@
cursor: pointer; cursor: pointer;
} }
} }
.icon-delete {
color: $gray-light;
opacity: 1;
position: absolute;
right: 1rem;
top: 1rem;
&:hover {
color: $red;
}
}
} }
} }