Show history section and its tabs only when it's needed
parent
62a20552a4
commit
2cc8b2e458
|
@ -20,10 +20,11 @@
|
||||||
module = angular.module('taigaHistory')
|
module = angular.module('taigaHistory')
|
||||||
|
|
||||||
HistoryTabsDirective = () ->
|
HistoryTabsDirective = () ->
|
||||||
|
|
||||||
return {
|
return {
|
||||||
templateUrl:"history/history-tabs/history-tabs.html",
|
templateUrl:"history/history-tabs/history-tabs.html",
|
||||||
scope: {
|
scope: {
|
||||||
|
showCommentTab: "&",
|
||||||
|
showActivityTab: "&"
|
||||||
onActiveComments: "&",
|
onActiveComments: "&",
|
||||||
onActiveActivities: "&",
|
onActiveActivities: "&",
|
||||||
onOrderComments: "&"
|
onOrderComments: "&"
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
nav.history-tabs
|
nav.history-tabs
|
||||||
a.history-tab.e2e-comments-tab(
|
a.history-tab.e2e-comments-tab(
|
||||||
|
ng-if="showCommentTab()"
|
||||||
href=""
|
href=""
|
||||||
title="{{COMMENTS.COMMENT}}"
|
title="{{COMMENTS.COMMENT}}"
|
||||||
ng-click="onActiveComments()"
|
ng-click="onActiveComments()"
|
||||||
|
@ -8,6 +9,7 @@ nav.history-tabs
|
||||||
translate-values="{comments: commentsNum}"
|
translate-values="{comments: commentsNum}"
|
||||||
)
|
)
|
||||||
a.history-tab.e2e-activity-tab(
|
a.history-tab.e2e-activity-tab(
|
||||||
|
ng-if="showActivityTab()"
|
||||||
href=""
|
href=""
|
||||||
title="Activities"
|
title="Activities"
|
||||||
ng-click="onActiveActivities()"
|
ng-click="onActiveActivities()"
|
||||||
|
|
|
@ -24,9 +24,10 @@ class HistorySectionController
|
||||||
"$tgResources",
|
"$tgResources",
|
||||||
"$tgRepo",
|
"$tgRepo",
|
||||||
"$tgStorage",
|
"$tgStorage",
|
||||||
|
"tgProjectService",
|
||||||
]
|
]
|
||||||
|
|
||||||
constructor: (@rs, @repo, @storage) ->
|
constructor: (@rs, @repo, @storage, @projectService) ->
|
||||||
@.editing = null
|
@.editing = null
|
||||||
@.deleting = null
|
@.deleting = null
|
||||||
@.editMode = {}
|
@.editMode = {}
|
||||||
|
@ -49,6 +50,15 @@ class HistorySectionController
|
||||||
@.activities = _.filter(activities, (item) -> Object.keys(item.values_diff).length > 0)
|
@.activities = _.filter(activities, (item) -> Object.keys(item.values_diff).length > 0)
|
||||||
@.activitiesNum = @.activities.length
|
@.activitiesNum = @.activities.length
|
||||||
|
|
||||||
|
showHistorySection: () ->
|
||||||
|
return @.showCommentTab() or @.showActivityTab()
|
||||||
|
|
||||||
|
showCommentTab: () ->
|
||||||
|
return @.commentsNum > 0 or @projectService.hasPermission("comment_#{@.name}")
|
||||||
|
|
||||||
|
showActivityTab: () ->
|
||||||
|
return @.activitiesNum > 0
|
||||||
|
|
||||||
toggleEditMode: (commentId) ->
|
toggleEditMode: (commentId) ->
|
||||||
@.editMode[commentId] = !@.editMode[commentId]
|
@.editMode[commentId] = !@.editMode[commentId]
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
section.history
|
section.history(
|
||||||
|
ng-if="vm.showHistorySection()"
|
||||||
|
)
|
||||||
tg-history-tabs(
|
tg-history-tabs(
|
||||||
|
show-comment-tab="vm.showCommentTab()"
|
||||||
|
show-activity-tab="vm.showActivityTab()"
|
||||||
on-active-comments="vm.onActiveHistoryTab(true)"
|
on-active-comments="vm.onActiveHistoryTab(true)"
|
||||||
on-active-activities="vm.onActiveHistoryTab(false)"
|
on-active-activities="vm.onActiveHistoryTab(false)"
|
||||||
active-tab="vm.viewComments",
|
active-tab="vm.viewComments",
|
||||||
|
|
Loading…
Reference in New Issue