Including timeline

stable
Alejandro Alonso 2014-07-07 14:17:04 +02:00
parent d2e7673216
commit 19723d7360
6 changed files with 60 additions and 41 deletions

View File

@ -99,8 +99,16 @@ class IssueDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
getUserAvatar: (userId) ->
return @scope.usersById[userId]?.photo
countChanges: (comment) ->
return Object.keys(comment.values_diff).length
getChangeText: (change) ->
if _.isArray(change)
return change.join(", ")
return change
buildChangesText: (comment) ->
size = Object.keys(comment.diff).length
size = @.countChanges(comment)
#TODO: i18n
if size == 1
return "Made #{size} change"
@ -140,6 +148,15 @@ IssueDirective = ($tgrepo, $log, $location) ->
$tgrepo.save($scope.issue).then ->
$location.path("/project/#{$scope.project.slug}/issues/#{$scope.issue.ref}")
$el.on "click", ".add-comment a.button-green", (event) ->
event.preventDefault()
$tgrepo.save($scope.issue).then ->
$ctrl.loadHistory()
$el.on "click", ".us-activity-tabs li a", (event) ->
$el.find(".us-activity-tabs li a").toggleClass("active")
$el.find(".us-activity section").toggleClass("hidden")
return {link:link}
module.directive("tgIssueDetail", ["$tgRepo", "$log", "$tgLocation", IssueDirective])
@ -510,5 +527,4 @@ CommentDirective = () ->
return {link:link}
module.directive("tgComment", CommentDirective)

View File

@ -41,8 +41,10 @@ block content
a(href="#")
span.icon.icon-issues
span.tab-title Activity
include views/modules/comments
// include views/modules/activity
include views/modules/activity
sidebar.menu-secondary.sidebar
section.us-status(tg-issue-status, ng-model="issue")
section.us-assigned-to(tg-assigned-to, ng-model="issue.assigned_to")

View File

@ -1,24 +1,23 @@
div.us-activity
- for(var x = 0; x < 6; x++)
div.activity-single
section.us-activity.hidden
div.activity-single(tg-comment, ng-repeat="comment in comments")
div.activity-user
a.avatar(href="", title="User preferences")
img(src="http://thecodeplayer.com/u/uifaces/12.jpg", alt="username")
a.avatar(href="", tg-bo-title="ctrl.getUserFullName(comment.user.pk)")
img(tg-bo-src="ctrl.getUserAvatar(comment.user.pk)", tg-bo-alt="ctrl.getUserFullName(comment.user.pk)")
div.activity-content
div.activity-username
a.username(href="", title="User name") User Name
span.date 15 junio 2014 15:30h
- for(var y = 0; y < 2; y++)
div.activity-inner
a.username(href="TODO", tg-bo-title="ctrl.getUserFullName(comment.user.pk)" tg-bo-html="ctrl.getUserFullName(comment.user.pk)")
span.date {{ comment.created_at | date:'yyyy-MM-dd HH:mm' }}
div.activity-inner(ng-repeat="(key, change) in comment.values_diff")
div.activity-changed
span US status
span(tg-bo-html="key")
div.activity-fromto
p
strong from <br />
Este es el título que tenía la historia
strong from <br /> {{ ctrl.getChangeText(change[0]) }}
p
strong to <br />
Este es el título que tenía la historia modificado
a.more-activity(href="", title="show more comments")
span show previous activity
span.prev-activity-num (3 more)
strong to <br /> {{ ctrl.getChangeText(change[1]) }}
//a.more-activity(href="", title="show more comments")
// span show previous activity
// span.prev-activity-num (3 more)

View File

@ -1,13 +1,14 @@
div.us-activity
a.activity-title(href="", title="Show activity")
a.activity-title(ng-show="ctrl.countChanges(comment)", href="", title="Show activity")
span(tg-bo-html="ctrl.buildChangesText(comment)")
span.icon.icon-arrow-up
div.activity-inner(ng-repeat="(key, change) in comment.diff")
div.activity-inner(ng-repeat="(key, change) in comment.values_diff")
div.activity-changed
span(tg-bo-html="key")
div.activity-fromto
p
strong from <br /> {{ change[0] }}
strong from <br /> {{ ctrl.getChangeText(change[0]) }}
p
strong to <br /> {{ change[1] }}
strong to <br /> {{ ctrl.getChangeText(change[1]) }}

View File

@ -1,6 +1,6 @@
section.us-comments
div.add-comment
textarea(placeholder="Write here a new commet")
textarea(placeholder="Write here a new commet", ng-model="issue.comment")
a.button.button-green(href="", title="Comment") Comment
div.comment-list
div.comment-single(tg-comment, ng-repeat="comment in comments")
@ -13,7 +13,7 @@ section.us-comments
include comment-activity
p.comment {{ comment.comment }}
p.date {{ comment.created_at | date:'yyyy-MM-dd HH:mm' }}
a.delete-comment.icon.icon-delete(href="", title="delete comment")
//a.delete-comment.icon.icon-delete(href="", title="delete comment")
//a.more-comments(href="", title="show more comments")
//span show previous comments

View File

@ -2,17 +2,18 @@
@include clearfix;
textarea {
@include transition(height .3s ease-in);
&:focus {
@include transition(height .3s ease-in);
height: 6rem;
+a {
display: inline-block;
}
}
// &:focus {
// @include transition(height .3s ease-in);
// height: 6rem;
// +a {
// display: inline-block;
// }
// }
}
a {
color: $white;
display: none;
// display: none;
display: inline-block;
float: right;
}
}