edit issue type
parent
7e7ed1c656
commit
f074bd2ead
|
@ -62,6 +62,8 @@ class IssueDetailController extends mixOf(taiga.Controller, taiga.PageMixin, tai
|
||||||
@scope.$emit('project:loaded', project)
|
@scope.$emit('project:loaded', project)
|
||||||
@scope.statusList = project.issue_statuses
|
@scope.statusList = project.issue_statuses
|
||||||
@scope.statusById = groupBy(project.issue_statuses, (x) -> x.id)
|
@scope.statusById = groupBy(project.issue_statuses, (x) -> x.id)
|
||||||
|
@scope.typeById = groupBy(project.issue_types, (x) -> x.id)
|
||||||
|
@scope.typeList = _.sortBy(project.issue_types, "order")
|
||||||
@scope.severityList = project.severities
|
@scope.severityList = project.severities
|
||||||
@scope.severityById = groupBy(project.severities, (x) -> x.id)
|
@scope.severityById = groupBy(project.severities, (x) -> x.id)
|
||||||
@scope.priorityList = project.priorities
|
@scope.priorityList = project.priorities
|
||||||
|
@ -196,6 +198,11 @@ IssueStatusDirective = () ->
|
||||||
<span class="us-detail-status" style="color:<%= status.color %>"><%= status.name %></span>
|
<span class="us-detail-status" style="color:<%= status.color %>"><%= status.name %></span>
|
||||||
</h1>
|
</h1>
|
||||||
<div class="issue-data">
|
<div class="issue-data">
|
||||||
|
<div class="type-data <% if (editable) { %>clickable<% } %>">
|
||||||
|
<span class="level" style="background-color:<%= type.color %>"></span>
|
||||||
|
<span class="type-status"><%= type.name %></span>
|
||||||
|
<span class="level-name">type</span>
|
||||||
|
</div>
|
||||||
<div class="severity-data <% if (editable) { %>clickable<% } %>">
|
<div class="severity-data <% if (editable) { %>clickable<% } %>">
|
||||||
<span class="level" style="background-color:<%= severity.color %>"></span>
|
<span class="level" style="background-color:<%= severity.color %>"></span>
|
||||||
<span class="severity-status"><%= severity.name %></span>
|
<span class="severity-status"><%= severity.name %></span>
|
||||||
|
@ -213,6 +220,14 @@ IssueStatusDirective = () ->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
""")
|
""")
|
||||||
|
selectionTypeTemplate = _.template("""
|
||||||
|
<ul class="popover pop-type">
|
||||||
|
<% _.each(types, function(type) { %>
|
||||||
|
<li><a href="" class="type" title="<%- type.name %>"
|
||||||
|
data-type-id="<%- type.id %>"><%- type.name %></a></li>
|
||||||
|
<% }); %>
|
||||||
|
</ul>
|
||||||
|
""")
|
||||||
selectionSeverityTemplate = _.template("""
|
selectionSeverityTemplate = _.template("""
|
||||||
<ul class="popover pop-severity">
|
<ul class="popover pop-severity">
|
||||||
<% _.each(severities, function(severity) { %>
|
<% _.each(severities, function(severity) { %>
|
||||||
|
@ -242,6 +257,7 @@ IssueStatusDirective = () ->
|
||||||
editable = $attrs.editable?
|
editable = $attrs.editable?
|
||||||
|
|
||||||
renderIssuestatus = (issue) ->
|
renderIssuestatus = (issue) ->
|
||||||
|
type = $scope.typeById[issue.type]
|
||||||
status = $scope.statusById[issue.status]
|
status = $scope.statusById[issue.status]
|
||||||
severity = $scope.severityById[issue.severity]
|
severity = $scope.severityById[issue.severity]
|
||||||
priority = $scope.priorityById[issue.priority]
|
priority = $scope.priorityById[issue.priority]
|
||||||
|
@ -250,8 +266,10 @@ IssueStatusDirective = () ->
|
||||||
status: status
|
status: status
|
||||||
severity: severity
|
severity: severity
|
||||||
priority: priority
|
priority: priority
|
||||||
|
type: type
|
||||||
})
|
})
|
||||||
$el.html(html)
|
$el.html(html)
|
||||||
|
$el.find(".type-data").append(selectionTypeTemplate({types:$scope.typeList}))
|
||||||
$el.find(".severity-data").append(selectionSeverityTemplate({severities:$scope.severityList}))
|
$el.find(".severity-data").append(selectionSeverityTemplate({severities:$scope.severityList}))
|
||||||
$el.find(".priority-data").append(selectionPriorityTemplate({priorities:$scope.priorityList}))
|
$el.find(".priority-data").append(selectionPriorityTemplate({priorities:$scope.priorityList}))
|
||||||
$el.find(".status-data").append(selectionStatusTemplate({statuses:$scope.statusList}))
|
$el.find(".status-data").append(selectionStatusTemplate({statuses:$scope.statusList}))
|
||||||
|
@ -261,6 +279,19 @@ IssueStatusDirective = () ->
|
||||||
renderIssuestatus(issue)
|
renderIssuestatus(issue)
|
||||||
|
|
||||||
if editable
|
if editable
|
||||||
|
$el.on "click", ".type-data", (event) ->
|
||||||
|
event.preventDefault()
|
||||||
|
event.stopPropagation()
|
||||||
|
$el.find(".pop-type").popover().open()
|
||||||
|
|
||||||
|
$el.on "click", ".type", (event) ->
|
||||||
|
event.preventDefault()
|
||||||
|
event.stopPropagation()
|
||||||
|
target = angular.element(event.currentTarget)
|
||||||
|
$model.$modelValue.type = target.data("type-id")
|
||||||
|
renderIssuestatus($model.$modelValue)
|
||||||
|
$.fn.popover().closeAll()
|
||||||
|
|
||||||
$el.on "click", ".severity-data", (event) ->
|
$el.on "click", ".severity-data", (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
|
|
|
@ -325,6 +325,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.us-status {
|
.us-status {
|
||||||
|
.type-data {
|
||||||
|
position: relative;
|
||||||
|
.pop-type {
|
||||||
|
@include popover(150px, '', 30px, '', '');
|
||||||
|
}
|
||||||
|
}
|
||||||
.severity-data {
|
.severity-data {
|
||||||
position: relative;
|
position: relative;
|
||||||
.pop-severity {
|
.pop-severity {
|
||||||
|
|
Loading…
Reference in New Issue