Move some directives to commons.
parent
3de74a6e3e
commit
938cf024a7
|
@ -75,8 +75,12 @@ DateSelectorDirective =->
|
||||||
## User story status directive
|
## User story status directive
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
|
|
||||||
|
# TODO: change to less generic name.
|
||||||
|
|
||||||
UsStatusDirective = ($repo) ->
|
UsStatusDirective = ($repo) ->
|
||||||
### Print the status of a US and a popover to change it.
|
###
|
||||||
|
Print the status of a US and a popover to change it.
|
||||||
- tg-us-status: The user story
|
- tg-us-status: The user story
|
||||||
- on-update: Method call after US is updated
|
- on-update: Method call after US is updated
|
||||||
|
|
||||||
|
@ -96,8 +100,7 @@ UsStatusDirective = ($repo) ->
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<% }); %>
|
<% }); %>
|
||||||
</ul>
|
</ul>""")
|
||||||
""")
|
|
||||||
|
|
||||||
updateUsStatus = ($el, us, usStatusById) ->
|
updateUsStatus = ($el, us, usStatusById) ->
|
||||||
usStatusDomParent = $el.find(".us-status")
|
usStatusDomParent = $el.find(".us-status")
|
||||||
|
@ -140,8 +143,94 @@ UsStatusDirective = ($repo) ->
|
||||||
return {link: link}
|
return {link: link}
|
||||||
|
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
|
## List directives (Issues List, Search)
|
||||||
|
#############################################################################
|
||||||
|
|
||||||
|
ListItemIssueStatusDirective = ->
|
||||||
|
link = ($scope, $el, $attrs) ->
|
||||||
|
issue = $scope.$eval($attrs.tgListitemIssueStatus)
|
||||||
|
bindOnce $scope, "issueStatusById", (issueStatusById) ->
|
||||||
|
$el.html(issueStatusById[issue.status].name)
|
||||||
|
|
||||||
|
return {link:link}
|
||||||
|
|
||||||
|
|
||||||
|
ListItemAssignedtoDirective = ->
|
||||||
|
template = """
|
||||||
|
<figure class="avatar">
|
||||||
|
<img src="" alt="username"/>
|
||||||
|
<figcaption>--</figcaption>
|
||||||
|
</figure>
|
||||||
|
"""
|
||||||
|
|
||||||
|
link = ($scope, $el, $attrs) ->
|
||||||
|
issue = $scope.$eval($attrs.tgListitemAssignedto)
|
||||||
|
if issue.assigned_to is null
|
||||||
|
$el.find("figcaption").html("Unassigned")
|
||||||
|
else
|
||||||
|
bindOnce $scope, "membersById", (membersById) ->
|
||||||
|
member = membersById[issue.assigned_to]
|
||||||
|
console.log member
|
||||||
|
$el.find("figcaption").html(member.full_name)
|
||||||
|
$el.find("img").attr("src", member.photo)
|
||||||
|
|
||||||
|
return {
|
||||||
|
template: template
|
||||||
|
link:link
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ListItemPriorityDirective = ->
|
||||||
|
template = """
|
||||||
|
<div class="level"></div>
|
||||||
|
"""
|
||||||
|
|
||||||
|
link = ($scope, $el, $attrs) ->
|
||||||
|
issue = $scope.$eval($attrs.tgListitemPriority)
|
||||||
|
bindOnce $scope, "priorityById", (priorityById) ->
|
||||||
|
priority = priorityById[issue.priority]
|
||||||
|
|
||||||
|
domNode = $el.find("div.level")
|
||||||
|
domNode.css("background-color", priority.color)
|
||||||
|
domNode.addClass(priority.name.toLowerCase())
|
||||||
|
domNode.attr("title", priority.name)
|
||||||
|
|
||||||
|
return {
|
||||||
|
link: link
|
||||||
|
template: template
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ListItemSeverityDirective = ->
|
||||||
|
template = """
|
||||||
|
<div class="level"></div>
|
||||||
|
"""
|
||||||
|
|
||||||
|
link = ($scope, $el, $attrs) ->
|
||||||
|
issue = $scope.$eval($attrs.tgListitemSeverity)
|
||||||
|
bindOnce $scope, "severityById", (severityById) ->
|
||||||
|
severity = severityById[issue.severity]
|
||||||
|
|
||||||
|
domNode = $el.find("div.level")
|
||||||
|
domNode.css("background-color", severity.color)
|
||||||
|
domNode.addClass(severity.name.toLowerCase())
|
||||||
|
domNode.attr("title", severity.name)
|
||||||
|
|
||||||
|
return {
|
||||||
|
link: link
|
||||||
|
template: template
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
module = angular.module("taigaCommon")
|
module = angular.module("taigaCommon")
|
||||||
module.directive("tgDateRange", DateRangeDirective)
|
module.directive("tgDateRange", DateRangeDirective)
|
||||||
module.directive("tgSprintProgressbar", SprintProgressBarDirective)
|
module.directive("tgSprintProgressbar", SprintProgressBarDirective)
|
||||||
module.directive("tgDateSelector", DateSelectorDirective)
|
module.directive("tgDateSelector", DateSelectorDirective)
|
||||||
module.directive("tgUsStatus", ["$tgRepo", UsStatusDirective])
|
module.directive("tgUsStatus", ["$tgRepo", UsStatusDirective])
|
||||||
|
|
||||||
|
module.directive("tgListitemIssueStatus", ListItemIssueStatusDirective)
|
||||||
|
module.directive("tgListitemAssignedto", ListItemAssignedtoDirective)
|
||||||
|
module.directive("tgListitemPriority", ListItemPriorityDirective)
|
||||||
|
module.directive("tgListitemSeverity", ListItemSeverityDirective)
|
||||||
|
|
||||||
|
|
|
@ -235,82 +235,4 @@ IssuesDirective = ($log, $location) ->
|
||||||
return {link:link}
|
return {link:link}
|
||||||
|
|
||||||
|
|
||||||
IssueStatusDirective = ->
|
|
||||||
link = ($scope, $el, $attrs) ->
|
|
||||||
issue = $scope.$eval($attrs.tgIssueStatus)
|
|
||||||
bindOnce $scope, "issueStatusById", (issueStatusById) ->
|
|
||||||
$el.html(issueStatusById[issue.status].name)
|
|
||||||
|
|
||||||
return {link:link}
|
|
||||||
|
|
||||||
|
|
||||||
IssueAssignedtoDirective = ->
|
|
||||||
template = """
|
|
||||||
<figure class="avatar">
|
|
||||||
<img src="http://thecodeplayer.com/u/uifaces/12.jpg" alt="username"/>
|
|
||||||
<figcaption>--</figcaption>
|
|
||||||
</figure>
|
|
||||||
"""
|
|
||||||
|
|
||||||
link = ($scope, $el, $attrs) ->
|
|
||||||
issue = $scope.$eval($attrs.tgIssueAssignedto)
|
|
||||||
if issue.assigned_to is null
|
|
||||||
$el.find("figcaption").html("Unassigned")
|
|
||||||
else
|
|
||||||
bindOnce $scope, "membersById", (membersById) ->
|
|
||||||
memberName = membersById[issue.assigned_to].full_name_display
|
|
||||||
$el.find("figcaption").html(memberName)
|
|
||||||
|
|
||||||
return {
|
|
||||||
template: template
|
|
||||||
link:link
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
IssuePriorityDirective = ->
|
|
||||||
template = """
|
|
||||||
<div class="level"></div>
|
|
||||||
"""
|
|
||||||
|
|
||||||
link = ($scope, $el, $attrs) ->
|
|
||||||
issue = $scope.$eval($attrs.tgIssuePriority)
|
|
||||||
bindOnce $scope, "priorityById", (priorityById) ->
|
|
||||||
priority = priorityById[issue.priority]
|
|
||||||
|
|
||||||
domNode = $el.find("div.level")
|
|
||||||
domNode.css("background-color", priority.color)
|
|
||||||
domNode.addClass(priority.name.toLowerCase())
|
|
||||||
domNode.attr("title", priority.name)
|
|
||||||
|
|
||||||
return {
|
|
||||||
link: link
|
|
||||||
template: template
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
IssueSeverityDirective = ->
|
|
||||||
template = """
|
|
||||||
<div class="level"></div>
|
|
||||||
"""
|
|
||||||
|
|
||||||
link = ($scope, $el, $attrs) ->
|
|
||||||
issue = $scope.$eval($attrs.tgIssueSeverity)
|
|
||||||
bindOnce $scope, "severityById", (severityById) ->
|
|
||||||
severity = severityById[issue.severity]
|
|
||||||
|
|
||||||
domNode = $el.find("div.level")
|
|
||||||
domNode.css("background-color", severity.color)
|
|
||||||
domNode.addClass(severity.name.toLowerCase())
|
|
||||||
domNode.attr("title", severity.name)
|
|
||||||
|
|
||||||
return {
|
|
||||||
link: link
|
|
||||||
template: template
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
module.directive("tgIssues", ["$log", "$tgLocation", IssuesDirective])
|
module.directive("tgIssues", ["$log", "$tgLocation", IssuesDirective])
|
||||||
module.directive("tgIssueStatus", IssueStatusDirective)
|
|
||||||
module.directive("tgIssueAssignedto", IssueAssignedtoDirective)
|
|
||||||
module.directive("tgIssuePriority", IssuePriorityDirective)
|
|
||||||
module.directive("tgIssueSeverity", IssueSeverityDirective)
|
|
||||||
|
|
|
@ -6,10 +6,10 @@ section.issues-table.basic-table
|
||||||
div.issue-field Status
|
div.issue-field Status
|
||||||
div.assigned-field Assigned to
|
div.assigned-field Assigned to
|
||||||
div.row.table-main(ng-repeat="issue in issues track by issue.id")
|
div.row.table-main(ng-repeat="issue in issues track by issue.id")
|
||||||
div.level-field(tg-issue-severity="issue")
|
div.level-field(tg-listitem-severity="issue")
|
||||||
div.level-field(tg-issue-priority="issue")
|
div.level-field(tg-listitem-priority="issue")
|
||||||
div.subject
|
div.subject
|
||||||
a(href="", tg-nav="project-issues-detail:project=project.slug,ref=issue.ref",
|
a(href="", tg-nav="project-issues-detail:project=project.slug,ref=issue.ref",
|
||||||
tg-bo-html="issue.subject")
|
tg-bo-html="issue.subject")
|
||||||
div.issue-field(tg-issue-status="issue")
|
div.issue-field(tg-listitem-issue-status="issue")
|
||||||
div.assigned-field(tg-issue-assignedto="issue")
|
div.assigned-field(tg-listitem-assignedto="issue")
|
||||||
|
|
Loading…
Reference in New Issue