diff options
Diffstat (limited to 'public/assets/javascripts/ui/editor/Collaborators.js')
| -rw-r--r-- | public/assets/javascripts/ui/editor/Collaborators.js | 31 |
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() }, + }) + } }, }) |
