Other cosmetic fixes.
parent
5a4982942f
commit
afbab5d966
|
@ -123,10 +123,9 @@ class IssueDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
|
||||||
|
|
||||||
buildChangesText: (comment) ->
|
buildChangesText: (comment) ->
|
||||||
size = @.countChanges(comment)
|
size = @.countChanges(comment)
|
||||||
#TODO: i18n
|
# TODO: i18n
|
||||||
if size == 1
|
if size == 1
|
||||||
return "Made #{size} change"
|
return "Made #{size} change"
|
||||||
|
|
||||||
return "Made #{size} changes"
|
return "Made #{size} changes"
|
||||||
|
|
||||||
block: ->
|
block: ->
|
||||||
|
@ -136,7 +135,7 @@ class IssueDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
|
||||||
@rootscope.$broadcast("unblock", @scope.issue)
|
@rootscope.$broadcast("unblock", @scope.issue)
|
||||||
|
|
||||||
delete: ->
|
delete: ->
|
||||||
#TODO: i18n
|
# TODO: i18n
|
||||||
title = "Delete Issue"
|
title = "Delete Issue"
|
||||||
subtitle = @scope.issue.subject
|
subtitle = @scope.issue.subject
|
||||||
|
|
||||||
|
@ -261,153 +260,13 @@ TagLineDirective = ($log) ->
|
||||||
|
|
||||||
module.directive("tgTagLine", ["$log", TagLineDirective])
|
module.directive("tgTagLine", ["$log", TagLineDirective])
|
||||||
|
|
||||||
#############################################################################
|
|
||||||
## Watchers directive
|
|
||||||
#############################################################################
|
|
||||||
|
|
||||||
WatchersDirective = ($rootscope, $confirm) ->
|
|
||||||
#TODO: i18n
|
|
||||||
template = _.template("""
|
|
||||||
<div class="watchers-header">
|
|
||||||
<span class="title">watchers</span>
|
|
||||||
<% if (editable) { %>
|
|
||||||
<a href="" title="Add watcher" class="icon icon-plus add-watcher">
|
|
||||||
</a>
|
|
||||||
<% } %>
|
|
||||||
</div>
|
|
||||||
<% _.each(watchers, function(watcher) { %>
|
|
||||||
<div class="watcher-single">
|
|
||||||
<div class="watcher-avatar">
|
|
||||||
<a class="avatar" href="" title="Assigned to">
|
|
||||||
<img src="<%= watcher.photo %>" alt="<%= watcher.full_name_display %>">
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div class="watcher-name">
|
|
||||||
<a href="" title="<%= watcher.full_name_display %>">
|
|
||||||
<%= watcher.full_name_display %>
|
|
||||||
</a>
|
|
||||||
<% if (editable) { %>
|
|
||||||
<a class="icon icon-delete" data-watcher-id="<%= watcher.id %>" href="" title="delete-watcher"></a>
|
|
||||||
<% } %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% }); %>
|
|
||||||
""")
|
|
||||||
|
|
||||||
link = ($scope, $el, $attrs, $model) ->
|
|
||||||
editable = $attrs.editable?
|
|
||||||
$scope.$watch $attrs.ngModel, (watcherIds) ->
|
|
||||||
watchers = _.map(watcherIds, (watcherId) -> $scope.usersById[watcherId])
|
|
||||||
html = template({watchers: watchers, editable:editable})
|
|
||||||
$el.html(html)
|
|
||||||
if watchers.length == 0
|
|
||||||
if editable
|
|
||||||
$el.find(".title").text("Add watchers")
|
|
||||||
$el.find(".watchers-header").addClass("no-watchers")
|
|
||||||
else
|
|
||||||
$el.find(".watchers-header").hide()
|
|
||||||
|
|
||||||
if not editable
|
|
||||||
$el.find(".add-watcher").remove()
|
|
||||||
|
|
||||||
$el.on "click", ".icon-delete", (event) ->
|
|
||||||
event.preventDefault()
|
|
||||||
target = angular.element(event.currentTarget)
|
|
||||||
watcherId = target.data("watcher-id")
|
|
||||||
title = "Remove watcher"
|
|
||||||
subtitle = $scope.usersById[watcherId].full_name_display
|
|
||||||
$confirm.ask(title, subtitle).then =>
|
|
||||||
watcherIds = _.clone($model.$modelValue, false)
|
|
||||||
watcherIds = _.pull(watcherIds, watcherId)
|
|
||||||
$model.$setViewValue(watcherIds)
|
|
||||||
|
|
||||||
$el.on "click", ".add-watcher", (event) ->
|
|
||||||
event.preventDefault()
|
|
||||||
target = angular.element(event.currentTarget)
|
|
||||||
$rootscope.$broadcast("watcher:add")
|
|
||||||
|
|
||||||
$scope.$on "watcher:added", (ctx, watcher) ->
|
|
||||||
watcherIds = _.clone($model.$modelValue, false)
|
|
||||||
watcherIds.push(watcher.id)
|
|
||||||
watcherIds = _.uniq(watcherIds)
|
|
||||||
$scope.$apply ->
|
|
||||||
$model.$setViewValue(watcherIds)
|
|
||||||
|
|
||||||
return {link:link, require:"ngModel"}
|
|
||||||
|
|
||||||
module.directive("tgWatchers", ["$rootScope", "$tgConfirm", WatchersDirective])
|
|
||||||
|
|
||||||
#############################################################################
|
|
||||||
## Assigned to directive
|
|
||||||
#############################################################################
|
|
||||||
|
|
||||||
AssignedToDirective = ($rootscope, $confirm) ->
|
|
||||||
#TODO: i18n
|
|
||||||
template = _.template("""
|
|
||||||
<% if (assignedTo) { %>
|
|
||||||
<div class="user-avatar">
|
|
||||||
<a href="" title="Assigned to" class="avatar"><img src="<%= assignedTo.photo %>" alt="<%= assignedTo.full_name_display %>"></a>
|
|
||||||
</div>
|
|
||||||
<% } %>
|
|
||||||
<div class="assigned-to">
|
|
||||||
<span class="assigned-title">Assigned to</span>
|
|
||||||
<a href="" title="edit assignment" class="user-assigned">
|
|
||||||
<% if (assignedTo) { %>
|
|
||||||
<%= assignedTo.full_name_display %>
|
|
||||||
<% } else { %>
|
|
||||||
Not assigned
|
|
||||||
<% } %>
|
|
||||||
<% if (editable) { %>
|
|
||||||
<span class="icon icon-arrow-bottom"></span>
|
|
||||||
<% } %>
|
|
||||||
</a>
|
|
||||||
<% if (editable && assignedTo!==null) { %>
|
|
||||||
<a href="" title="delete assignment" class="icon icon-delete"></a>
|
|
||||||
<% } %>
|
|
||||||
</div>
|
|
||||||
""")
|
|
||||||
|
|
||||||
link = ($scope, $el, $attrs, $model) ->
|
|
||||||
editable = $attrs.editable?
|
|
||||||
|
|
||||||
renderAssignedTo = (issue) ->
|
|
||||||
assignedToId = issue?.assigned_to
|
|
||||||
assignedTo = null
|
|
||||||
assignedTo = $scope.usersById[assignedToId] if assignedToId?
|
|
||||||
html = template({assignedTo: assignedTo, editable:editable})
|
|
||||||
$el.html(html)
|
|
||||||
|
|
||||||
$scope.$watch $attrs.ngModel, (instance) ->
|
|
||||||
renderAssignedTo(instance)
|
|
||||||
|
|
||||||
$el.on "click", ".user-assigned", (event) ->
|
|
||||||
event.preventDefault()
|
|
||||||
$scope.$apply(
|
|
||||||
$rootscope.$broadcast("assigned-to:add", $model.$modelValue)
|
|
||||||
)
|
|
||||||
|
|
||||||
$el.on "click", ".icon-delete", (event) ->
|
|
||||||
event.preventDefault()
|
|
||||||
title = "Remove assigned to"
|
|
||||||
subtitle = ""
|
|
||||||
$confirm.ask(title, subtitle).then =>
|
|
||||||
$model.$modelValue.assigned_to = null
|
|
||||||
renderAssignedTo($model.$modelValue)
|
|
||||||
|
|
||||||
$scope.$on "assigned-to:added", (ctx, issue) ->
|
|
||||||
renderAssignedTo(issue)
|
|
||||||
|
|
||||||
return {link:link, require:"ngModel"}
|
|
||||||
|
|
||||||
module.directive("tgAssignedTo", ["$rootScope", "$tgConfirm", AssignedToDirective])
|
|
||||||
|
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
## Issue status directive
|
## Issue status directive
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
IssueStatusDirective = () ->
|
IssueStatusDirective = () ->
|
||||||
#TODO: i18n
|
# TODO: i18n
|
||||||
template = _.template("""
|
template = _.template("""
|
||||||
<h1>
|
<h1>
|
||||||
<span>
|
<span>
|
||||||
|
@ -541,7 +400,7 @@ module.directive("tgIssueStatus", IssueStatusDirective)
|
||||||
## Comment directive
|
## Comment directive
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
CommentDirective = () ->
|
CommentDirective = ->
|
||||||
link = ($scope, $el, $attrs, $model) ->
|
link = ($scope, $el, $attrs, $model) ->
|
||||||
$el.on "click", ".activity-title", (event) ->
|
$el.on "click", ".activity-title", (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
|
Loading…
Reference in New Issue