mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-22 09:57:02 +00:00
Merge branch 'ho-remove-groove'
This commit is contained in:
commit
ec41f984e6
4 changed files with 19 additions and 95 deletions
services/web
|
@ -210,7 +210,7 @@ block content
|
|||
h3 #{translate("group_plan_enquiry")}
|
||||
.modal-body
|
||||
form.text-left.form(ng-controller="UniverstiesContactController", ng-submit="contactUs()", ng-cloak)
|
||||
span(ng-show="sent == false")
|
||||
span(ng-show="sent == false && error == false")
|
||||
.form-group
|
||||
label#title9(for='Field9')
|
||||
| Name
|
||||
|
@ -228,11 +228,13 @@ block content
|
|||
.form-group
|
||||
input#Field13.field.text.medium.span8.form-control(ng-model="form.position", name='Field13', type='text', value='', maxlength='255', tabindex='4', onkeyup='')
|
||||
.form-group
|
||||
input(ng-model="form.source", type="hidden", ng-init="form.source = '__ref__'; form.subject = 'ShareLaTeX for Universities';")
|
||||
input(ng-model="form.source", type="hidden", ng-init="form.source = '__ref__'; form.subject = 'General enquiry for larger ShareLaTeX use';")
|
||||
.form-group.text-center
|
||||
input#saveForm.btn-success.btn.btn-lg(name='saveForm', type='submit', ng-disabled="sending", value='Request a quote')
|
||||
span(ng-show="sent")
|
||||
span(ng-show="sent == true && error == false")
|
||||
p Request Sent, Thank you.
|
||||
span(ng-show="error")
|
||||
p Error sending request.
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
|
|
|
@ -9,7 +9,6 @@ define [
|
|||
"libs/angular-cookie"
|
||||
"libs/passfield"
|
||||
"libs/sixpack"
|
||||
"libs/groove"
|
||||
"libs/angular-sixpack"
|
||||
"libs/ng-tags-input-3.0.0"
|
||||
], () ->
|
||||
|
|
|
@ -74,27 +74,34 @@ define [
|
|||
$modalInstance.close()
|
||||
|
||||
|
||||
App.controller 'UniverstiesContactController', ($scope, $modal) ->
|
||||
App.controller 'UniverstiesContactController', ($scope, $modal, $http) ->
|
||||
|
||||
$scope.form = {}
|
||||
$scope.sent = false
|
||||
$scope.sending = false
|
||||
$scope.error = false
|
||||
$scope.contactUs = ->
|
||||
if !$scope.form.email?
|
||||
console.log "email not set"
|
||||
return
|
||||
$scope.sending = true
|
||||
ticketNumber = Math.floor((1 + Math.random()) * 0x10000).toString(32)
|
||||
params =
|
||||
data =
|
||||
_csrf : window.csrfToken
|
||||
name: $scope.form.name || $scope.form.email
|
||||
email: $scope.form.email
|
||||
labels: "#{$scope.form.source} accounts"
|
||||
message: "Please contact me with more details"
|
||||
subject: $scope.form.subject + " - [#{ticketNumber}]"
|
||||
about : "#{$scope.form.position || ''} #{$scope.form.university || ''}"
|
||||
subject: "#{$scope.form.name} - General Enquiry - #{$scope.form.position} - #{$scope.form.university}"
|
||||
inbox: "accounts"
|
||||
|
||||
Groove.createTicket params, (err, json)->
|
||||
$scope.sent = true
|
||||
request = $http.post "/support", data
|
||||
|
||||
request.catch ()->
|
||||
$scope.error = true
|
||||
$scope.$apply()
|
||||
|
||||
|
||||
request.then (response)->
|
||||
$scope.sent = true
|
||||
$scope.error = (response.status != 200)
|
||||
$scope.$apply()
|
||||
|
|
|
@ -1,84 +0,0 @@
|
|||
!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"});
|
||||
|
Loading…
Add table
Reference in a new issue