diff --git a/app/coffee/modules/common/components.coffee b/app/coffee/modules/common/components.coffee index 98e60bc3..8f3c04c8 100644 --- a/app/coffee/modules/common/components.coffee +++ b/app/coffee/modules/common/components.coffee @@ -24,6 +24,7 @@ bindOnce = @.taiga.bindOnce module = angular.module("taigaCommon") + ############################################################################# ## Date Range Directive (used mainly for sprint date range) ############################################################################# @@ -156,7 +157,7 @@ module.directive("tgCreatedByDisplay", CreatedByDisplayDirective) ## Watchers directive ############################################################################# -WatchersDirective = ($rootscope, $confirm, $tgrepo) -> +WatchersDirective = ($rootscope, $confirm, $repo) -> # You have to include a div with the tg-lb-watchers directive in the page # where use this directive # @@ -187,7 +188,7 @@ WatchersDirective = ($rootscope, $confirm, $tgrepo) -> link = ($scope, $el, $attrs, $model) -> save = (model) -> - promise = $tgrepo.save($model.$modelValue) + promise = $repo.save($model.$modelValue) promise.then -> $confirm.notify("success") watchers = _.map(model.watchers, (watcherId) -> $scope.usersById[watcherId]) @@ -255,7 +256,7 @@ module.directive("tgWatchers", ["$rootScope", "$tgConfirm", "$tgRepo", WatchersD ## Assigned to directive ############################################################################# -AssignedToDirective = ($rootscope, $confirm, $tgrepo, $loading) -> +AssignedToDirective = ($rootscope, $confirm, $repo, $loading) -> # You have to include a div with the tg-lb-assignedto directive in the page # where use this directive # @@ -288,7 +289,7 @@ AssignedToDirective = ($rootscope, $confirm, $tgrepo, $loading) -> save = (model) -> $loading.start($el) - promise = $tgrepo.save($model.$modelValue) + promise = $repo.save($model.$modelValue) promise.then -> $loading.finish($el) $confirm.notify("success") @@ -339,6 +340,7 @@ AssignedToDirective = ($rootscope, $confirm, $tgrepo, $loading) -> module.directive("tgAssignedTo", ["$rootScope", "$tgConfirm", "$tgRepo", "$tgLoading", AssignedToDirective]) + ############################################################################# ## Block Button directive ############################################################################# @@ -387,11 +389,12 @@ BlockButtonDirective = ($rootscope, $loading) -> module.directive("tgBlockButton", ["$rootScope", "$tgLoading", BlockButtonDirective]) + ############################################################################# ## Delete Button directive ############################################################################# -DeleteButtonDirective = ($tgrepo, $confirm, $navurls, $location) -> +DeleteButtonDirective = ($repo, $confirm, $navurls, $location) -> template = _.template(""" Delete """) @@ -413,7 +416,7 @@ DeleteButtonDirective = ($tgrepo, $confirm, $navurls, $location) -> subtitle = $model.$modelValue.subject $confirm.ask(title, subtitle).then (finish) => - promise = $tgrepo.remove($model.$modelValue) + promise = $repo.remove($model.$modelValue) promise.then => finish() $location.path($navurls.resolve($attrs.onDeleteGoToUrl, {project: $attrs.projectSlug})) @@ -429,15 +432,16 @@ DeleteButtonDirective = ($tgrepo, $confirm, $navurls, $location) -> module.directive("tgDeleteButton", ["$tgRepo", "$tgConfirm", "$tgNavUrls", "$tgLocation", DeleteButtonDirective]) + ############################################################################# ## Editable subject directive ############################################################################# -EditableSubjectDirective = ($rootscope, $tgrepo, $confirm, $navurls, $location, $loading) -> +EditableSubjectDirective = ($rootscope, $repo, $confirm, $loading) -> viewTemplate = _.template(""" <%- item.subject %> <% if (canEdit) { %> - + <% } %> """) @@ -462,8 +466,9 @@ EditableSubjectDirective = ($rootscope, $tgrepo, $confirm, $navurls, $location, save = -> $model.$modelValue.subject = $el.find('input').val() $loading.start($el.find('.save-container')) - promise = $tgrepo.save($model.$modelValue) + promise = $repo.save($model.$modelValue) promise.then -> + $confirm.notify("success") $rootscope.$broadcast("history:reload") editing = false $loading.finish($el.find('.save-container')) @@ -503,13 +508,15 @@ EditableSubjectDirective = ($rootscope, $tgrepo, $confirm, $navurls, $location, require: "ngModel" } -module.directive("tgEditableSubject", ["$rootScope", "$tgRepo", "$tgConfirm", "$tgNavUrls", "$tgLocation", "$tgLoading", EditableSubjectDirective]) +module.directive("tgEditableSubject", ["$rootScope", "$tgRepo", "$tgConfirm", "$tgLoading", + EditableSubjectDirective]) + ############################################################################# ## Editable subject directive ############################################################################# -EditableDescriptionDirective = ($rootscope, $tgrepo, $confirm, $navurls, $location, $compile, $loading) -> +EditableDescriptionDirective = ($rootscope, $repo, $confirm, $compile, $loading) -> viewTemplate = _.template("""
<%= descriptionHtml %>
<% if (canEdit) { %> @@ -544,7 +551,7 @@ EditableDescriptionDirective = ($rootscope, $tgrepo, $confirm, $navurls, $locati $scope.$on "$destroy", -> $el.off() - $el.click -> + $el.on "click", ".edit", -> if not editing and $scope.project.my_permissions.indexOf($attrs.requiredPerm) != -1 editing = true scope.item = {description: $model.$modelValue.description} @@ -554,8 +561,9 @@ EditableDescriptionDirective = ($rootscope, $tgrepo, $confirm, $navurls, $locati $el.on "click", ".save", -> $model.$modelValue.description = scope.item.description $loading.start($el.find('.save-container')) - promise = $tgrepo.save($model.$modelValue) + promise = $repo.save($model.$modelValue) promise.then -> + $confirm.notify("success") $rootscope.$broadcast("history:reload") editing = false $loading.finish($el.find('.save-container')) @@ -576,7 +584,9 @@ EditableDescriptionDirective = ($rootscope, $tgrepo, $confirm, $navurls, $locati require: "ngModel" } -module.directive("tgEditableDescription", ["$rootScope", "$tgRepo", "$tgConfirm", "$tgNavUrls", "$tgLocation", "$compile", "$tgLoading", EditableDescriptionDirective]) +module.directive("tgEditableDescription", ["$rootScope", "$tgRepo", "$tgConfirm", "$compile", "$tgLoading", + EditableDescriptionDirective]) + ############################################################################# ## Common list directives @@ -684,6 +694,7 @@ ListItemSeverityDirective = -> template: template } + ListItemTypeDirective = -> template = """
diff --git a/app/partials/issues-detail.jade b/app/partials/issues-detail.jade index de76fac1..2d86cf23 100644 --- a/app/partials/issues-detail.jade +++ b/app/partials/issues-detail.jade @@ -28,8 +28,8 @@ block content span.block-description(tg-bind-html="issue.blocked_note || 'This issue is blocked'") div.issue-nav - a.icon.icon-arrow-left(ng-show="previousUrl",href="{{ previousUrl }}", title="previous issue") - a.icon.icon-arrow-right(ng-show="nextUrl", href="{{ nextUrl }}", title="next issue") + a.icon.icon-arrow-left(ng-show="previousUrl", tg-bo-href="previousUrl", title="previous issue") + a.icon.icon-arrow-right(ng-show="nextUrl", tg-bo-href="nextUrl", title="next issue") div(tg-tag-line, editable="true", autosave-model="issue", ng-model="issue.tags", required-perm="modify_issue") diff --git a/app/partials/task-detail.jade b/app/partials/task-detail.jade index 8d6a1aa6..ccaa46aa 100644 --- a/app/partials/task-detail.jade +++ b/app/partials/task-detail.jade @@ -31,8 +31,8 @@ block content span.block-description-title Blocked span.block-description(tg-bind-html="task.blocked_note || 'This task is blocked'") div.issue-nav - a.icon.icon-arrow-left(ng-show="previousUrl",href="{{ previousUrl }}", title="previous task") - a.icon.icon-arrow-right(ng-show="nextUrl", href="{{ nextUrl }}", title="next task") + a.icon.icon-arrow-left(ng-show="previousUrl", tg-bo-href="previousUrl", title="previous task") + a.icon.icon-arrow-right(ng-show="nextUrl", tg-bo-href="nextUrl", title="next task") div(tg-tag-line, editable="true", autosave-model="task", ng-model="task.tags", required-perm="modify_task") diff --git a/app/partials/us-detail.jade b/app/partials/us-detail.jade index 74b83afd..d31bd0bf 100644 --- a/app/partials/us-detail.jade +++ b/app/partials/us-detail.jade @@ -32,9 +32,9 @@ block content span.block-description-title Blocked span.block-description(tg-bind-html="us.blocked_note || 'This user story is blocked'") div.issue-nav - a.icon.icon-arrow-left(ng-show="previousUrl",href="{{ previousUrl }}", + a.icon.icon-arrow-left(ng-show="previousUrl", tg-bo-href="previousUrl", title="previous user story") - a.icon.icon-arrow-right(ng-show="nextUrl", href="{{ nextUrl }}", title="next user story") + a.icon.icon-arrow-right(ng-show="nextUrl", tg-bo-href="nextUrl", title="next user story") div(tg-tag-line, editable="true", autosave-model="us", ng-model="us.tags", required-perm="modify_us")