diff --git a/app/modules/history/history-tabs/history-tabs.directive.coffee b/app/modules/history/history-tabs/history-tabs.directive.coffee index fdadb250..e7e48e74 100644 --- a/app/modules/history/history-tabs/history-tabs.directive.coffee +++ b/app/modules/history/history-tabs/history-tabs.directive.coffee @@ -20,10 +20,11 @@ module = angular.module('taigaHistory') HistoryTabsDirective = () -> - return { templateUrl:"history/history-tabs/history-tabs.html", scope: { + showCommentTab: "&", + showActivityTab: "&" onActiveComments: "&", onActiveActivities: "&", onOrderComments: "&" diff --git a/app/modules/history/history-tabs/history-tabs.jade b/app/modules/history/history-tabs/history-tabs.jade index deb458de..d9e25e30 100644 --- a/app/modules/history/history-tabs/history-tabs.jade +++ b/app/modules/history/history-tabs/history-tabs.jade @@ -1,5 +1,6 @@ nav.history-tabs a.history-tab.e2e-comments-tab( + ng-if="showCommentTab()" href="" title="{{COMMENTS.COMMENT}}" ng-click="onActiveComments()" @@ -8,6 +9,7 @@ nav.history-tabs translate-values="{comments: commentsNum}" ) a.history-tab.e2e-activity-tab( + ng-if="showActivityTab()" href="" title="Activities" ng-click="onActiveActivities()" @@ -22,7 +24,7 @@ nav.history-tabs ng-class="{'new-first': top, 'old-first': !top}" ng-if="commentsNum > 1 && activeTab" ) - + span( translate="COMMENTS.OLDER_FIRST" ng-if="onReverse" diff --git a/app/modules/history/history.controller.coffee b/app/modules/history/history.controller.coffee index c419fd64..d80a5ec0 100644 --- a/app/modules/history/history.controller.coffee +++ b/app/modules/history/history.controller.coffee @@ -24,9 +24,10 @@ class HistorySectionController "$tgResources", "$tgRepo", "$tgStorage", + "tgProjectService", ] - constructor: (@rs, @repo, @storage) -> + constructor: (@rs, @repo, @storage, @projectService) -> @.editing = null @.deleting = null @.editMode = {} @@ -49,6 +50,15 @@ class HistorySectionController @.activities = _.filter(activities, (item) -> Object.keys(item.values_diff).length > 0) @.activitiesNum = @.activities.length + showHistorySection: () -> + return @.showCommentTab() or @.showActivityTab() + + showCommentTab: () -> + return @.commentsNum > 0 or @projectService.hasPermission("comment_#{@.name}") + + showActivityTab: () -> + return @.activitiesNum > 0 + toggleEditMode: (commentId) -> @.editMode[commentId] = !@.editMode[commentId] diff --git a/app/modules/history/history.jade b/app/modules/history/history.jade index 86ee999a..eaa9af8d 100644 --- a/app/modules/history/history.jade +++ b/app/modules/history/history.jade @@ -1,5 +1,9 @@ -section.history +section.history( + ng-if="vm.showHistorySection()" +) tg-history-tabs( + show-comment-tab="vm.showCommentTab()" + show-activity-tab="vm.showActivityTab()" on-active-comments="vm.onActiveHistoryTab(true)" on-active-activities="vm.onActiveHistoryTab(false)" active-tab="vm.viewComments",