Minor fixes

stable
David Barragán Merino 2014-10-20 16:55:48 +02:00
parent 5c5ad3c1fc
commit dcbe0f6744
4 changed files with 31 additions and 20 deletions

View File

@ -24,6 +24,7 @@ bindOnce = @.taiga.bindOnce
module = angular.module("taigaCommon") module = angular.module("taigaCommon")
############################################################################# #############################################################################
## Date Range Directive (used mainly for sprint date range) ## Date Range Directive (used mainly for sprint date range)
############################################################################# #############################################################################
@ -156,7 +157,7 @@ module.directive("tgCreatedByDisplay", CreatedByDisplayDirective)
## Watchers directive ## 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 # You have to include a div with the tg-lb-watchers directive in the page
# where use this directive # where use this directive
# #
@ -187,7 +188,7 @@ WatchersDirective = ($rootscope, $confirm, $tgrepo) ->
link = ($scope, $el, $attrs, $model) -> link = ($scope, $el, $attrs, $model) ->
save = (model) -> save = (model) ->
promise = $tgrepo.save($model.$modelValue) promise = $repo.save($model.$modelValue)
promise.then -> promise.then ->
$confirm.notify("success") $confirm.notify("success")
watchers = _.map(model.watchers, (watcherId) -> $scope.usersById[watcherId]) watchers = _.map(model.watchers, (watcherId) -> $scope.usersById[watcherId])
@ -255,7 +256,7 @@ module.directive("tgWatchers", ["$rootScope", "$tgConfirm", "$tgRepo", WatchersD
## Assigned to directive ## 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 # You have to include a div with the tg-lb-assignedto directive in the page
# where use this directive # where use this directive
# #
@ -288,7 +289,7 @@ AssignedToDirective = ($rootscope, $confirm, $tgrepo, $loading) ->
save = (model) -> save = (model) ->
$loading.start($el) $loading.start($el)
promise = $tgrepo.save($model.$modelValue) promise = $repo.save($model.$modelValue)
promise.then -> promise.then ->
$loading.finish($el) $loading.finish($el)
$confirm.notify("success") $confirm.notify("success")
@ -339,6 +340,7 @@ AssignedToDirective = ($rootscope, $confirm, $tgrepo, $loading) ->
module.directive("tgAssignedTo", ["$rootScope", "$tgConfirm", "$tgRepo", "$tgLoading", AssignedToDirective]) module.directive("tgAssignedTo", ["$rootScope", "$tgConfirm", "$tgRepo", "$tgLoading", AssignedToDirective])
############################################################################# #############################################################################
## Block Button directive ## Block Button directive
############################################################################# #############################################################################
@ -387,11 +389,12 @@ BlockButtonDirective = ($rootscope, $loading) ->
module.directive("tgBlockButton", ["$rootScope", "$tgLoading", BlockButtonDirective]) module.directive("tgBlockButton", ["$rootScope", "$tgLoading", BlockButtonDirective])
############################################################################# #############################################################################
## Delete Button directive ## Delete Button directive
############################################################################# #############################################################################
DeleteButtonDirective = ($tgrepo, $confirm, $navurls, $location) -> DeleteButtonDirective = ($repo, $confirm, $navurls, $location) ->
template = _.template(""" template = _.template("""
<a href="" class="button button-red">Delete</a> <a href="" class="button button-red">Delete</a>
""") """)
@ -413,7 +416,7 @@ DeleteButtonDirective = ($tgrepo, $confirm, $navurls, $location) ->
subtitle = $model.$modelValue.subject subtitle = $model.$modelValue.subject
$confirm.ask(title, subtitle).then (finish) => $confirm.ask(title, subtitle).then (finish) =>
promise = $tgrepo.remove($model.$modelValue) promise = $repo.remove($model.$modelValue)
promise.then => promise.then =>
finish() finish()
$location.path($navurls.resolve($attrs.onDeleteGoToUrl, {project: $attrs.projectSlug})) $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]) module.directive("tgDeleteButton", ["$tgRepo", "$tgConfirm", "$tgNavUrls", "$tgLocation", DeleteButtonDirective])
############################################################################# #############################################################################
## Editable subject directive ## Editable subject directive
############################################################################# #############################################################################
EditableSubjectDirective = ($rootscope, $tgrepo, $confirm, $navurls, $location, $loading) -> EditableSubjectDirective = ($rootscope, $repo, $confirm, $loading) ->
viewTemplate = _.template(""" viewTemplate = _.template("""
<%- item.subject %> <%- item.subject %>
<% if (canEdit) { %> <% if (canEdit) { %>
<a class="save icon icon-edit" href="" title="Edit" /> <a class="edit icon icon-edit" href="" title="Edit" />
<% } %> <% } %>
""") """)
@ -462,8 +466,9 @@ EditableSubjectDirective = ($rootscope, $tgrepo, $confirm, $navurls, $location,
save = -> save = ->
$model.$modelValue.subject = $el.find('input').val() $model.$modelValue.subject = $el.find('input').val()
$loading.start($el.find('.save-container')) $loading.start($el.find('.save-container'))
promise = $tgrepo.save($model.$modelValue) promise = $repo.save($model.$modelValue)
promise.then -> promise.then ->
$confirm.notify("success")
$rootscope.$broadcast("history:reload") $rootscope.$broadcast("history:reload")
editing = false editing = false
$loading.finish($el.find('.save-container')) $loading.finish($el.find('.save-container'))
@ -503,13 +508,15 @@ EditableSubjectDirective = ($rootscope, $tgrepo, $confirm, $navurls, $location,
require: "ngModel" require: "ngModel"
} }
module.directive("tgEditableSubject", ["$rootScope", "$tgRepo", "$tgConfirm", "$tgNavUrls", "$tgLocation", "$tgLoading", EditableSubjectDirective]) module.directive("tgEditableSubject", ["$rootScope", "$tgRepo", "$tgConfirm", "$tgLoading",
EditableSubjectDirective])
############################################################################# #############################################################################
## Editable subject directive ## Editable subject directive
############################################################################# #############################################################################
EditableDescriptionDirective = ($rootscope, $tgrepo, $confirm, $navurls, $location, $compile, $loading) -> EditableDescriptionDirective = ($rootscope, $repo, $confirm, $compile, $loading) ->
viewTemplate = _.template(""" viewTemplate = _.template("""
<section class="us-content wysiwyg"><%= descriptionHtml %></section> <section class="us-content wysiwyg"><%= descriptionHtml %></section>
<% if (canEdit) { %> <% if (canEdit) { %>
@ -544,7 +551,7 @@ EditableDescriptionDirective = ($rootscope, $tgrepo, $confirm, $navurls, $locati
$scope.$on "$destroy", -> $scope.$on "$destroy", ->
$el.off() $el.off()
$el.click -> $el.on "click", ".edit", ->
if not editing and $scope.project.my_permissions.indexOf($attrs.requiredPerm) != -1 if not editing and $scope.project.my_permissions.indexOf($attrs.requiredPerm) != -1
editing = true editing = true
scope.item = {description: $model.$modelValue.description} scope.item = {description: $model.$modelValue.description}
@ -554,8 +561,9 @@ EditableDescriptionDirective = ($rootscope, $tgrepo, $confirm, $navurls, $locati
$el.on "click", ".save", -> $el.on "click", ".save", ->
$model.$modelValue.description = scope.item.description $model.$modelValue.description = scope.item.description
$loading.start($el.find('.save-container')) $loading.start($el.find('.save-container'))
promise = $tgrepo.save($model.$modelValue) promise = $repo.save($model.$modelValue)
promise.then -> promise.then ->
$confirm.notify("success")
$rootscope.$broadcast("history:reload") $rootscope.$broadcast("history:reload")
editing = false editing = false
$loading.finish($el.find('.save-container')) $loading.finish($el.find('.save-container'))
@ -576,7 +584,9 @@ EditableDescriptionDirective = ($rootscope, $tgrepo, $confirm, $navurls, $locati
require: "ngModel" 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 ## Common list directives
@ -684,6 +694,7 @@ ListItemSeverityDirective = ->
template: template template: template
} }
ListItemTypeDirective = -> ListItemTypeDirective = ->
template = """ template = """
<div class="level"></div> <div class="level"></div>

View File

@ -28,8 +28,8 @@ block content
span.block-description(tg-bind-html="issue.blocked_note || 'This issue is blocked'") span.block-description(tg-bind-html="issue.blocked_note || 'This issue is blocked'")
div.issue-nav div.issue-nav
a.icon.icon-arrow-left(ng-show="previousUrl",href="{{ previousUrl }}", title="previous issue") a.icon.icon-arrow-left(ng-show="previousUrl", tg-bo-href="previousUrl", title="previous issue")
a.icon.icon-arrow-right(ng-show="nextUrl", href="{{ nextUrl }}", title="next 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") div(tg-tag-line, editable="true", autosave-model="issue", ng-model="issue.tags", required-perm="modify_issue")

View File

@ -31,8 +31,8 @@ block content
span.block-description-title Blocked span.block-description-title Blocked
span.block-description(tg-bind-html="task.blocked_note || 'This task is blocked'") span.block-description(tg-bind-html="task.blocked_note || 'This task is blocked'")
div.issue-nav div.issue-nav
a.icon.icon-arrow-left(ng-show="previousUrl",href="{{ previousUrl }}", title="previous task") a.icon.icon-arrow-left(ng-show="previousUrl", tg-bo-href="previousUrl", title="previous task")
a.icon.icon-arrow-right(ng-show="nextUrl", href="{{ nextUrl }}", title="next 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") div(tg-tag-line, editable="true", autosave-model="task", ng-model="task.tags", required-perm="modify_task")

View File

@ -32,9 +32,9 @@ block content
span.block-description-title Blocked span.block-description-title Blocked
span.block-description(tg-bind-html="us.blocked_note || 'This user story is blocked'") span.block-description(tg-bind-html="us.blocked_note || 'This user story is blocked'")
div.issue-nav 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") 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") div(tg-tag-line, editable="true", autosave-model="us", ng-model="us.tags", required-perm="modify_us")