US navigation
parent
58a19f1425
commit
fccd26c749
|
@ -492,93 +492,6 @@ DeleteButtonDirective = ($log, $repo, $confirm, $location, $template) ->
|
|||
|
||||
module.directive("tgDeleteButton", ["$log", "$tgRepo", "$tgConfirm", "$tgLocation", "$tgTemplate", DeleteButtonDirective])
|
||||
|
||||
|
||||
# #############################################################################
|
||||
# ## Editable subject directive
|
||||
# #############################################################################
|
||||
#
|
||||
# EditableSubjectDirective = ($rootscope, $repo, $confirm, $loading, $modelTransform, $template) ->
|
||||
# template = $template.get("common/components/editable-subject.html")
|
||||
#
|
||||
# link = ($scope, $el, $attrs, $model) ->
|
||||
#
|
||||
# $scope.$on "object:updated", () ->
|
||||
# $el.find('.edit-subject').hide()
|
||||
# $el.find('.view-subject').show()
|
||||
#
|
||||
# isEditable = ->
|
||||
# return $scope.project.my_permissions.indexOf($attrs.requiredPerm) != -1
|
||||
#
|
||||
# save = (subject) ->
|
||||
# currentLoading = $loading()
|
||||
# .target($el.find('.save-container'))
|
||||
# .start()
|
||||
#
|
||||
# transform = $modelTransform.save (item) ->
|
||||
# item.subject = subject
|
||||
#
|
||||
# return item
|
||||
#
|
||||
# transform.then =>
|
||||
# $confirm.notify("success")
|
||||
# $rootscope.$broadcast("object:updated")
|
||||
# $el.find('.edit-subject').hide()
|
||||
# $el.find('.view-subject').show()
|
||||
#
|
||||
# transform.then null, ->
|
||||
# $confirm.notify("error")
|
||||
#
|
||||
# transform.finally ->
|
||||
# currentLoading.finish()
|
||||
#
|
||||
# return transform
|
||||
#
|
||||
# $el.click ->
|
||||
# return if not isEditable()
|
||||
# $el.find('.edit-subject').show()
|
||||
# $el.find('.view-subject').hide()
|
||||
# $el.find('input').focus()
|
||||
#
|
||||
# $el.on "click", ".save", (e) ->
|
||||
# e.preventDefault()
|
||||
#
|
||||
# subject = $scope.item.subject
|
||||
# save(subject)
|
||||
#
|
||||
# $el.on "keyup", "input", (event) ->
|
||||
# if event.keyCode == 13
|
||||
# subject = $scope.item.subject
|
||||
# save(subject)
|
||||
# else if event.keyCode == 27
|
||||
# $scope.$apply () => $model.$modelValue.revert()
|
||||
#
|
||||
# $el.find('.edit-subject').hide()
|
||||
# $el.find('.view-subject').show()
|
||||
#
|
||||
# $el.find('.edit-subject').hide()
|
||||
#
|
||||
# $scope.$watch $attrs.ngModel, (value) ->
|
||||
# return if not value
|
||||
# $scope.item = value
|
||||
#
|
||||
# if not isEditable()
|
||||
# $el.find('.view-subject .edit').remove()
|
||||
#
|
||||
# $scope.$on "$destroy", ->
|
||||
# $el.off()
|
||||
#
|
||||
#
|
||||
# return {
|
||||
# link: link
|
||||
# restrict: "EA"
|
||||
# require: "ngModel"
|
||||
# template: template
|
||||
# }
|
||||
#
|
||||
# module.directive("tgEditableSubject", ["$rootScope", "$tgRepo", "$tgConfirm", "$tgLoading", "$tgQueueModelTransformation",
|
||||
# "$tgTemplate", EditableSubjectDirective])
|
||||
|
||||
|
||||
#############################################################################
|
||||
## Editable description directive
|
||||
#############################################################################
|
||||
|
|
|
@ -166,20 +166,6 @@ class UserStoryDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
|
|||
|
||||
@modelTransform.setObject(@scope, 'us')
|
||||
|
||||
if @scope.us.neighbors.previous?.ref?
|
||||
ctx = {
|
||||
project: @scope.project.slug
|
||||
ref: @scope.us.neighbors.previous.ref
|
||||
}
|
||||
@scope.previousUrl = @navUrls.resolve("project-userstories-detail", ctx)
|
||||
|
||||
if @scope.us.neighbors.next?.ref?
|
||||
ctx = {
|
||||
project: @scope.project.slug
|
||||
ref: @scope.us.neighbors.next.ref
|
||||
}
|
||||
@scope.nextUrl = @navUrls.resolve("project-userstories-detail", ctx)
|
||||
|
||||
return us
|
||||
|
||||
loadSprint: ->
|
||||
|
|
|
@ -23,14 +23,31 @@ class StoryHeaderController
|
|||
@.$inject = [
|
||||
"$rootScope",
|
||||
"$tgConfirm",
|
||||
"$tgQueueModelTransformation"
|
||||
"$tgQueueModelTransformation",
|
||||
"$tgNavUrls",
|
||||
]
|
||||
|
||||
constructor: (@rootScope, @confirm, @modelTransform) ->
|
||||
constructor: (@rootScope, @confirm, @modelTransform, @navUrls) ->
|
||||
@.editMode = false
|
||||
@.loadingSubject = false
|
||||
@.originalSubject = @.item.subject
|
||||
|
||||
console.log @.item
|
||||
|
||||
if @.item.neighbors.previous?.ref?
|
||||
ctx = {
|
||||
project: @.project.slug
|
||||
ref: @.item.neighbors.previous.ref
|
||||
}
|
||||
@.previousUrl = @navUrls.resolve("project-userstories-detail", ctx)
|
||||
|
||||
if @.item.neighbors.next?.ref?
|
||||
ctx = {
|
||||
project: @.project.slug
|
||||
ref: @.item.neighbors.next.ref
|
||||
}
|
||||
@.nextUrl = @navUrls.resolve("project-userstories-detail", ctx)
|
||||
|
||||
_checkPermissions: () ->
|
||||
@.permissions = {
|
||||
canEdit: _.includes(@.project.my_permissions, @.requiredPerm)
|
||||
|
@ -42,7 +59,10 @@ class StoryHeaderController
|
|||
if !value
|
||||
@.editMode = false
|
||||
|
||||
onCancelEdition: (event) ->
|
||||
onKeyDown: (event) ->
|
||||
if event.which == 13
|
||||
@.saveSubject()
|
||||
|
||||
if event.which == 27
|
||||
@.item.subject = @.originalSubject
|
||||
@.editSubject(false)
|
||||
|
@ -52,6 +72,7 @@ class StoryHeaderController
|
|||
@.loadingSubject = false
|
||||
@rootScope.$broadcast("object:updated")
|
||||
@confirm.notify('success')
|
||||
@.originalSubject = @.item.subject
|
||||
|
||||
onEditSubjectError = () =>
|
||||
@.loadingSubject = false
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
maxlength="500"
|
||||
autofocus
|
||||
required
|
||||
ng-keydown="vm.onCancelEdition($event)"
|
||||
ng-keydown="vm.onKeyDown($event)"
|
||||
)
|
||||
button.edit-title-button(
|
||||
ng-click="vm.saveSubject()"
|
||||
|
@ -63,14 +63,14 @@
|
|||
|
||||
.issue-nav
|
||||
a(
|
||||
ng-show="previousUrl"
|
||||
tg-bo-href="previousUrl"
|
||||
ng-if="vm.previousUrl"
|
||||
ng-href="{{vm.previousUrl}}"
|
||||
title="{{'US.PREVIOUS' | translate}}"
|
||||
)
|
||||
tg-svg(svg-icon="icon-arrow-left")
|
||||
a(
|
||||
ng-show="nextUrl"
|
||||
tg-bo-href="nextUrl"
|
||||
ng-if="vm.nextUrl"
|
||||
ng-href="{{vm.nextUrl}}"
|
||||
title="{{'US.NEXT' | translate}}"
|
||||
)
|
||||
tg-svg(svg-icon="icon-arrow-right")
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
background: $mass-white;
|
||||
flex: 1;
|
||||
padding: 1rem;
|
||||
position: relative;
|
||||
&:hover {
|
||||
.detail-edit {
|
||||
opacity: 1;
|
||||
|
@ -45,6 +46,7 @@
|
|||
transition: all .2s linear;
|
||||
}
|
||||
.detail-title-text {
|
||||
line-height: normal;
|
||||
margin: 0;
|
||||
}
|
||||
.detail-number {
|
||||
|
|
Loading…
Reference in New Issue