lightbox refactor
parent
c3e96c16c8
commit
e5d0428373
|
@ -56,16 +56,11 @@ CreateMembersDirective = ($rs, $rootScope, $confirm) ->
|
||||||
|
|
||||||
$scope.$on "membersform:new", ->
|
$scope.$on "membersform:new", ->
|
||||||
resetForm()
|
resetForm()
|
||||||
$el.removeClass("hidden")
|
lightboxService.open($el)
|
||||||
|
|
||||||
$scope.$on "$destroy", ->
|
$scope.$on "$destroy", ->
|
||||||
$el.off()
|
$el.off()
|
||||||
|
|
||||||
# Dom Event Handlers
|
|
||||||
$el.on "click", ".close", (event) ->
|
|
||||||
event.preventDefault()
|
|
||||||
$el.addClass("hidden")
|
|
||||||
|
|
||||||
$el.on "click", ".delete-fieldset", (event) ->
|
$el.on "click", ".delete-fieldset", (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
target = angular.element(event.currentTarget)
|
target = angular.element(event.currentTarget)
|
||||||
|
@ -97,12 +92,12 @@ CreateMembersDirective = ($rs, $rootScope, $confirm) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
|
||||||
onSuccess = (data) ->
|
onSuccess = (data) ->
|
||||||
$el.addClass("hidden")
|
lightboxService.close($el)
|
||||||
$confirm.notify("success")
|
$confirm.notify("success")
|
||||||
$rootScope.$broadcast("membersform:new:success")
|
$rootScope.$broadcast("membersform:new:success")
|
||||||
|
|
||||||
onError = (data) ->
|
onError = (data) ->
|
||||||
$el.addClass("hidden")
|
lightboxService.close($el)
|
||||||
$confirm.notify("error")
|
$confirm.notify("error")
|
||||||
$rootScope.$broadcast("membersform:new:error")
|
$rootScope.$broadcast("membersform:new:error")
|
||||||
|
|
||||||
|
@ -123,5 +118,5 @@ CreateMembersDirective = ($rs, $rootScope, $confirm) ->
|
||||||
|
|
||||||
return {link: link}
|
return {link: link}
|
||||||
|
|
||||||
module.directive("tgLbCreateMembers", ["$tgResources", "$rootScope", "$tgConfirm",
|
module.directive("tgLbCreateMembers", ["$tgResources", "$rootScope", "$tgConfirm", "lightboxService",
|
||||||
CreateMembersDirective])
|
CreateMembersDirective])
|
||||||
|
|
|
@ -28,7 +28,7 @@ module = angular.module("taigaBacklog")
|
||||||
## Creare/Edit Sprint Lightbox Directive
|
## Creare/Edit Sprint Lightbox Directive
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
CreateEditSprint = ($repo, $confirm, $rs, $rootscope) ->
|
CreateEditSprint = ($repo, $confirm, $rs, $rootscope, lightboxService) ->
|
||||||
link = ($scope, $el, attrs) ->
|
link = ($scope, $el, attrs) ->
|
||||||
createSprint = true
|
createSprint = true
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ CreateEditSprint = ($repo, $confirm, $rs, $rootscope) ->
|
||||||
|
|
||||||
promise.then (data) ->
|
promise.then (data) ->
|
||||||
$scope.sprintsCounter += 1 if createSprint
|
$scope.sprintsCounter += 1 if createSprint
|
||||||
$el.addClass("hidden")
|
lightboxService.close($el)
|
||||||
$rootscope.$broadcast("sprintform:create:success", data)
|
$rootscope.$broadcast("sprintform:create:success", data)
|
||||||
|
|
||||||
promise.then null, (data) ->
|
promise.then null, (data) ->
|
||||||
|
@ -60,7 +60,7 @@ CreateEditSprint = ($repo, $confirm, $rs, $rootscope) ->
|
||||||
$confirm.ask(title, subtitle).then =>
|
$confirm.ask(title, subtitle).then =>
|
||||||
$repo.remove($scope.sprint).then ->
|
$repo.remove($scope.sprint).then ->
|
||||||
$scope.milestonesCounter -= 1
|
$scope.milestonesCounter -= 1
|
||||||
$el.addClass("hidden")
|
lightboxService.close($el)
|
||||||
$rootscope.$broadcast("sprintform:remove:success")
|
$rootscope.$broadcast("sprintform:remove:success")
|
||||||
|
|
||||||
$scope.$on "sprintform:create", ->
|
$scope.$on "sprintform:create", ->
|
||||||
|
@ -80,7 +80,7 @@ CreateEditSprint = ($repo, $confirm, $rs, $rootscope) ->
|
||||||
$el.find(".delete-sprint").hide()
|
$el.find(".delete-sprint").hide()
|
||||||
$el.find(".title").text("New sprint") #TODO i18n
|
$el.find(".title").text("New sprint") #TODO i18n
|
||||||
$el.find(".button-green").text("Create") #TODO i18n
|
$el.find(".button-green").text("Create") #TODO i18n
|
||||||
$el.removeClass("hidden")
|
lightboxService.open($el)
|
||||||
|
|
||||||
$scope.$on "sprintform:edit", (ctx, sprint) ->
|
$scope.$on "sprintform:edit", (ctx, sprint) ->
|
||||||
createSprint = false
|
createSprint = false
|
||||||
|
@ -90,11 +90,7 @@ CreateEditSprint = ($repo, $confirm, $rs, $rootscope) ->
|
||||||
$el.find(".delete-sprint").show()
|
$el.find(".delete-sprint").show()
|
||||||
$el.find(".title").text("Edit sprint") #TODO i18n
|
$el.find(".title").text("Edit sprint") #TODO i18n
|
||||||
$el.find(".button-green").text("Save") #TODO i18n
|
$el.find(".button-green").text("Save") #TODO i18n
|
||||||
$el.removeClass("hidden")
|
lightboxService.close($el)
|
||||||
|
|
||||||
$el.on "click", ".close", (event) ->
|
|
||||||
event.preventDefault()
|
|
||||||
$el.addClass("hidden")
|
|
||||||
|
|
||||||
$el.on "click", ".button-green", (event) ->
|
$el.on "click", ".button-green", (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
@ -115,5 +111,6 @@ module.directive("tgLbCreateEditSprint", [
|
||||||
"$tgConfirm",
|
"$tgConfirm",
|
||||||
"$tgResources",
|
"$tgResources",
|
||||||
"$rootScope",
|
"$rootScope",
|
||||||
|
"lightboxService"
|
||||||
CreateEditSprint
|
CreateEditSprint
|
||||||
])
|
])
|
||||||
|
|
|
@ -23,16 +23,39 @@ module = angular.module("taigaCommon")
|
||||||
|
|
||||||
bindOnce = @.taiga.bindOnce
|
bindOnce = @.taiga.bindOnce
|
||||||
|
|
||||||
|
class LightboxService extends taiga.Service
|
||||||
|
open: (lightbox) ->
|
||||||
|
lightbox.addClass('open')
|
||||||
|
|
||||||
|
close: (lightbox) ->
|
||||||
|
lightbox.removeClass('open')
|
||||||
|
|
||||||
|
module.service("lightboxService", LightboxService)
|
||||||
|
|
||||||
|
LightboxDirective = (lightboxService) ->
|
||||||
|
link = ($scope, $el, $attrs) ->
|
||||||
|
$el.on "click", ".close", (event) ->
|
||||||
|
event.preventDefault()
|
||||||
|
|
||||||
|
lightboxService.close($el)
|
||||||
|
|
||||||
|
return {
|
||||||
|
restrict: "C",
|
||||||
|
link: link
|
||||||
|
}
|
||||||
|
|
||||||
|
module.directive("lightbox", ["lightboxService", LightboxDirective])
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
## Block Lightbox Directive
|
## Block Lightbox Directive
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
BlockLightboxDirective = ->
|
BlockLightboxDirective = (lightboxService) ->
|
||||||
link = ($scope, $el, $attrs, $model) ->
|
link = ($scope, $el, $attrs, $model) ->
|
||||||
title = $attrs.title
|
title = $attrs.title
|
||||||
$el.find("h2.title").text(title)
|
$el.find("h2.title").text(title)
|
||||||
$scope.$on "block", ->
|
$scope.$on "block", ->
|
||||||
$el.removeClass("hidden")
|
lightboxService.close($el)
|
||||||
|
|
||||||
$scope.$on "unblock", ->
|
$scope.$on "unblock", ->
|
||||||
$model.$modelValue.is_blocked = false
|
$model.$modelValue.is_blocked = false
|
||||||
|
@ -41,10 +64,6 @@ BlockLightboxDirective = ->
|
||||||
$scope.$on "$destroy", ->
|
$scope.$on "$destroy", ->
|
||||||
$el.off()
|
$el.off()
|
||||||
|
|
||||||
$el.on "click", ".close", (event) ->
|
|
||||||
event.preventDefault()
|
|
||||||
$el.addClass("hidden")
|
|
||||||
|
|
||||||
$el.on "click", ".button-green", (event) ->
|
$el.on "click", ".button-green", (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
target = angular.element(event.currentTarget)
|
target = angular.element(event.currentTarget)
|
||||||
|
@ -53,7 +72,7 @@ BlockLightboxDirective = ->
|
||||||
$model.$modelValue.is_blocked = true
|
$model.$modelValue.is_blocked = true
|
||||||
$model.$modelValue.blocked_note = $el.find(".reason").val()
|
$model.$modelValue.blocked_note = $el.find(".reason").val()
|
||||||
|
|
||||||
$el.addClass("hidden")
|
lightboxService.close($el)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
templateUrl: "/partials/views/modules/lightbox_block.html"
|
templateUrl: "/partials/views/modules/lightbox_block.html"
|
||||||
|
@ -61,14 +80,14 @@ BlockLightboxDirective = ->
|
||||||
require:"ngModel"
|
require:"ngModel"
|
||||||
}
|
}
|
||||||
|
|
||||||
module.directive("tgLbBlock", BlockLightboxDirective)
|
module.directive("tgLbBlock", ["lightboxService", BlockLightboxDirective])
|
||||||
|
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
## Create/Edit Userstory Lightbox Directive
|
## Create/Edit Userstory Lightbox Directive
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
CreateEditUserstoryDirective = ($repo, $model, $rs, $rootScope) ->
|
CreateEditUserstoryDirective = ($repo, $model, $rs, $rootScope, lightboxService) ->
|
||||||
link = ($scope, $el, attrs) ->
|
link = ($scope, $el, attrs) ->
|
||||||
isNew = true
|
isNew = true
|
||||||
|
|
||||||
|
@ -82,7 +101,7 @@ CreateEditUserstoryDirective = ($repo, $model, $rs, $rootScope) ->
|
||||||
# Update texts for creation
|
# Update texts for creation
|
||||||
$el.find(".button-green span").html("Create") #TODO: i18n
|
$el.find(".button-green span").html("Create") #TODO: i18n
|
||||||
$el.find(".title").html("New user story ") #TODO: i18n
|
$el.find(".title").html("New user story ") #TODO: i18n
|
||||||
$el.removeClass("hidden")
|
lightboxService.open($el)
|
||||||
|
|
||||||
$scope.$on "usform:edit", (ctx, us) ->
|
$scope.$on "usform:edit", (ctx, us) ->
|
||||||
$scope.us = us
|
$scope.us = us
|
||||||
|
@ -90,7 +109,7 @@ CreateEditUserstoryDirective = ($repo, $model, $rs, $rootScope) ->
|
||||||
# Update texts for edition
|
# Update texts for edition
|
||||||
$el.find(".button-green span").html("Save") #TODO: i18n
|
$el.find(".button-green span").html("Save") #TODO: i18n
|
||||||
$el.find(".title").html("Edit user story ") #TODO: i18n
|
$el.find(".title").html("Edit user story ") #TODO: i18n
|
||||||
$el.removeClass("hidden")
|
lightboxService.open($el)
|
||||||
|
|
||||||
# Update requirement info (team, client or blocked)
|
# Update requirement info (team, client or blocked)
|
||||||
if us.is_blocked
|
if us.is_blocked
|
||||||
|
@ -105,12 +124,6 @@ CreateEditUserstoryDirective = ($repo, $model, $rs, $rootScope) ->
|
||||||
$scope.$on "$destroy", ->
|
$scope.$on "$destroy", ->
|
||||||
$el.off()
|
$el.off()
|
||||||
|
|
||||||
# Dom Event Handlers
|
|
||||||
|
|
||||||
$el.on "click", ".close", (event) ->
|
|
||||||
event.preventDefault()
|
|
||||||
$el.addClass("hidden")
|
|
||||||
|
|
||||||
$el.on "click", ".button-green", (event) ->
|
$el.on "click", ".button-green", (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
form = $el.find("form").checksley()
|
form = $el.find("form").checksley()
|
||||||
|
@ -125,7 +138,7 @@ CreateEditUserstoryDirective = ($repo, $model, $rs, $rootScope) ->
|
||||||
broadcastEvent = "usform:edit:success"
|
broadcastEvent = "usform:edit:success"
|
||||||
|
|
||||||
promise.then (data) ->
|
promise.then (data) ->
|
||||||
$el.addClass("hidden")
|
lightboxService.close($el)
|
||||||
$rootScope.$broadcast(broadcastEvent, data)
|
$rootScope.$broadcast(broadcastEvent, data)
|
||||||
|
|
||||||
$el.on "click", "label.blocked", (event) ->
|
$el.on "click", "label.blocked", (event) ->
|
||||||
|
@ -155,6 +168,7 @@ module.directive("tgLbCreateEditUserstory", [
|
||||||
"$tgModel",
|
"$tgModel",
|
||||||
"$tgResources",
|
"$tgResources",
|
||||||
"$rootScope",
|
"$rootScope",
|
||||||
|
"lightboxService",
|
||||||
CreateEditUserstoryDirective
|
CreateEditUserstoryDirective
|
||||||
])
|
])
|
||||||
|
|
||||||
|
@ -163,7 +177,7 @@ module.directive("tgLbCreateEditUserstory", [
|
||||||
## Creare Bulk Userstories Lightbox Directive
|
## Creare Bulk Userstories Lightbox Directive
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
CreateBulkUserstoriesDirective = ($repo, $rs, $rootscope) ->
|
CreateBulkUserstoriesDirective = ($repo, $rs, $rootscope, lightboxService) ->
|
||||||
link = ($scope, $el, attrs) ->
|
link = ($scope, $el, attrs) ->
|
||||||
$scope.$on "usform:bulk", (ctx, projectId, status) ->
|
$scope.$on "usform:bulk", (ctx, projectId, status) ->
|
||||||
$scope.new = {
|
$scope.new = {
|
||||||
|
@ -171,11 +185,7 @@ CreateBulkUserstoriesDirective = ($repo, $rs, $rootscope) ->
|
||||||
statusId: status
|
statusId: status
|
||||||
bulk: ""
|
bulk: ""
|
||||||
}
|
}
|
||||||
$el.removeClass("hidden")
|
lightboxService.close($el)
|
||||||
|
|
||||||
$el.on "click", ".close", (event) ->
|
|
||||||
event.preventDefault()
|
|
||||||
$el.addClass("hidden")
|
|
||||||
|
|
||||||
$el.on "click", ".button-green", (event) ->
|
$el.on "click", ".button-green", (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
@ -186,7 +196,7 @@ CreateBulkUserstoriesDirective = ($repo, $rs, $rootscope) ->
|
||||||
|
|
||||||
$rs.userstories.bulkCreate($scope.new.projectId, $scope.new.statusId, $scope.new.bulk).then (result) ->
|
$rs.userstories.bulkCreate($scope.new.projectId, $scope.new.statusId, $scope.new.bulk).then (result) ->
|
||||||
$rootscope.$broadcast("usform:bulk:success", result)
|
$rootscope.$broadcast("usform:bulk:success", result)
|
||||||
$el.addClass("hidden")
|
lightboxService.close($el)
|
||||||
|
|
||||||
$scope.$on "$destroy", ->
|
$scope.$on "$destroy", ->
|
||||||
$el.off()
|
$el.off()
|
||||||
|
@ -197,6 +207,7 @@ module.directive("tgLbCreateBulkUserstories", [
|
||||||
"$tgRepo",
|
"$tgRepo",
|
||||||
"$tgResources",
|
"$tgResources",
|
||||||
"$rootScope",
|
"$rootScope",
|
||||||
|
"lightboxService",
|
||||||
CreateBulkUserstoriesDirective
|
CreateBulkUserstoriesDirective
|
||||||
])
|
])
|
||||||
|
|
||||||
|
@ -240,7 +251,7 @@ usersTemplate = _.template("""
|
||||||
<% } %>
|
<% } %>
|
||||||
""")
|
""")
|
||||||
|
|
||||||
AssignedToLightboxDirective = ->
|
AssignedToLightboxDirective = (lightboxService) ->
|
||||||
link = ($scope, $el, $attrs) ->
|
link = ($scope, $el, $attrs) ->
|
||||||
selectedUser = null
|
selectedUser = null
|
||||||
selectedItem = null
|
selectedItem = null
|
||||||
|
@ -272,7 +283,7 @@ AssignedToLightboxDirective = ->
|
||||||
selectedUser = $scope.usersById[assignedToId]
|
selectedUser = $scope.usersById[assignedToId]
|
||||||
|
|
||||||
render(selectedUser)
|
render(selectedUser)
|
||||||
$el.removeClass("hidden")
|
lightboxService.open($el)
|
||||||
|
|
||||||
$scope.$watch "usersSearch", (searchingText) ->
|
$scope.$watch "usersSearch", (searchingText) ->
|
||||||
render(selectedUser, searchingText) if searchingText?
|
render(selectedUser, searchingText) if searchingText?
|
||||||
|
@ -281,7 +292,8 @@ AssignedToLightboxDirective = ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
target = angular.element(event.currentTarget)
|
target = angular.element(event.currentTarget)
|
||||||
|
|
||||||
$el.addClass("hidden")
|
lightboxService.close($el)
|
||||||
|
|
||||||
$scope.$apply ->
|
$scope.$apply ->
|
||||||
$scope.$broadcast("assigned-to:added", target.data("user-id"), selectedItem)
|
$scope.$broadcast("assigned-to:added", target.data("user-id"), selectedItem)
|
||||||
$scope.usersSearch = null
|
$scope.usersSearch = null
|
||||||
|
@ -290,14 +302,17 @@ AssignedToLightboxDirective = ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
|
|
||||||
$el.addClass("hidden")
|
lightboxService.close($el)
|
||||||
|
|
||||||
$scope.$apply ->
|
$scope.$apply ->
|
||||||
$scope.usersSearch = null
|
$scope.usersSearch = null
|
||||||
$scope.$broadcast("assigned-to:added", null, selectedItem)
|
$scope.$broadcast("assigned-to:added", null, selectedItem)
|
||||||
|
|
||||||
$el.on "click", ".close", (event) ->
|
$el.on "click", ".close", (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
$el.addClass("hidden")
|
|
||||||
|
lightboxService.close($el)
|
||||||
|
|
||||||
$scope.$apply ->
|
$scope.$apply ->
|
||||||
$scope.usersSearch = null
|
$scope.usersSearch = null
|
||||||
|
|
||||||
|
@ -310,14 +325,14 @@ AssignedToLightboxDirective = ->
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
module.directive("tgLbAssignedto", AssignedToLightboxDirective)
|
module.directive("tgLbAssignedto", ["lightboxService", AssignedToLightboxDirective])
|
||||||
|
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
## Watchers Lightbox directive
|
## Watchers Lightbox directive
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
WatchersLightboxDirective = ($repo) ->
|
WatchersLightboxDirective = ($repo, lightboxService) ->
|
||||||
link = ($scope, $el, $attrs) ->
|
link = ($scope, $el, $attrs) ->
|
||||||
selectedItem = null
|
selectedItem = null
|
||||||
|
|
||||||
|
@ -354,7 +369,7 @@ WatchersLightboxDirective = ($repo) ->
|
||||||
users = getFilteredUsers()
|
users = getFilteredUsers()
|
||||||
render(users)
|
render(users)
|
||||||
|
|
||||||
$el.removeClass("hidden")
|
lightboxService.open($el)
|
||||||
|
|
||||||
$scope.$watch "usersSearch", (searchingText) ->
|
$scope.$watch "usersSearch", (searchingText) ->
|
||||||
if not searchingText?
|
if not searchingText?
|
||||||
|
@ -364,7 +379,7 @@ WatchersLightboxDirective = ($repo) ->
|
||||||
render(users)
|
render(users)
|
||||||
|
|
||||||
$el.on "click", ".watcher-single", (event) ->
|
$el.on "click", ".watcher-single", (event) ->
|
||||||
$el.addClass("hidden")
|
lightboxService.close($el)
|
||||||
|
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
target = angular.element(event.currentTarget)
|
target = angular.element(event.currentTarget)
|
||||||
|
@ -375,7 +390,7 @@ WatchersLightboxDirective = ($repo) ->
|
||||||
|
|
||||||
$el.on "click", ".close", (event) ->
|
$el.on "click", ".close", (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
$el.addClass("hidden")
|
lightboxService.close($el)
|
||||||
$scope.$apply ->
|
$scope.$apply ->
|
||||||
$scope.usersSearch = null
|
$scope.usersSearch = null
|
||||||
|
|
||||||
|
@ -387,4 +402,4 @@ WatchersLightboxDirective = ($repo) ->
|
||||||
link:link
|
link:link
|
||||||
}
|
}
|
||||||
|
|
||||||
module.directive("tgLbWatchers", ["$tgRepo", WatchersLightboxDirective])
|
module.directive("tgLbWatchers", ["$tgRepo", "lightboxService", WatchersLightboxDirective])
|
||||||
|
|
|
@ -28,13 +28,13 @@ module = angular.module("taigaIssues")
|
||||||
## Issue Create Lightbox Directive
|
## Issue Create Lightbox Directive
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
CreateIssueDirective = ($repo, $model, $rs, $rootscope) ->
|
CreateIssueDirective = ($repo, $model, $rs, $rootscope, lightboxService) ->
|
||||||
link = ($scope, $el, $attrs) ->
|
link = ($scope, $el, $attrs) ->
|
||||||
form = $el.find("form").checksley()
|
form = $el.find("form").checksley()
|
||||||
$scope.issue = {}
|
$scope.issue = {}
|
||||||
|
|
||||||
$scope.$on "issueform:new", (ctx, project)->
|
$scope.$on "issueform:new", (ctx, project)->
|
||||||
$el.removeClass("hidden")
|
lightboxService.open($el)
|
||||||
|
|
||||||
$scope.issue = {
|
$scope.issue = {
|
||||||
project: project.id
|
project: project.id
|
||||||
|
@ -57,7 +57,7 @@ CreateIssueDirective = ($repo, $model, $rs, $rootscope) ->
|
||||||
promise = $repo.create("issues", $scope.issue)
|
promise = $repo.create("issues", $scope.issue)
|
||||||
|
|
||||||
promise.then (data) ->
|
promise.then (data) ->
|
||||||
$el.addClass("hidden")
|
lightboxService.close($el)
|
||||||
console.log "succcess", data
|
console.log "succcess", data
|
||||||
$rootscope.$broadcast("issueform:new:success", data)
|
$rootscope.$broadcast("issueform:new:success", data)
|
||||||
|
|
||||||
|
@ -65,10 +65,6 @@ CreateIssueDirective = ($repo, $model, $rs, $rootscope) ->
|
||||||
promise.then null, ->
|
promise.then null, ->
|
||||||
console.log "FAIL"
|
console.log "FAIL"
|
||||||
|
|
||||||
$el.on "click", ".close", (event) ->
|
|
||||||
event.preventDefault()
|
|
||||||
$el.addClass("hidden")
|
|
||||||
|
|
||||||
$el.on "click", ".button-green", (event) ->
|
$el.on "click", ".button-green", (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
submit()
|
submit()
|
||||||
|
@ -80,19 +76,15 @@ CreateIssueDirective = ($repo, $model, $rs, $rootscope) ->
|
||||||
return {link:link}
|
return {link:link}
|
||||||
|
|
||||||
|
|
||||||
CreateBulkIssuesDirective = ($repo, $rs, $rootscope) ->
|
CreateBulkIssuesDirective = ($repo, $rs, $rootscope, lightboxService) ->
|
||||||
link = ($scope, $el, attrs) ->
|
link = ($scope, $el, attrs) ->
|
||||||
$scope.$on "issueform:bulk", (ctx, projectId, status)->
|
$scope.$on "issueform:bulk", (ctx, projectId, status)->
|
||||||
$el.removeClass("hidden")
|
lightboxService.open($el)
|
||||||
$scope.new = {
|
$scope.new = {
|
||||||
projectId: projectId
|
projectId: projectId
|
||||||
bulk: ""
|
bulk: ""
|
||||||
}
|
}
|
||||||
|
|
||||||
$el.on "click", ".close", (event) ->
|
|
||||||
event.preventDefault()
|
|
||||||
$el.addClass("hidden")
|
|
||||||
|
|
||||||
$el.on "click", ".button-green", (event) ->
|
$el.on "click", ".button-green", (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
|
||||||
|
@ -106,7 +98,7 @@ CreateBulkIssuesDirective = ($repo, $rs, $rootscope) ->
|
||||||
promise = $rs.issues.bulkCreate(projectId, data)
|
promise = $rs.issues.bulkCreate(projectId, data)
|
||||||
promise.then (result) ->
|
promise.then (result) ->
|
||||||
$rootscope.$broadcast("issueform:new:success", result)
|
$rootscope.$broadcast("issueform:new:success", result)
|
||||||
$el.addClass("hidden")
|
lightboxService.close($el)
|
||||||
|
|
||||||
# TODO: error handling
|
# TODO: error handling
|
||||||
promise.then null, ->
|
promise.then null, ->
|
||||||
|
@ -122,6 +114,7 @@ module.directive("tgLbCreateIssue", [
|
||||||
"$tgModel",
|
"$tgModel",
|
||||||
"$tgResources",
|
"$tgResources",
|
||||||
"$rootScope",
|
"$rootScope",
|
||||||
|
"lightboxService",
|
||||||
CreateIssueDirective
|
CreateIssueDirective
|
||||||
])
|
])
|
||||||
|
|
||||||
|
@ -129,6 +122,7 @@ module.directive("tgLbCreateBulkIssues", [
|
||||||
"$tgRepo",
|
"$tgRepo",
|
||||||
"$tgResources",
|
"$tgResources",
|
||||||
"$rootScope",
|
"$rootScope",
|
||||||
|
"lightboxService",
|
||||||
CreateBulkIssuesDirective
|
CreateBulkIssuesDirective
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
|
@ -3,14 +3,14 @@ bindOnce = @.taiga.bindOnce
|
||||||
|
|
||||||
module = angular.module("taigaProject")
|
module = angular.module("taigaProject")
|
||||||
|
|
||||||
CreateProject = ($repo, $confirm, $location, $navurls, $rs) ->
|
CreateProject = ($repo, $confirm, $location, $navurls, $rs, lightboxService) ->
|
||||||
link = ($scope, $el, attrs) ->
|
link = ($scope, $el, attrs) ->
|
||||||
$scope.data = {}
|
$scope.data = {}
|
||||||
$scope.templates = []
|
$scope.templates = []
|
||||||
form = $el.find("form").checksley()
|
form = $el.find("form").checksley()
|
||||||
|
|
||||||
onSuccessSubmit = (response) ->
|
onSuccessSubmit = (response) ->
|
||||||
$el.addClass("hidden")
|
lightboxService.close($el)
|
||||||
|
|
||||||
$confirm.notify("success", "Success") #TODO: i18n
|
$confirm.notify("success", "Success") #TODO: i18n
|
||||||
|
|
||||||
|
@ -38,11 +38,7 @@ CreateProject = ($repo, $confirm, $location, $navurls, $rs) ->
|
||||||
.then (result) =>
|
.then (result) =>
|
||||||
$scope.templates = _.map(result, (item) -> {"id": item.id, "name": item.name})
|
$scope.templates = _.map(result, (item) -> {"id": item.id, "name": item.name})
|
||||||
|
|
||||||
$el.removeClass("hidden")
|
lightboxService.open($el)
|
||||||
|
|
||||||
$el.on "click", ".close", (event) ->
|
|
||||||
event.preventDefault()
|
|
||||||
$el.addClass("hidden")
|
|
||||||
|
|
||||||
$el.on "click", "a.button-green", (event) ->
|
$el.on "click", "a.button-green", (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
@ -56,5 +52,6 @@ module.directive("tgLbCreateProject", [
|
||||||
"$location",
|
"$location",
|
||||||
"$tgNavUrls",
|
"$tgNavUrls",
|
||||||
"$tgResources",
|
"$tgResources",
|
||||||
|
"lightboxService",
|
||||||
CreateProject
|
CreateProject
|
||||||
])
|
])
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
taiga = @.taiga
|
taiga = @.taiga
|
||||||
bindOnce = @.taiga.bindOnce
|
bindOnce = @.taiga.bindOnce
|
||||||
|
|
||||||
CreateEditTaskDirective = ($repo, $model, $rs, $rootscope) ->
|
CreateEditTaskDirective = ($repo, $model, $rs, $rootscope, lightboxService) ->
|
||||||
link = ($scope, $el, attrs) ->
|
link = ($scope, $el, attrs) ->
|
||||||
isNew = true
|
isNew = true
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ CreateEditTaskDirective = ($repo, $model, $rs, $rootscope) ->
|
||||||
# Update texts for creation
|
# Update texts for creation
|
||||||
$el.find(".button-green span").html("Create") #TODO: i18n
|
$el.find(".button-green span").html("Create") #TODO: i18n
|
||||||
$el.find(".title").html("New task ") #TODO: i18n
|
$el.find(".title").html("New task ") #TODO: i18n
|
||||||
$el.removeClass("hidden")
|
lightboxService.open($el)
|
||||||
|
|
||||||
$scope.$on "taskform:edit", (ctx, task) ->
|
$scope.$on "taskform:edit", (ctx, task) ->
|
||||||
$scope.task = task
|
$scope.task = task
|
||||||
|
@ -49,7 +49,7 @@ CreateEditTaskDirective = ($repo, $model, $rs, $rootscope) ->
|
||||||
# Update texts for edition
|
# Update texts for edition
|
||||||
$el.find(".button-green span").html("Save") #TODO: i18n
|
$el.find(".button-green span").html("Save") #TODO: i18n
|
||||||
$el.find(".title").html("Edit task ") #TODO: i18n
|
$el.find(".title").html("Edit task ") #TODO: i18n
|
||||||
$el.removeClass("hidden")
|
lightboxService.open($el)
|
||||||
|
|
||||||
# Update requirement info (team, client or blocked)
|
# Update requirement info (team, client or blocked)
|
||||||
if task.is_blocked
|
if task.is_blocked
|
||||||
|
@ -59,12 +59,6 @@ CreateEditTaskDirective = ($repo, $model, $rs, $rootscope) ->
|
||||||
if task.is_iocaine
|
if task.is_iocaine
|
||||||
$el.find("label.iocaine").addClass("selected")
|
$el.find("label.iocaine").addClass("selected")
|
||||||
|
|
||||||
# Dom Event Handlers
|
|
||||||
|
|
||||||
$el.on "click", ".close", (event) ->
|
|
||||||
event.preventDefault()
|
|
||||||
$el.addClass("hidden")
|
|
||||||
|
|
||||||
$el.on "click", ".button-green", (event) ->
|
$el.on "click", ".button-green", (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
|
||||||
|
@ -81,7 +75,7 @@ CreateEditTaskDirective = ($repo, $model, $rs, $rootscope) ->
|
||||||
|
|
||||||
# FIXME: error handling?
|
# FIXME: error handling?
|
||||||
promise.then (data) ->
|
promise.then (data) ->
|
||||||
$el.addClass("hidden")
|
lightboxService.close($el)
|
||||||
$rootscope.$broadcast(broadcastEvent, data)
|
$rootscope.$broadcast(broadcastEvent, data)
|
||||||
|
|
||||||
$el.on "click", "label.blocked", (event) ->
|
$el.on "click", "label.blocked", (event) ->
|
||||||
|
@ -102,17 +96,17 @@ CreateEditTaskDirective = ($repo, $model, $rs, $rootscope) ->
|
||||||
return {link: link}
|
return {link: link}
|
||||||
|
|
||||||
|
|
||||||
CreateBulkTasksDirective = ($repo, $rs, $rootscope) ->
|
CreateBulkTasksDirective = ($repo, $rs, $rootscope, lightboxService) ->
|
||||||
link = ($scope, $el, attrs) ->
|
link = ($scope, $el, attrs) ->
|
||||||
$scope.form = {data: "", usId: null}
|
$scope.form = {data: "", usId: null}
|
||||||
|
|
||||||
$scope.$on "taskform:bulk", (ctx, sprintId, usId)->
|
$scope.$on "taskform:bulk", (ctx, sprintId, usId)->
|
||||||
$el.removeClass("hidden")
|
lightboxService.open($el)
|
||||||
$scope.form = {data: "", sprintId: sprintId, usId: usId}
|
$scope.form = {data: "", sprintId: sprintId, usId: usId}
|
||||||
|
|
||||||
$el.on "click", ".close", (event) ->
|
$el.on "click", ".close", (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
$el.addClass("hidden")
|
lightboxService.close($el)
|
||||||
|
|
||||||
$el.on "click", ".button-green", (event) ->
|
$el.on "click", ".button-green", (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
@ -129,7 +123,7 @@ CreateBulkTasksDirective = ($repo, $rs, $rootscope) ->
|
||||||
promise = $rs.tasks.bulkCreate(projectId, sprintId, usId, data)
|
promise = $rs.tasks.bulkCreate(projectId, sprintId, usId, data)
|
||||||
promise.then (result) ->
|
promise.then (result) ->
|
||||||
$rootscope.$broadcast("taskform:bulk:success", result)
|
$rootscope.$broadcast("taskform:bulk:success", result)
|
||||||
$el.addClass("hidden")
|
lightboxService.close($el)
|
||||||
|
|
||||||
# TODO: error handling
|
# TODO: error handling
|
||||||
promise.then null, ->
|
promise.then null, ->
|
||||||
|
@ -148,6 +142,7 @@ module.directive("tgLbCreateEditTask", [
|
||||||
"$tgModel",
|
"$tgModel",
|
||||||
"$tgResources",
|
"$tgResources",
|
||||||
"$rootScope",
|
"$rootScope",
|
||||||
|
"lightboxService",
|
||||||
CreateEditTaskDirective
|
CreateEditTaskDirective
|
||||||
])
|
])
|
||||||
|
|
||||||
|
@ -155,5 +150,6 @@ module.directive("tgLbCreateBulkTasks", [
|
||||||
"$tgRepo",
|
"$tgRepo",
|
||||||
"$tgResources",
|
"$tgResources",
|
||||||
"$rootScope",
|
"$rootScope",
|
||||||
|
"lightboxService",
|
||||||
CreateBulkTasksDirective
|
CreateBulkTasksDirective
|
||||||
])
|
])
|
||||||
|
|
|
@ -28,10 +28,10 @@ module = angular.module("taigaUserSettings")
|
||||||
## Delete User Lightbox Directive
|
## Delete User Lightbox Directive
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
DeleteUserDirective = ($repo, $rootscope, $auth, $location) ->
|
DeleteUserDirective = ($repo, $rootscope, $auth, $location, lightboxService) ->
|
||||||
link = ($scope, $el, $attrs) ->
|
link = ($scope, $el, $attrs) ->
|
||||||
$scope.$on "deletelightbox:new", (ctx, user)->
|
$scope.$on "deletelightbox:new", (ctx, user)->
|
||||||
$el.removeClass("hidden")
|
lightboxService.open($el)
|
||||||
|
|
||||||
$scope.$on "$destroy", ->
|
$scope.$on "$destroy", ->
|
||||||
$el.off()
|
$el.off()
|
||||||
|
@ -40,7 +40,7 @@ DeleteUserDirective = ($repo, $rootscope, $auth, $location) ->
|
||||||
promise = $repo.remove($scope.user)
|
promise = $repo.remove($scope.user)
|
||||||
|
|
||||||
promise.then (data) ->
|
promise.then (data) ->
|
||||||
$el.addClass("hidden")
|
lightboxService.close($el)
|
||||||
$auth.logout()
|
$auth.logout()
|
||||||
$location.path("/login")
|
$location.path("/login")
|
||||||
|
|
||||||
|
@ -48,13 +48,9 @@ DeleteUserDirective = ($repo, $rootscope, $auth, $location) ->
|
||||||
promise.then null, ->
|
promise.then null, ->
|
||||||
console.log "FAIL"
|
console.log "FAIL"
|
||||||
|
|
||||||
$el.on "click", ".close", (event) ->
|
|
||||||
event.preventDefault()
|
|
||||||
$el.addClass("hidden")
|
|
||||||
|
|
||||||
$el.on "click", ".button-red", (event) ->
|
$el.on "click", ".button-red", (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
$el.addClass("hidden")
|
lightboxService.close($el)
|
||||||
|
|
||||||
$el.on "click", ".button-green", (event) ->
|
$el.on "click", ".button-green", (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
@ -63,4 +59,4 @@ DeleteUserDirective = ($repo, $rootscope, $auth, $location) ->
|
||||||
return {link:link}
|
return {link:link}
|
||||||
|
|
||||||
|
|
||||||
module.directive("tgLbDeleteUser", ["$tgRepo", "$rootScope", "$tgAuth", "$location", DeleteUserDirective])
|
module.directive("tgLbDeleteUser", ["$tgRepo", "$rootScope", "$tgAuth", "$location", "lightboxService", DeleteUserDirective])
|
||||||
|
|
|
@ -29,9 +29,9 @@ block content
|
||||||
include views/modules/backlog-table
|
include views/modules/backlog-table
|
||||||
sidebar.menu-secondary.sidebar
|
sidebar.menu-secondary.sidebar
|
||||||
include views/modules/sprints
|
include views/modules/sprints
|
||||||
div.lightbox.lightbox_add-new-us.hidden(tg-lb-create-edit-userstory)
|
div.lightbox.lightbox_add-new-us(tg-lb-create-edit-userstory)
|
||||||
include views/modules/lightbox_add-new-us
|
include views/modules/lightbox_add-new-us
|
||||||
div.lightbox.lightbox_add-bulk.hidden(tg-lb-create-bulk-userstories)
|
div.lightbox.lightbox_add-bulk(tg-lb-create-bulk-userstories)
|
||||||
include views/modules/lightbox_add-bulk
|
include views/modules/lightbox_add-bulk
|
||||||
div.lightbox.lightbox_add-sprint.hidden(tg-lb-create-edit-sprint)
|
div.lightbox.lightbox_add-sprint(tg-lb-create-edit-sprint)
|
||||||
include views/modules/lightbox_add-edit-sprint
|
include views/modules/lightbox_add-edit-sprint
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
@include background-opacity($white, .95);
|
@include background-opacity($white, .95);
|
||||||
@include table-flex(center, center, flex, row, wrap, center);
|
@include table-flex(center, center, flex, row, wrap, center);
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
display: none;
|
||||||
left: 0;
|
left: 0;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
right: 0;
|
right: 0;
|
||||||
|
@ -29,6 +30,9 @@
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
&.open {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.markdown-preview {
|
.markdown-preview {
|
||||||
|
|
Loading…
Reference in New Issue