diff --git a/app/coffee/modules/common.coffee b/app/coffee/modules/common.coffee index 63a63282..fb33af7d 100644 --- a/app/coffee/modules/common.coffee +++ b/app/coffee/modules/common.coffee @@ -396,3 +396,16 @@ AnimationFrame = () -> return {add: add} module.factory("animationFrame", AnimationFrame) + +############################################################################# +## Open/close comment +############################################################################# + +ToggleCommentDirective = () -> + link = ($scope, $el, $attrs) -> + $el.find("textarea").on "focus", () -> + $el.addClass("active") + + return {link:link} + +module.directive("tgToggleComment", ToggleCommentDirective) diff --git a/app/partials/us-detail-edit.jade b/app/partials/us-detail-edit.jade index 5d4e5ef1..9413ab38 100644 --- a/app/partials/us-detail-edit.jade +++ b/app/partials/us-detail-edit.jade @@ -29,7 +29,21 @@ block content - var permissionSuffix = "us" include views/modules/attachments - textarea(ng-model="us.comment", placeholder="Write here a new commet") + section.us-activity + ul.us-activity-tabs + li + a.active(href="#") + span.icon.icon-bulk + span.tab-title Comments + + li + a(href="#") + span.icon.icon-issues + span.tab-title Activity + + - var commentModel = "us" + include views/modules/comments + include views/modules/activity sidebar.menu-secondary.sidebar section.us-status(tg-us-status-detail, ng-model="us", editable="true") diff --git a/app/partials/views/modules/comments.jade b/app/partials/views/modules/comments.jade index 00b69a1c..5e237171 100644 --- a/app/partials/views/modules/comments.jade +++ b/app/partials/views/modules/comments.jade @@ -1,7 +1,7 @@ //- NOTE: You must to define 'var commentModel' with the object model section.us-comments - div.add-comment(tg-check-permission, permission="modify_"+commentModel) + div.add-comment(tg-check-permission, tg-toggle-comment, permission="modify_"+commentModel) textarea(placeholder="Write here a new commet", ng-model="commentModel.comment") a.button.button-green(href="", title="Comment") Comment div.comment-list diff --git a/app/styles/modules/common/comments.scss b/app/styles/modules/common/comments.scss index 970bfb20..6f6d115c 100644 --- a/app/styles/modules/common/comments.scss +++ b/app/styles/modules/common/comments.scss @@ -2,16 +2,26 @@ @include clearfix; textarea { float: left; + height: 41px; margin-bottom: .5rem; - &.active { - @include transition(height .3s ease-in); - height: 6rem; - } + min-height: inherit; } a { color: $white; float: right; } + .button-green { + display: none; + } + &.active { + .button-green { + display: block; + } + textarea { + @include transition(height .3s ease-in); + height: 6rem; + } + } } .comment-single {