diff options
| author | Jules Laplace <jules@okfoc.us> | 2014-08-25 18:32:45 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2014-08-25 18:32:45 -0400 |
| commit | 5f5fcfee56a4f7067c1b9ccf51e662463b71e7f1 (patch) | |
| tree | c90cbc41f286221cae08cdf72a1c18a1c21600e8 /public/assets/javascripts/ui/editor/Collaborators.js | |
| parent | 9257818363269a2893c1a7ee61adb497f749e38f (diff) | |
showing the collab url
Diffstat (limited to 'public/assets/javascripts/ui/editor/Collaborators.js')
| -rw-r--r-- | public/assets/javascripts/ui/editor/Collaborators.js | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/public/assets/javascripts/ui/editor/Collaborators.js b/public/assets/javascripts/ui/editor/Collaborators.js index c27dbe0..eee412a 100644 --- a/public/assets/javascripts/ui/editor/Collaborators.js +++ b/public/assets/javascripts/ui/editor/Collaborators.js @@ -29,6 +29,7 @@ var Collaborators = ModalFormView.extend({ }, populate: function(collaborators){ + this.loaded = true collaborators.forEach(function(collab){ var $el = $( this.template ) $el.data("collaborator-id", collab._id) @@ -74,12 +75,30 @@ var Collaborators = ModalFormView.extend({ }, 100) } }, + + validate: function(){ + var errors = [] + + var email = this.$("[name=email]").val() + if (! email.length) { + errors.push("Please enter an email address"); + } + else if (email.indexOf("@") === -1) { + errors.push("Please enter a valid email address"); + } + + return errors + }, success: function(data){ 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) + this.$("#collaborator-dummy-email").html(data.email) + this.$("#collaborator-url-rapper").slideDown(300) }, - + destroy: function(e){ var $el = $(e.currentTarget).closest("li") var _id = $el.data("collaborator-id") |
