Showing only columns related no enabled features

stable
Alejandro Alonso 2014-11-27 13:26:56 +01:00 committed by Jesús Espino
parent 9177f172f4
commit 33bb54e453
2 changed files with 29 additions and 16 deletions

View File

@ -90,6 +90,10 @@ class TeamController extends mixOf(taiga.Controller, taiga.PageMixin)
@scope.project = project @scope.project = project
@scope.$emit('project:loaded', project) @scope.$emit('project:loaded', project)
@scope.issuesEnabled = project.is_issues_activated
@scope.tasksEnabled = project.is_kanban_activated or project.is_backlog_activated
@scope.wikiEnabled = project.is_wiki_activated
return project return project
loadMemberStats: -> loadMemberStats: ->
@ -166,19 +170,19 @@ module.directive("tgTeamFilters", [TeamFiltersDirective])
TeamMemberStatsDirective = () -> TeamMemberStatsDirective = () ->
template = """ template = """
<div class="attribute"> <div class="attribute" ng-if="issuesEnabled">
<span class="icon icon-briefcase" ng-style="{'opacity': stats.closed_bugs[userId]}" ng-class="{'top': stats.closed_bugs[userId] == 1}"></span> <span class="icon icon-briefcase" ng-style="{'opacity': stats.closed_bugs[userId]}" ng-class="{'top': stats.closed_bugs[userId] == 1}"></span>
</div> </div>
<div class="attribute"> <div class="attribute" ng-if="tasksEnabled">
<span class="icon icon-iocaine" ng-style="{'opacity': stats.iocaine_tasks[userId]}" ng-class="{'top': stats.iocaine_tasks[userId] == 1}"></span> <span class="icon icon-iocaine" ng-style="{'opacity': stats.iocaine_tasks[userId]}" ng-class="{'top': stats.iocaine_tasks[userId] == 1}"></span>
</div> </div>
<div class="attribute"> <div class="attribute" ng-if="wikiEnabled">
<span class="icon icon-writer" ng-style="{'opacity': stats.wiki_changes[userId]}" ng-class="{'top': stats.wiki_changes[userId] == 1}"></span> <span class="icon icon-writer" ng-style="{'opacity': stats.wiki_changes[userId]}" ng-class="{'top': stats.wiki_changes[userId] == 1}"></span>
</div> </div>
<div class="attribute"> <div class="attribute" ng-if="issuesEnabled">
<span class="icon icon-bug" ng-style="{'opacity': stats.created_bugs[userId]}" ng-class="{'top': stats.created_bugs[userId] == 1}"></span> <span class="icon icon-bug" ng-style="{'opacity': stats.created_bugs[userId]}" ng-class="{'top': stats.created_bugs[userId] == 1}"></span>
</div> </div>
<div class="attribute"> <div class="attribute" ng-if="tasksEnabled">
<span class="icon icon-tasks" ng-style="{'opacity': stats.closed_tasks[userId]}" ng-class="{'top': stats.closed_tasks[userId] == 1}"></span> <span class="icon icon-tasks" ng-style="{'opacity': stats.closed_tasks[userId]}" ng-class="{'top': stats.closed_tasks[userId] == 1}"></span>
</div> </div>
<div class="attribute"> <div class="attribute">
@ -188,8 +192,11 @@ TeamMemberStatsDirective = () ->
return { return {
template: template, template: template,
scope: { scope: {
"stats": "=", stats: "=",
"userId": "=user" userId: "=user"
issuesEnabled: "=issuesenabled"
tasksEnabled: "=tasksenabled"
wikiEnabled: "=wikienabled"
} }
} }
@ -212,7 +219,7 @@ TeamMemberCurrentUserDirective = () ->
</figcaption> </figcaption>
</figure> </figure>
</div> </div>
<div class="member-stats" tg-team-member-stats stats="stats" user="currentUser.user"></div> <div class="member-stats" tg-team-member-stats stats="stats" user="currentUser.user" issuesEnabled="issuesEnabled", tasksenabled="tasksEnabled", wikienabled="wikiEnabled"></div>
</div> </div>
""" """
return { return {
@ -221,6 +228,9 @@ TeamMemberCurrentUserDirective = () ->
projectId: "=projectid", projectId: "=projectid",
currentUser: "=currentuser", currentUser: "=currentuser",
stats: "=" stats: "="
issuesEnabled: "=issuesenabled"
tasksEnabled: "=tasksenabled"
wikiEnabled: "=wikienabled"
} }
} }
@ -242,7 +252,7 @@ TeamMembersDirective = () ->
</figcaption> </figcaption>
</figure> </figure>
</div> </div>
<div class="member-stats" tg-team-member-stats stats="stats" user="user.user"></div> <div class="member-stats" tg-team-member-stats stats="stats" user="user.user" issuesEnabled="issuesEnabled", tasksenabled="tasksEnabled", wikienabled="wikiEnabled"></div>
</div> </div>
""" """
return { return {
@ -252,6 +262,9 @@ TeamMembersDirective = () ->
filtersQ: "=filtersq", filtersQ: "=filtersq",
filtersRole: "=filtersrole", filtersRole: "=filtersrole",
stats: "=" stats: "="
issuesEnabled: "=issuesenabled"
tasksEnabled: "=tasksenabled"
wikiEnabled: "=wikienabled"
} }
} }

