diff --git a/services/web/.travis.yml b/services/web/.travis.yml new file mode 100644 index 0000000000..d97f744899 --- /dev/null +++ b/services/web/.travis.yml @@ -0,0 +1,19 @@ +language: node_js + +node_js: + - "0.10" + +before_install: + - npm install -g grunt-cli + +install: + - npm install + - grunt install + +script: + - grunt test:unit + +services: + - redis-server + - mongodb + diff --git a/services/web/README.md b/services/web/README.md index dd4469db6a..b74e61b983 100644 --- a/services/web/README.md +++ b/services/web/README.md @@ -9,6 +9,11 @@ a lot of logic around creating and editing projects, and account management. The rest of the ShareLaTeX stack, along with information about contributing can be found in the [sharelatex/sharelatex](https://github.com/sharelatex/sharelatex) repository. +Unit test status +---------------- + +[![Unit test status](https://travis-ci.org/sharelatex/web-sharelatex.png?branch=master)](https://travis-ci.org/sharelatex/web-sharelatex) + License and Credits ------------------- diff --git a/services/web/app/coffee/controllers/UserController.coffee b/services/web/app/coffee/controllers/UserController.coffee index 92e8fe0d2d..2f2979fa59 100644 --- a/services/web/app/coffee/controllers/UserController.coffee +++ b/services/web/app/coffee/controllers/UserController.coffee @@ -170,6 +170,7 @@ module.exports = metrics.inc "user.password-change" oldPass = req.body.currentPassword AuthenticationManager.authenticate _id: req.session.user._id, oldPass, (err, user)-> + return callback(err) if err? if(user) logger.log user: req.session.user, "changing password" newPassword1 = req.body.newPassword1 @@ -198,17 +199,20 @@ module.exports = redirectUserToDropboxAuth: (req, res)-> user_id = req.session.user._id dropboxHandler.getDropboxRegisterUrl user_id, (err, url)-> + return callback(err) if err? logger.log url:url, "redirecting user for dropbox auth" res.redirect url completeDropboxRegistration: (req, res)-> user_id = req.session.user._id dropboxHandler.completeRegistration user_id, (err, success)-> + return callback(err) if err? res.redirect('/user/settings#dropboxSettings') unlinkDropbox: (req, res)-> user_id = req.session.user._id dropboxHandler.unlinkAccount user_id, (err, success)-> + return callback(err) if err? res.redirect('/user/settings#dropboxSettings') deleteUser: (req, res)-> diff --git a/services/web/app/coffee/models/User.coffee b/services/web/app/coffee/models/User.coffee index 2d8e980954..a4141880a0 100644 --- a/services/web/app/coffee/models/User.coffee +++ b/services/web/app/coffee/models/User.coffee @@ -26,9 +26,9 @@ UserSchema = new Schema pdfViewer : {type : String, default: "pdfjs"} } features : { - collaborators: {type:Number, default:1} - versioning: {type:Boolean, default:false} - dropbox: {type:Boolean, default:false} + collaborators: { type:Number, default: Settings.defaultFeatures.collaborators } + versioning: { type:Boolean, default: Settings.defaultFeatures.versioning } + dropbox: { type:Boolean, default: Settings.defaultFeatures.dropbox } } featureSwitches : { dropbox: {type:Boolean, default:true}, diff --git a/services/web/app/views/general/small-footer.jade b/services/web/app/views/general/small-footer.jade index 4ae3ea67c6..f6a2d3f4df 100644 --- a/services/web/app/views/general/small-footer.jade +++ b/services/web/app/views/general/small-footer.jade @@ -1,4 +1,8 @@ .row-fluid + .span12 + div.alert.alert-success.open-source + | ShareLaTeX is open source. + a(href="https://github.com/sharelatex/sharelatex") Fork us on GitHub. .span12 .small-footer ul diff --git a/services/web/app/views/referal/bonus.jade b/services/web/app/views/referal/bonus.jade index e9cb732e19..e3fae568f8 100644 --- a/services/web/app/views/referal/bonus.jade +++ b/services/web/app/views/referal/bonus.jade @@ -34,7 +34,7 @@ block content .row .span4.offset4.bonus-banner .title - a(href='mailto:?subject=Online LaTeX editor you may like, &body=Hey, I have been using the online LaTeX editor ShareLaTeX recently and thought you might like to check it out. #{encodeURIComponent(buildReferalUrl("e"))}', title='Share by Email').email Email us to your friends + a(href='mailto:?subject=Online LaTeX editor you may like &body=Hey, I have been using the online LaTeX editor ShareLaTeX recently and thought you might like to check it out. #{encodeURIComponent(buildReferalUrl("e"))}', title='Share by Email').email Email us to your friends .row .span4.offset4.bonus-banner diff --git a/services/web/app/views/subscriptions/plans.jade b/services/web/app/views/subscriptions/plans.jade index 1eed30d050..31f46a9170 100644 --- a/services/web/app/views/subscriptions/plans.jade +++ b/services/web/app/views/subscriptions/plans.jade @@ -150,8 +150,8 @@ block content mixin plan(plans.groupAnnualPlans[2], "", false) .tab-pane.student-pricing - include ../general/small-footer - link(rel='stylesheet', href='/brand/plans.css?fingerprint='+fingerprint('/brand/mainStyle.css')) + include ../general/small-footer + link(rel='stylesheet', href='/brand/plans.css?fingerprint='+fingerprint('/brand/mainStyle.css')) - script - mixpanel.track("Page Viewed", { name: "plans" }) + script + mixpanel.track("Page Viewed", { name: "plans" }) diff --git a/services/web/app/views/user/settings.jade b/services/web/app/views/user/settings.jade index 8640ce3a1d..c7349bbc13 100644 --- a/services/web/app/views/user/settings.jade +++ b/services/web/app/views/user/settings.jade @@ -152,6 +152,8 @@ block content p Every few months we send a news letter out summarizing the new features available, if you would prefer to not receive this email then you are free to unsubscribe below at any time a#unsubscribeFromNewsletter.btn.btn-danger(data-csrf=csrfToken) Unsubscribe + include ../general/small-footer + #changePasswordModal(style='display: none') .modal form#changePasswordForm(method="post", action="/user/password/update") diff --git a/services/web/config/settings.development.coffee b/services/web/config/settings.development.coffee index 8404481f40..bbd5296671 100644 --- a/services/web/config/settings.development.coffee +++ b/services/web/config/settings.development.coffee @@ -112,14 +112,16 @@ module.exports = # # You can select the features that are enabled by default for new # new users. + defaultFeatures: defaultFeatures = + collaborators: -1 + dropbox: true + versioning: true + plans: plans = [{ planCode: "personal" name: "Personal" price: 0 - features: - collaborators: -1 - dropbox: true - versioning: true + features: defaultFeatures }] # Spelling languages diff --git a/services/web/package.json b/services/web/package.json index 6de023e4df..1261713176 100644 --- a/services/web/package.json +++ b/services/web/package.json @@ -26,9 +26,9 @@ "mimelib": "~0.2.8", "bufferedstream": "~1.4.1", "mixpanel": "0.0.18", - "settings-sharelatex": "git+ssh://git@github.com:sharelatex/settings-sharelatex.git#master", - "logger-sharelatex": "git+ssh://git@github.com:sharelatex/logger-sharelatex.git#master", - "soa-req-id": "git+ssh://git@github.com:sharelatex/soa-req-id.git#master", + "settings-sharelatex": "git+https://github.com/sharelatex/settings-sharelatex.git#master", + "logger-sharelatex": "git+https://github.com/sharelatex/logger-sharelatex.git#master", + "soa-req-id": "git+https://github.com/sharelatex/soa-req-id.git#master", "fairy": "0.0.2", "node-uuid": "~1.4.0", "mongojs": "0.9.8", diff --git a/services/web/public/coffee/editor/Editor.coffee b/services/web/public/coffee/editor/Editor.coffee index e3e60f79d9..15f5307995 100644 --- a/services/web/public/coffee/editor/Editor.coffee +++ b/services/web/public/coffee/editor/Editor.coffee @@ -141,6 +141,7 @@ define [ readOnly: true aceEditor.commands.removeCommand "transposeletters" aceEditor.commands.removeCommand "showSettingsMenu" + aceEditor.commands.removeCommand "foldall" aceEditor.showCommandLine = (args...) => @trigger "showCommandLine", aceEditor, args... diff --git a/services/web/public/coffee/project-members/ProjectMembersManager.coffee b/services/web/public/coffee/project-members/ProjectMembersManager.coffee index e8ef12ae78..0c66d4f19f 100644 --- a/services/web/public/coffee/project-members/ProjectMembersManager.coffee +++ b/services/web/public/coffee/project-members/ProjectMembersManager.coffee @@ -252,7 +252,7 @@ define [ @ide = @options.ide url: (medium) -> - "https://www.sharelatex.com/project/#{@ide.project.get("id")}" + + "#{window.sharelatex.siteUrl}/project/#{@ide.project.get("id")}" + "?r=#{@ide.user.get("referal_id")}&rs=ps&rm=#{medium}" # Referal source = public share render: -> @@ -264,10 +264,10 @@ define [ url = "https://www.facebook.com/dialog/feed?link=#{encodeURIComponent(@url("fb"))}&" + "app_id=148710621956179&" + - "picture=https://www.sharelatex.com/brand/logo/logo-128.png&" + + "picture=#{window.sharelatex.siteUrl}/brand/logo/logo-128.png&" + "name=#{@ide.project.get("name")}&" + "caption=My LaTeX project (#{@ide.project.get("name")}) is available online on ShareLaTeX&" + - "redirect_uri=http://www.sharelatex.com&" + + "redirect_uri=#{window.sharelatex.siteUrl}&" + "display=popup" mixpanel?.track("Project Shared", { method: "facebook" }) window.open( diff --git a/services/web/public/stylesheets/less/editor.less b/services/web/public/stylesheets/less/editor.less index e41592a08e..3cf8b012b9 100644 --- a/services/web/public/stylesheets/less/editor.less +++ b/services/web/public/stylesheets/less/editor.less @@ -299,7 +299,7 @@ body.editor { .small { color: #666; margin-top: 6px; - white-space: pre; + white-space: pre-wrap; } } #rawLogArea { diff --git a/services/web/public/stylesheets/less/footer.less b/services/web/public/stylesheets/less/footer.less index e78d1845df..becd4cd589 100644 --- a/services/web/public/stylesheets/less/footer.less +++ b/services/web/public/stylesheets/less/footer.less @@ -1,6 +1,11 @@ - +.open-source { + text-align: center; + width: 300px; + margin: auto; + margin-top: 6px; +} .small-footer { - margin-top: 20px; + margin-top: 12px; margin-bottom: 20px; text-align:center; font-size: 0.9em;