mirror of
https://github.com/overleaf/overleaf.git
synced 2024-09-16 02:52:31 -04:00
finished contact us with groove
for settings file: <a ng-controller="ContactModal", ng-click="contactUsModal()", href>Contact</a>
This commit is contained in:
parent
882297c353
commit
4e78e34cdf
7 changed files with 101 additions and 15 deletions
|
@ -64,6 +64,12 @@ module.exports = (app, webRouter, apiRouter)->
|
||||||
Settings.siteUrl.substring(Settings.siteUrl.indexOf("//")+2)
|
Settings.siteUrl.substring(Settings.siteUrl.indexOf("//")+2)
|
||||||
next()
|
next()
|
||||||
|
|
||||||
|
webRouter.use (req, res, next)->
|
||||||
|
res.locals.getUserEmail = ->
|
||||||
|
email = req?.session?.user?.email or ""
|
||||||
|
return email
|
||||||
|
next()
|
||||||
|
|
||||||
webRouter.use (req, res, next)->
|
webRouter.use (req, res, next)->
|
||||||
res.locals.formatProjectPublicAccessLevel = (privilegeLevel)->
|
res.locals.formatProjectPublicAccessLevel = (privilegeLevel)->
|
||||||
formatedPrivileges = private:"Private", readOnly:"Public: Read Only", readAndWrite:"Public: Read and Write"
|
formatedPrivileges = private:"Private", readOnly:"Public: Read Only", readAndWrite:"Public: Read and Write"
|
||||||
|
|
|
@ -6,9 +6,8 @@ script(type='text/ng-template', id='supportModalTemplate')
|
||||||
ng-click="close()"
|
ng-click="close()"
|
||||||
) ×
|
) ×
|
||||||
h3 Contact Us
|
h3 Contact Us
|
||||||
.modal-body
|
.modal-body.contact-us-modal
|
||||||
span(ng-show="sent == false")
|
span(ng-show="sent == false")
|
||||||
.form-group
|
|
||||||
label
|
label
|
||||||
| Subject
|
| Subject
|
||||||
.form-group
|
.form-group
|
||||||
|
@ -16,7 +15,7 @@ script(type='text/ng-template', id='supportModalTemplate')
|
||||||
label.desc
|
label.desc
|
||||||
| Email
|
| Email
|
||||||
.form-group
|
.form-group
|
||||||
input.field.text.medium.span8.form-control(ng-model="form.email", type='email', spellcheck='false', value='', maxlength='255', tabindex='2')
|
input.field.text.medium.span8.form-control(ng-model="form.email", ng-init="form.email = '#{getUserEmail()}'", type='email', spellcheck='false', value='', maxlength='255', tabindex='2')
|
||||||
label#title12.desc
|
label#title12.desc
|
||||||
| Project URL (optional)
|
| Project URL (optional)
|
||||||
.form-group
|
.form-group
|
||||||
|
|
|
@ -82,8 +82,6 @@ html(itemscope, itemtype='http://schema.org/Product')
|
||||||
}
|
}
|
||||||
|
|
||||||
body
|
body
|
||||||
div(ng-controller="ContactModal")
|
|
||||||
a(ng-click="contactUsModal()") contact us
|
|
||||||
|
|
||||||
- if(typeof(suppressSystemMessages) == "undefined")
|
- if(typeof(suppressSystemMessages) == "undefined")
|
||||||
.system-messages(
|
.system-messages(
|
||||||
|
@ -130,11 +128,6 @@ html(itemscope, itemtype='http://schema.org/Product')
|
||||||
src=jsPath+'libs/require.js?fingerprint='+fingerprint(jsPath + 'libs/require.js')
|
src=jsPath+'libs/require.js?fingerprint='+fingerprint(jsPath + 'libs/require.js')
|
||||||
)
|
)
|
||||||
|
|
||||||
script(type='text/javascript').
|
|
||||||
(function() {var s=document.createElement('script'); s.type='text/javascript';s.async=true;
|
|
||||||
s.src=('https:'==document.location.protocol?'https':'http') + '://sharelatex-accounts.groovehq.com/widgets/f5ad3b09-7d99-431b-8af5-c5725e3760ce/ticket/api.js';
|
|
||||||
var q = document.getElementsByTagName('script')[0];q.parentNode.insertBefore(s, q);})();
|
|
||||||
|
|
||||||
include contact-us-modal
|
include contact-us-modal
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@ define [
|
||||||
)
|
)
|
||||||
|
|
||||||
App.controller 'SupportModalController', ($scope, $modal) ->
|
App.controller 'SupportModalController', ($scope, $modal) ->
|
||||||
|
|
||||||
$scope.form = {}
|
$scope.form = {}
|
||||||
$scope.sent = false
|
$scope.sent = false
|
||||||
$scope.sending = false
|
$scope.sending = false
|
||||||
|
@ -26,6 +25,7 @@ define [
|
||||||
message: $scope.form.message
|
message: $scope.form.message
|
||||||
subject: $scope.form.subject + " - [#{ticketNumber}]"
|
subject: $scope.form.subject + " - [#{ticketNumber}]"
|
||||||
about : $scope.form.project_url
|
about : $scope.form.project_url
|
||||||
|
labels: "support"
|
||||||
|
|
||||||
Groove.createTicket params, (err, json)->
|
Groove.createTicket params, (err, json)->
|
||||||
$scope.sent = true
|
$scope.sent = true
|
||||||
|
@ -36,8 +36,6 @@ define [
|
||||||
$modalInstance.close()
|
$modalInstance.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
App.controller 'UniverstiesContactController', ($scope, $modal) ->
|
App.controller 'UniverstiesContactController', ($scope, $modal) ->
|
||||||
|
|
||||||
$scope.form = {}
|
$scope.form = {}
|
||||||
|
@ -52,11 +50,10 @@ define [
|
||||||
params =
|
params =
|
||||||
name: $scope.form.name || $scope.form.email
|
name: $scope.form.name || $scope.form.email
|
||||||
email: $scope.form.email
|
email: $scope.form.email
|
||||||
labels: $scope.form.source
|
labels: "#{$scope.form.source} accounts"
|
||||||
message: "Please contact me with more details"
|
message: "Please contact me with more details"
|
||||||
subject: $scope.form.subject + " - [#{ticketNumber}]"
|
subject: $scope.form.subject + " - [#{ticketNumber}]"
|
||||||
about : "#{$scope.form.position || ''} #{$scope.form.university || ''}"
|
about : "#{$scope.form.position || ''} #{$scope.form.university || ''}"
|
||||||
to: "support@sharelatex.com"
|
|
||||||
|
|
||||||
Groove.createTicket params, (err, json)->
|
Groove.createTicket params, (err, json)->
|
||||||
$scope.sent = true
|
$scope.sent = true
|
||||||
|
|
84
services/web/public/js/libs/groove.js
Normal file
84
services/web/public/js/libs/groove.js
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
!function(window) {
|
||||||
|
|
||||||
|
window.Groove = {
|
||||||
|
|
||||||
|
init: function(options) {
|
||||||
|
this._options = options;
|
||||||
|
if (typeof grooveOnReady != 'undefined') {grooveOnReady();}
|
||||||
|
},
|
||||||
|
|
||||||
|
createTicket: function(params, callback) {
|
||||||
|
var postData = serialize({
|
||||||
|
"ticket[enduser_name]": params["name"],
|
||||||
|
"ticket[enduser_email]": params["email"],
|
||||||
|
"ticket[title]": params["subject"],
|
||||||
|
"ticket[enduser_about]": params["about"],
|
||||||
|
"ticket[label_string]": params["labels"],
|
||||||
|
"ticket[comments_attributes][0][body]": params["message"]
|
||||||
|
});
|
||||||
|
|
||||||
|
sendRequest(this._options.widget_ticket_url, function(req) {
|
||||||
|
if (callback) {callback(req);}
|
||||||
|
}, postData);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// http://www.quirksmode.org/js/xmlhttp.html
|
||||||
|
function sendRequest(url, callback, postData) {
|
||||||
|
var req = createXMLHTTPObject();
|
||||||
|
if (!req) return;
|
||||||
|
var method = (postData) ? "POST" : "GET";
|
||||||
|
req.open(method, url, true);
|
||||||
|
if (postData){
|
||||||
|
try {
|
||||||
|
req.setRequestHeader('Content-type','application/x-www-form-urlencoded');
|
||||||
|
}
|
||||||
|
catch(e) {
|
||||||
|
req.contentType = 'application/x-www-form-urlencoded';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
req.onreadystatechange = function () {
|
||||||
|
if (req.readyState != 4) return;
|
||||||
|
callback(req);
|
||||||
|
}
|
||||||
|
if (req.readyState == 4) return;
|
||||||
|
req.send(postData);
|
||||||
|
}
|
||||||
|
|
||||||
|
var XMLHttpFactories = [
|
||||||
|
function () {return new XDomainRequest()},
|
||||||
|
function () {return new XMLHttpRequest()},
|
||||||
|
function () {return new ActiveXObject("Msxml2.XMLHTTP")},
|
||||||
|
function () {return new ActiveXObject("Msxml3.XMLHTTP")},
|
||||||
|
function () {return new ActiveXObject("Microsoft.XMLHTTP")}
|
||||||
|
];
|
||||||
|
|
||||||
|
function createXMLHTTPObject() {
|
||||||
|
var xmlhttp = false;
|
||||||
|
for (var i = 0; i < XMLHttpFactories.length; i++) {
|
||||||
|
try {
|
||||||
|
xmlhttp = XMLHttpFactories[i]();
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return xmlhttp;
|
||||||
|
}
|
||||||
|
|
||||||
|
function serialize(obj) {
|
||||||
|
var str = [];
|
||||||
|
for(var p in obj) {
|
||||||
|
if (obj[p]) {
|
||||||
|
str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return str.join("&");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof grooveOnLoad != 'undefined') {grooveOnLoad();}
|
||||||
|
}(window);
|
||||||
|
|
||||||
|
Groove.init({"widget_ticket_url":"https://sharelatex-accounts.groovehq.com/widgets/f5ad3b09-7d99-431b-8af5-c5725e3760ce/ticket.json"});
|
||||||
|
|
6
services/web/public/stylesheets/app/contact-us.less
Normal file
6
services/web/public/stylesheets/app/contact-us.less
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
.contact-us-modal {
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
height: 120px;
|
||||||
|
}
|
||||||
|
}
|
|
@ -71,3 +71,4 @@
|
||||||
@import "app/templates.less";
|
@import "app/templates.less";
|
||||||
@import "app/wiki.less";
|
@import "app/wiki.less";
|
||||||
@import "app/translations.less";
|
@import "app/translations.less";
|
||||||
|
@import "app/contact-us.less";
|
||||||
|
|
Loading…
Reference in a new issue