Adding delete button and lightbox to the project profile
parent
acfd884dd1
commit
946a18377d
|
@ -78,6 +78,9 @@ class ProjectProfileController extends mixOf(taiga.Controller, taiga.PageMixin)
|
||||||
|
|
||||||
return promise.then(=> @.loadProject())
|
return promise.then(=> @.loadProject())
|
||||||
|
|
||||||
|
openDeleteLightbox: ->
|
||||||
|
@rootscope.$broadcast("deletelightbox:new", @scope.project)
|
||||||
|
|
||||||
|
|
||||||
module.controller("ProjectProfileController", ProjectProfileController)
|
module.controller("ProjectProfileController", ProjectProfileController)
|
||||||
|
|
||||||
|
|
|
@ -57,3 +57,41 @@ module.directive("tgLbCreateProject", [
|
||||||
"lightboxService",
|
"lightboxService",
|
||||||
CreateProject
|
CreateProject
|
||||||
])
|
])
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
|
## Delete Project Lightbox Directive
|
||||||
|
#############################################################################
|
||||||
|
|
||||||
|
DeleteProjectDirective = ($repo, $rootscope, $auth, $location, lightboxService) ->
|
||||||
|
link = ($scope, $el, $attrs) ->
|
||||||
|
projectToDelete = null
|
||||||
|
$scope.$on "deletelightbox:new", (ctx, project)->
|
||||||
|
lightboxService.open($el)
|
||||||
|
projectToDelete = project
|
||||||
|
|
||||||
|
$scope.$on "$destroy", ->
|
||||||
|
$el.off()
|
||||||
|
|
||||||
|
submit = ->
|
||||||
|
promise = $repo.remove(projectToDelete)
|
||||||
|
|
||||||
|
promise.then (data) ->
|
||||||
|
lightboxService.close($el)
|
||||||
|
$location.path("/")
|
||||||
|
|
||||||
|
# FIXME: error handling?
|
||||||
|
promise.then null, ->
|
||||||
|
console.log "FAIL"
|
||||||
|
|
||||||
|
$el.on "click", ".button-red", (event) ->
|
||||||
|
event.preventDefault()
|
||||||
|
lightboxService.close($el)
|
||||||
|
|
||||||
|
$el.on "click", ".button-green", (event) ->
|
||||||
|
event.preventDefault()
|
||||||
|
submit()
|
||||||
|
|
||||||
|
return {link:link}
|
||||||
|
|
||||||
|
|
||||||
|
module.directive("tgLbDeleteProject", ["$tgRepo", "$rootScope", "$tgAuth", "$location", "lightboxService", DeleteProjectDirective])
|
||||||
|
|
|
@ -45,3 +45,7 @@ block content
|
||||||
|
|
||||||
input(type="submit", class="hidden")
|
input(type="submit", class="hidden")
|
||||||
a.button.button-green(href="") Save
|
a.button.button-green(href="") Save
|
||||||
|
a.delete-project(href="", title="Delete this project", ng-click="ctrl.openDeleteLightbox()") Delete this project
|
||||||
|
|
||||||
|
div.lightbox.lightbox-delete-project.hidden(tg-lb-delete-project)
|
||||||
|
include views/modules/lightbox-delete-project
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
a.close(href="", title="close")
|
||||||
|
span.icon.icon-delete
|
||||||
|
form
|
||||||
|
h2.title Delete project
|
||||||
|
p
|
||||||
|
span.delete-question Are you sure you want to delete this project?
|
||||||
|
span.subtitle All project data US/Tasks/Issues/Sprints/WikiPages will be lost! :-(
|
||||||
|
div.delete-options
|
||||||
|
a.button.button-green(href="", title="Yes, I'm really sure")
|
||||||
|
span Yes, I'm really sure
|
||||||
|
a.button.button-red(href="", title="Cancel")
|
||||||
|
span Cancel
|
|
@ -24,4 +24,9 @@
|
||||||
display: block;
|
display: block;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
.delete-project {
|
||||||
|
@extend %small;
|
||||||
|
display: block;
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -371,6 +371,33 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.lightbox-delete-project {
|
||||||
|
form {
|
||||||
|
@include table-flex-child(0, 420px, 0, 420px);
|
||||||
|
}
|
||||||
|
.delete-question,
|
||||||
|
.subtitle {
|
||||||
|
display: block;
|
||||||
|
line-height: 2rem;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.subtitle {
|
||||||
|
@extend %large;
|
||||||
|
@extend %title;
|
||||||
|
}
|
||||||
|
.delete-options {
|
||||||
|
@include table-flex();
|
||||||
|
a {
|
||||||
|
@include table-flex-child(1, 0, 0);
|
||||||
|
padding: 8px 0;
|
||||||
|
text-align: center;
|
||||||
|
&:first-child {
|
||||||
|
margin-right: .5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.lightbox-generic-success,
|
.lightbox-generic-success,
|
||||||
.lightbox-generic-error {
|
.lightbox-generic-error {
|
||||||
|
|
Loading…
Reference in New Issue