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 | |
| parent | 9257818363269a2893c1a7ee61adb497f749e38f (diff) | |
showing the collab url
| -rw-r--r-- | public/assets/javascripts/ui/editor/Collaborators.js | 21 | ||||
| -rw-r--r-- | public/assets/javascripts/ui/site/SignUpModal.js | 1 | ||||
| -rw-r--r-- | server/lib/api/collaborator.js | 2 | ||||
| -rw-r--r-- | views/controls/editor/collaborators.ejs | 29 |
4 files changed, 50 insertions, 3 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") diff --git a/public/assets/javascripts/ui/site/SignUpModal.js b/public/assets/javascripts/ui/site/SignUpModal.js index 5c651ee..a452023 100644 --- a/public/assets/javascripts/ui/site/SignUpModal.js +++ b/public/assets/javascripts/ui/site/SignUpModal.js @@ -34,4 +34,3 @@ var SignUpModal = ModalFormView.extend({ } }) - diff --git a/server/lib/api/collaborator.js b/server/lib/api/collaborator.js index c080070..1fda01b 100644 --- a/server/lib/api/collaborator.js +++ b/server/lib/api/collaborator.js @@ -57,7 +57,7 @@ var collaborator = { return res.json({ error: "can't find project" }) } var data = util.cleanQuery(req.body) - data.email = util.sanitize( data.email ) + data.email = util.trim( util.sanitize( data.email ) ) data.project_id = req.project._id delete data.user_id diff --git a/views/controls/editor/collaborators.ejs b/views/controls/editor/collaborators.ejs index 1386a5c..69e5b64 100644 --- a/views/controls/editor/collaborators.ejs +++ b/views/controls/editor/collaborators.ejs @@ -13,6 +13,12 @@ <input type="submit" id="collaborator-invite" value="Invite to this project"> </form> + <div id="collaborator-url-rapper"> + We've sent a link to join this project to <span id="collaborator-dummy-email"></span>. + You can also send this link yourself: + <input type="text" id="collaborator-url"> + </div> + <ul id="collaborator-list"> </ul> @@ -30,3 +36,26 @@ <span class="role">owner</span> </li> </script> + +<style> +#collaborator-url-rapper { + display: none; + background: #fff; + border: 1px solid; + box-shadow: -3px 3px 0; + padding: 10px; + font-weight: 300; + font-size: 14px; + margin: 10px 0; +} +#collaborator-url { + font-size: 16px; + width: 500px; + border: 1px solid; + font-size: 14px; + padding: 5px; + font-weight: 300; + margin-top: 5px; + display: block; +} +</style> |