View File

@ -1,23 +1,23 @@
section.table-team.basic-table section.table-team.basic-table
header.row.team-header header.row.team-header
div.username div.username
div.attribute.attribute-name div.attribute.attribute-name(ng-if="issuesEnabled")
span Mr. Wolf span Mr. Wolf
div.popover.attribute-explanation div.popover.attribute-explanation
span I see, you solve issues! span I see, you solve issues!
div.attribute div.attribute(ng-if="tasksEnabled")
span Poison Drinker span Poison Drinker
div.popover.attribute-explanation div.popover.attribute-explanation
span Hey, are you a iocaine-holic? span Hey, are you a iocaine-holic?
div.attribute div.attribute(ng-if="wikiEnabled")
span Cervantes span Cervantes
div.popover.attribute-explanation div.popover.attribute-explanation
span You have no fear to the blank page! span You have no fear to the blank page!
div.attribute div.attribute(ng-if="issuesEnabled")
Total Bug Hunter Total Bug Hunter
div.popover.attribute-explanation div.popover.attribute-explanation
span Thaks to you, this project still alive. span Thaks to you, this project still alive.
div.attribute div.attribute(ng-if="tasksEnabled")
span Night Shift span Night Shift
div.popover.attribute-explanation div.popover.attribute-explanation
span Poor Devil, you work too much. span Poor Devil, you work too much.
@ -26,10 +26,10 @@ section.table-team.basic-table
div.popover.attribute-explanation div.popover.attribute-explanation
span How far did you go into this Taiga? span How far did you go into this Taiga?
div.hero(tg-team-current-user, stats="stats", currentuser="currentUser", projectid="projectId") div.hero(tg-team-current-user, stats="stats", currentuser="currentUser", projectid="projectId", issuesEnabled="issuesEnabled", tasksenabled="tasksEnabled", wikienabled="wikiEnabled")
h2(ng-show="memberships") h2(ng-show="memberships")
span Team > span Team >
span {{filtersRole.name || "All"}} span {{filtersRole.name || "All"}}
section.table-team.basic-table(tg-team-members, memberships="memberships", stats="stats", filtersq="filtersQ", filtersrole="filtersRole") section.table-team.basic-table(tg-team-members, memberships="memberships", stats="stats", filtersq="filtersQ", filtersrole="filtersRole", issuesEnabled="issuesEnabled", tasksenabled="tasksEnabled", wikienabled="wikiEnabled")