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) -> getUserAvatar: (userId) ->
return @scope.usersById[userId]?.photo 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) -> buildChangesText: (comment) ->
size = Object.keys(comment.diff).length size = @.countChanges(comment)
#TODO: i18n #TODO: i18n
if size == 1 if size == 1
return "Made #{size} change" return "Made #{size} change"
@ -140,6 +148,15 @@ IssueDirective = ($tgrepo, $log, $location) ->
$tgrepo.save($scope.issue).then -> $tgrepo.save($scope.issue).then ->
$location.path("/project/#{$scope.project.slug}/issues/#{$scope.issue.ref}") $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} return {link:link}
module.directive("tgIssueDetail", ["$tgRepo", "$log", "$tgLocation", IssueDirective]) module.directive("tgIssueDetail", ["$tgRepo", "$log", "$tgLocation", IssueDirective])
@ -510,5 +527,4 @@ CommentDirective = () ->
return {link:link} return {link:link}
module.directive("tgComment", CommentDirective) module.directive("tgComment", CommentDirective)

View File

@ -41,8 +41,10 @@ block content
a(href="#") a(href="#")
span.icon.icon-issues span.icon.icon-issues
span.tab-title Activity span.tab-title Activity
include views/modules/comments include views/modules/comments
// include views/modules/activity include views/modules/activity
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.assigned_to") section.us-assigned-to(tg-assigned-to, ng-model="issue.assigned_to")

View File

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

View File

@ -1,13 +1,14 @@
div.us-activity 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(tg-bo-html="ctrl.buildChangesText(comment)")
span.icon.icon-arrow-up 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 div.activity-changed
span(tg-bo-html="key") span(tg-bo-html="key")
div.activity-fromto div.activity-fromto
p p
strong from <br /> {{ change[0] }} strong from <br /> {{ ctrl.getChangeText(change[0]) }}
p p
strong to <br /> {{ change[1] }} strong to <br /> {{ ctrl.getChangeText(change[1]) }}

View File

@ -1,6 +1,6 @@
section.us-comments section.us-comments
div.add-comment 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 a.button.button-green(href="", title="Comment") Comment
div.comment-list div.comment-list
div.comment-single(tg-comment, ng-repeat="comment in comments") div.comment-single(tg-comment, ng-repeat="comment in comments")
@ -13,7 +13,7 @@ section.us-comments
include comment-activity include comment-activity
p.comment {{ comment.comment }} p.comment {{ comment.comment }}
p.date {{ comment.created_at | date:'yyyy-MM-dd HH:mm' }} 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") //a.more-comments(href="", title="show more comments")
//span show previous comments //span show previous comments

View File

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