diff --git a/app/locales/taiga/locale-en.json b/app/locales/taiga/locale-en.json
index 0265e909..5dbb8808 100644
--- a/app/locales/taiga/locale-en.json
+++ b/app/locales/taiga/locale-en.json
@@ -1401,6 +1401,7 @@
"TITLE_ACTION_MOVE_UNFINISHED": "Move unfinished items to another sprint",
"TITLE_MOVE_UNFINISHED": "Move unfinished items to another open sprint",
"MOVE_TO_OPEN_SPRINT": "Move to open sprint",
+ "NO_OPEN_SPRINTS": "There are no other open sprints. Please create one first.",
"SELECT_DESTINATION_PLACEHOLDER": "Select destination",
"UNFINISHED_USER_STORIES_COUNT": "{total, plural, one{# unfinished user story} other{# unfinished user stories}}",
"UNFINISHED_UNASSIGNED_TASKS_COUNT": "{total, plural, one{# unfinished unnasigned task} other{# unfinished unnasigned tasks}}",
diff --git a/app/modules/components/move-to-sprint/move-to-sprint-lb/move-to-sprint-lb.controller.coffee b/app/modules/components/move-to-sprint/move-to-sprint-lb/move-to-sprint-lb.controller.coffee
index 5dac4e80..bd03f63b 100644
--- a/app/modules/components/move-to-sprint/move-to-sprint-lb/move-to-sprint-lb.controller.coffee
+++ b/app/modules/components/move-to-sprint/move-to-sprint-lb/move-to-sprint-lb.controller.coffee
@@ -69,7 +69,7 @@ class MoveToSprintLightboxController
_loadSprints: () ->
@rs.sprints.list(@.projectId, {closed: false}).then (data) =>
- @.sprints = data.milestones
+ @.sprints = _.filter(data.milestones, (x) => x.id != @.sprint.id)
updateSelected: (itemType, value) ->
@.typesSelected[itemType] = value
diff --git a/app/modules/components/move-to-sprint/move-to-sprint-lb/move-to-sprint-lb.jade b/app/modules/components/move-to-sprint/move-to-sprint-lb/move-to-sprint-lb.jade
index 823e073e..a3a18fb9 100644
--- a/app/modules/components/move-to-sprint/move-to-sprint-lb/move-to-sprint-lb.jade
+++ b/app/modules/components/move-to-sprint/move-to-sprint-lb/move-to-sprint-lb.jade
@@ -13,6 +13,7 @@ tg-lightbox-close
ng-checked="vm.typesSelected['uss']"
ng-model="vm.typesSelected['uss']"
ng-change="vm.updateSelected('uss', vm.typesSelected['uss'])"
+ ng-disabled="!vm.sprints.length"
)
div
span.check-text.check-yes(translate="COMMON.YES")
@@ -26,6 +27,7 @@ tg-lightbox-close
ng-checked="vm.typesSelected['tasks']"
ng-model="vm.typesSelected['tasks']"
ng-change="vm.updateSelected('tasks', vm.typesSelected['tasks'])"
+ ng-disabled="!vm.sprints.length"
)
div
span.check-text.check-yes(translate="COMMON.YES")
@@ -39,29 +41,32 @@ tg-lightbox-close
ng-checked="vm.typesSelected['issues']"
ng-model="vm.typesSelected['issues']"
ng-change="vm.updateSelected('issues', vm.typesSelected['issues'])"
+ ng-disabled="!vm.sprints.length"
)
div
span.check-text.check-yes(translate="COMMON.YES")
span.check-text.check-no(translate="COMMON.NO")
.move-to-sprint-controls
- fieldset
- label {{ 'TASKBOARD.MOVE_TO_SPRINT.MOVE_TO_OPEN_SPRINT'|translate }}
- select.sprint-select(
- ng-model="vm.selectedSprintId"
- ng-options="s.id as s.name for s in vm.sprints|filter: { id: '!' + vm.sprint.id }"
- id="sprint-selector-dropdown"
- autofocus
+ p(ng-if="!vm.sprints.length") {{ 'TASKBOARD.MOVE_TO_SPRINT.NO_OPEN_SPRINTS'|translate }}
+ div(ng-if="vm.sprints.length > 0")
+ fieldset
+ label {{ 'TASKBOARD.MOVE_TO_SPRINT.MOVE_TO_OPEN_SPRINT'|translate }}
+ select.sprint-select(
+ ng-model="vm.selectedSprintId"
+ ng-options="s.id as s.name for s in vm.sprints"
+ id="sprint-selector-dropdown"
+ autofocus
+ )
+ option(
+ value=""
+ disabled
+ selected
+ translate="TASKBOARD.MOVE_TO_SPRINT.SELECT_DESTINATION_PLACEHOLDER"
+ )
+ button.button-green.move-button(
+ href=""
+ ng-click="vm.submit()"
+ translate="COMMON.SAVE"
+ ng-disabled="!(vm.selectedSprintId && vm.someSelected)"
)
- option(
- value=""
- disabled
- selected
- translate="TASKBOARD.MOVE_TO_SPRINT.SELECT_DESTINATION_PLACEHOLDER"
- )
- button.button-green.move-button(
- href=""
- ng-click="vm.submit()"
- translate="COMMON.SAVE"
- ng-disabled="!(vm.selectedSprintId && vm.someSelected)"
- )
diff --git a/app/modules/components/move-to-sprint/move-to-sprint-lb/move-to-sprint-lb.scss b/app/modules/components/move-to-sprint/move-to-sprint-lb/move-to-sprint-lb.scss
index 95654969..46c79d97 100644
--- a/app/modules/components/move-to-sprint/move-to-sprint-lb/move-to-sprint-lb.scss
+++ b/app/modules/components/move-to-sprint/move-to-sprint-lb/move-to-sprint-lb.scss
@@ -22,6 +22,10 @@
}
}
.move-to-sprint-controls {
+ p {
+ margin-bottom: 2.5em;
+ text-align: center;
+ }
.sprint-select {
margin-top: .5em;
}
diff --git a/app/modules/components/move-to-sprint/move-to-sprint.controller.coffee b/app/modules/components/move-to-sprint/move-to-sprint.controller.coffee
index 60d98b89..85cd4605 100644
--- a/app/modules/components/move-to-sprint/move-to-sprint.controller.coffee
+++ b/app/modules/components/move-to-sprint/move-to-sprint.controller.coffee
@@ -23,9 +23,15 @@ class MoveToSprintController
@.$inject = [
'$scope'
'tgLightboxFactory'
+ 'tgProjectService'
]
- constructor: (@scope, @lightboxFactory) ->
+ constructor: (
+ @scope
+ @lightboxFactory
+ @projectService
+ ) ->
+ @.permissions = @projectService.project.get('my_permissions')
@.hasOpenItems = false
@.disabled = false
@.openItems = {
@@ -58,7 +64,7 @@ class MoveToSprintController
})
getOpenUss: () ->
- return if !@.uss
+ return if !@.uss or @.permissions.indexOf("modify_us") == -1
@.openItems.uss = []
@.uss.map (us) =>
if us.is_closed is false
@@ -69,7 +75,7 @@ class MoveToSprintController
@.hasOpenItems = @checkOpenItems()
getOpenUnassignedTasks: () ->
- return if !@.unnasignedTasks
+ return if !@.unnasignedTasks or @.permissions.indexOf("modify_task") == -1
@.openItems.tasks = []
@.unnasignedTasks.map (column) => column.map (task) =>
if task.get('model').get('is_closed') is false
@@ -80,7 +86,7 @@ class MoveToSprintController
@.hasOpenItems = @checkOpenItems()
getOpenIssues: () ->
- return if !@.issues
+ return if !@.issues or @.permissions.indexOf("modify_issue") == -1
@.openItems.issues = []
@.issues.map (issue) =>
if issue.get('status').get('is_closed') is false
diff --git a/app/modules/components/move-to-sprint/move-to-sprint.controller.spec.coffee b/app/modules/components/move-to-sprint/move-to-sprint.controller.spec.coffee
index 6ee5ec89..7ce68f30 100644
--- a/app/modules/components/move-to-sprint/move-to-sprint.controller.spec.coffee
+++ b/app/modules/components/move-to-sprint/move-to-sprint.controller.spec.coffee
@@ -31,10 +31,20 @@ describe "MoveToSprint", ->
provide.value "tgLightboxFactory", mocks.tgLightboxFactory
+ _mockTgProjectService = () ->
+ mocks.tgProjectService = {
+ project: Immutable.fromJS({
+ my_permissions: ['modify_us', 'modify_task', 'modify_issue']
+ })
+ }
+
+ provide.value "tgProjectService", mocks.tgProjectService
+
_mocks = () ->
module ($provide) ->
provide = $provide
_mockTgLightboxFactory()
+ _mockTgProjectService()
return null
_inject = ->