summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-08-25 18:40:31 -0400
committerJules Laplace <jules@okfoc.us>2014-08-25 18:40:31 -0400
commit289e422ca281fd59749c2353f193540f4fab981c (patch)
tree3820c473cec640c6395b259280beaa586b855af9
parent5f5fcfee56a4f7067c1b9ccf51e662463b71e7f1 (diff)
warning
-rw-r--r--public/assets/javascripts/ui/editor/Collaborators.js31
1 files changed, 23 insertions, 8 deletions
diff --git a/public/assets/javascripts/ui/editor/Collaborators.js b/public/assets/javascripts/ui/editor/Collaborators.js
index eee412a..452ad15 100644
--- a/public/assets/javascripts/ui/editor/Collaborators.js
+++ b/public/assets/javascripts/ui/editor/Collaborators.js
@@ -15,6 +15,7 @@ var Collaborators = ModalFormView.extend({
show: function(){
this.action = this.createAction
+ this.$("#collaborator-url-rapper").hide()
if (! this.loaded) {
this.load()
@@ -94,20 +95,34 @@ var Collaborators = ModalFormView.extend({
this.reset()
this.populate([data])
// weird! this.$("#collaborator-url") not working here, but works without this
- $("#collaborator-url").val("http://vvalls.com/join/" + data.nonce)
+ setTimeout(function(){
+ $("#collaborator-url").val("http://vvalls.com/join/" + data.nonce)
+ }, 100)
this.$("#collaborator-dummy-email").html(data.email)
this.$("#collaborator-url-rapper").slideDown(300)
},
destroy: function(e){
+ var base = this
var $el = $(e.currentTarget).closest("li")
- var _id = $el.data("collaborator-id")
- $el.remove()
- $.ajax({
- type: "DELETE",
- url: this.destroyAction(),
- data: { _id: _id, _csrf: $("[name=_csrf]").val() },
- })
+
+ if ($el.find(".user").length) {
+ var name = $el.find(".username").html()
+ ConfirmModal.confirm("Are you sure you want to remove " + name + " from this project?", _destroy)
+ }
+ else {
+ _destroy()
+ }
+
+ function _destroy () {
+ var _id = $el.data("collaborator-id")
+ $el.remove()
+ $.ajax({
+ type: "DELETE",
+ url: base.destroyAction(),
+ data: { _id: _id, _csrf: $("[name=_csrf]").val() },
+ })
+ }
},
})