mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-19 12:16:22 +00:00
[website] added supporters infrastructure.
This commit is contained in:
1 parent
cc55391a75
commit
2f1a26b606
13 files changed
+357
-65
No files matched your search
Binary file not shown.
@@ -7,6 +7,68 @@
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
.buttonLike {
|
||||
cursor: pointer;
|
||||
background: -webkit-linear-gradient(top, #FFFEF7, #CFCEC7);
|
||||
background: -moz-linear-gradient(top, #FFFEF7, #CFCEC7);
|
||||
background: -o-linear-gradient(#FFFEF7, #CFCEC7);
|
||||
background: -ms-linear-gradient(#FFFEF7, #CFCEC7);
|
||||
background: linear-gradient(top, #FFFEF7, #CFCEC7);
|
||||
line-height: 1;
|
||||
padding: 3px 10px;
|
||||
border: 1px solid black;
|
||||
position: relative;
|
||||
overflow: visible;
|
||||
color: black;
|
||||
margin: 2px;
|
||||
border-radius: 5px;
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.orderButton {
|
||||
width: 280px;
|
||||
}
|
||||
|
||||
.formErr {
|
||||
color: #FF7777;
|
||||
}
|
||||
|
||||
.order-license #deleteCompanyLogo {
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.formSubmitFail {
|
||||
color: #FF6666;
|
||||
font-size: 1.2em;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.order-license .btn-primary {
|
||||
float: left;
|
||||
margin-right: 20px;
|
||||
background: -webkit-linear-gradient(#1725e0, #0923df 6%, #0b21ce);
|
||||
background: -o-linear-gradient(#1725e0, #0923df 6%, #0b21ce);
|
||||
background: -webkit-gradient(linear, left top, left bottom, from(#1725e0), color-stop(6%, #0923df), to(#0b21ce));
|
||||
background: linear-gradient(#1725e0, #0923df 6%, #0b21ce);
|
||||
background-repeat: no-repeat;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff1725e0', endColorstr='#ff0b21ce', GradientType=0);
|
||||
-webkit-filter: none;
|
||||
filter: none;
|
||||
border: 1px solid #091bac;
|
||||
}
|
||||
|
||||
#onlyYearlyWarning {
|
||||
font-size: 0.8em;
|
||||
padding-left: 16px;
|
||||
}
|
||||
|
||||
.deemphasize {
|
||||
color: #AAAAAA;
|
||||
font-size: 0.8em;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.supporterBar .introText {
|
||||
margin-top: 16px;
|
||||
}
|
||||
@@ -24,6 +86,10 @@
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.supporters .supportItem {
|
||||
margin: 6px 10px;
|
||||
}
|
||||
|
||||
.supporterBar {
|
||||
width: 100%;
|
||||
margin-left: auto;
|
||||
@@ -53,11 +119,6 @@
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
.legalese {
|
||||
font-style: italic;
|
||||
font-size: 0.8em;
|
||||
}
|
||||
|
||||
#companyLogo {
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
@@ -1,21 +1,140 @@
|
||||
"use strict";
|
||||
|
||||
(function() {
|
||||
if (!String.prototype.trim) {
|
||||
String.prototype.trim = function () {
|
||||
return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
||||
};
|
||||
}
|
||||
|
||||
var imgDataUrl = null;
|
||||
|
||||
function updateLocationInfo() {
|
||||
var locationType = $("input:radio[name='locationType']:checked").val();
|
||||
$("#locationType_usa").toggle(locationType === "usa");
|
||||
$("#locationType_eu").toggle(locationType === "eu");
|
||||
$("#locationType_other").toggle(locationType === "other");
|
||||
$("#paymentMethod_iban").toggle(locationType === "eu");
|
||||
if ($("#paymentMethod_iban input").is(":checked") && locationType !== "eu") $("#paymentMethod_payoneer input").prop("checked", true);
|
||||
if ($("#paymentMethod_intl input").is(":checked") && locationType === "eu") $("#paymentMethod_iban input").prop("checked", true);
|
||||
$("#paymentMethod_intl").toggle(locationType !== "eu");
|
||||
}
|
||||
|
||||
function updatePriceIndication() {
|
||||
$("#onlyYearlyWarning").hide();
|
||||
var x = getPriceIndication();
|
||||
if (x === "") {
|
||||
$("#costIndicator").text("").hide();
|
||||
} else {
|
||||
$("#costIndicator").text(x).show();
|
||||
}
|
||||
}
|
||||
|
||||
function getPriceIndication() {
|
||||
try {
|
||||
var seats = parseInt($("#seats").val());
|
||||
if (isNaN(seats)) return "";
|
||||
var licenseType = $("input:radio[name='licenseType']:checked").val();
|
||||
var costPer;
|
||||
if (licenseType === "enterprise") costPer = 5;
|
||||
else if (licenseType === "professional") costPer = 2;
|
||||
else return "";
|
||||
var periodRaw = $("input:radio[name='paymentType']:checked").val();
|
||||
if (periodRaw === "monthly") {
|
||||
if (costPer*seats < 50) {
|
||||
$("#onlyYearlyWarning").show();
|
||||
return "Your license will cost €" + (costPer*seats*12) + ",- per year.";
|
||||
}
|
||||
return "Your license will cost €" + (costPer*seats) + ",- per month.";
|
||||
}
|
||||
return "Your license will cost €" + (costPer*seats*12) + ",- per year.";
|
||||
} catch (e) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
function showError(elemName) {
|
||||
var elem = $("#" + elemName + "Err");
|
||||
elem.fadeIn();
|
||||
$("#" + elemName).on("change keyup", function() {
|
||||
elem.hide();
|
||||
});
|
||||
}
|
||||
|
||||
function applyLicense() {
|
||||
$("#submit").on("click", function(evt) {
|
||||
var submitButton = $("#submit");
|
||||
var spinner = $("<img>").attr("src", "/img/spinner.gif").attr("alt", "submitting").css("float", "left").css("margin-right", "20px");
|
||||
|
||||
submitButton.on("click", function(evt) {
|
||||
evt.preventDefault();
|
||||
|
||||
var onSuccess = function() {
|
||||
alert("Form submitted!");
|
||||
$("#orderHelp").hide();
|
||||
var okMsg = $("<div>").addClass("formSubmitOk").html("Thank you for ordering a Project Lombok license! We'll send your bill via email. If you have any further questions please contact us at <a href=\"mailto:orders@projectlombok.org\"><code>orders@projectlombok.org</code></a>.");
|
||||
spinner.replaceWith(okMsg);
|
||||
};
|
||||
|
||||
var onFailure = function() {
|
||||
alert("Whoops");
|
||||
$("#orderHelp").hide();
|
||||
var errMsg = $("<div>").addClass("formSubmitFail").html("Our order form appears to be broken. Could you do us a favour and contact us at <a href=\"mailto:orders@projectlombok.org\"><code>orders@projectlombok.org</code></a>? Thank you!");
|
||||
spinner.replaceWith(errMsg);
|
||||
};
|
||||
|
||||
var data = {};
|
||||
data.name = $("#name").val();
|
||||
data.name = $("#companyName").val();
|
||||
data.email = $("#email").val();
|
||||
data.licenseType = $("input:radio[name='licenseType']:checked").val();
|
||||
data.seats = parseInt($("#seats").val());
|
||||
data.paymentType = $("input:radio[name='paymentType']:checked").val();
|
||||
data.mentionMe = $("#mentionMe").prop("checked");
|
||||
data.companyUrl = $("#companyUrl").val();
|
||||
data.locationType = $("input:radio[name='locationType']:checked").val();
|
||||
data.euVat = $("#euVat").val();
|
||||
data.paymentMethod = $("input:radio[name='paymentMethod']:checked").val();
|
||||
|
||||
var formFail = false;
|
||||
|
||||
if (!data.paymentMethod) {
|
||||
showError("paymentMethod");
|
||||
formFail = true;
|
||||
}
|
||||
|
||||
if (!data.euVat && data.locationType === 'eu') {
|
||||
$("#euVat").focus();
|
||||
showError("euVat");
|
||||
formFail = true;
|
||||
}
|
||||
|
||||
if (!data.locationType) {
|
||||
showError("locationType");
|
||||
formFail = true;
|
||||
}
|
||||
|
||||
if (!data.seats || isNaN(data.seats)) {
|
||||
$("#seats").focus();
|
||||
showError("seats");
|
||||
formFail = true;
|
||||
}
|
||||
|
||||
if (!data.paymentType) {
|
||||
showError("paymentType");
|
||||
formFail = true;
|
||||
}
|
||||
|
||||
if (data.email.indexOf('@') === -1) {
|
||||
$("#email").focus();
|
||||
showError("email");
|
||||
formFail = true;
|
||||
}
|
||||
|
||||
if (data.name.trim().length < 1) {
|
||||
$("#companyName").focus();
|
||||
showError("companyName");
|
||||
formFail = true;
|
||||
}
|
||||
|
||||
if (formFail) return;
|
||||
|
||||
var rnd = generateRandom();
|
||||
var err = processImageUpload();
|
||||
if (err) {
|
||||
@@ -24,6 +143,9 @@
|
||||
return;
|
||||
}
|
||||
if (imgDataUrl) data.logo = imgDataUrl;
|
||||
|
||||
submitButton.replaceWith(spinner);
|
||||
|
||||
$.ajax({
|
||||
url: "/license-submit/" + rnd,
|
||||
method: "PUT",
|
||||
@@ -31,7 +153,7 @@
|
||||
data: JSON.stringify(data),
|
||||
processData: false,
|
||||
success: onSuccess,
|
||||
failure: onFailure
|
||||
error: onFailure
|
||||
});
|
||||
});
|
||||
|
||||
@@ -58,6 +180,13 @@
|
||||
$("#deleteCompanyLogo").show();
|
||||
}
|
||||
});
|
||||
|
||||
$("#seats,.paymentType,.licenseType").on("change keyup", function() {
|
||||
updatePriceIndication();
|
||||
});
|
||||
$(".locationType").on("change", function() {
|
||||
updateLocationInfo();
|
||||
});
|
||||
}
|
||||
|
||||
function generateRandom() {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
(function($) {
|
||||
var supporters = {};
|
||||
var weights = {};
|
||||
var types = ["patron", "professional", "enterprise"];
|
||||
var types = ["enterprise", "professional", "patron"];
|
||||
|
||||
function shuffle(array) {
|
||||
var i = 0, j = 0, temp = null;
|
||||
@@ -49,7 +49,7 @@
|
||||
var d = $("<div />").addClass("supportItem").addClass(this.type);
|
||||
var a = d;
|
||||
if (this.url) {
|
||||
a = $("<a />").attr("href", this.url).attr("rel", "noopener");
|
||||
a = $("<a />").attr("href", this.url).attr("rel", "noopener").attr("target", "_blank");
|
||||
d.append(a);
|
||||
}
|
||||
var n = $("<span />").text(this.name);
|
||||
@@ -69,8 +69,13 @@
|
||||
var ht = Math.round(h / f);
|
||||
i.width = wt;
|
||||
i.height = ht;
|
||||
var ji = $(i);
|
||||
if (!showName) a.empty();
|
||||
a.prepend(i);
|
||||
ji.css("width", wt + "px");
|
||||
ji.css("height", ht + "px");
|
||||
ji.attr("alt", n);
|
||||
ji.attr("title", n);
|
||||
a.prepend(ji);
|
||||
};
|
||||
i.src = 'files/' + this.logo;
|
||||
}
|
||||
@@ -129,6 +134,8 @@
|
||||
var s = $(".supporterBar");
|
||||
s.find(".introText").show();
|
||||
s.append($("<div />").addClass("sbCnt"));
|
||||
var sf = s.find(".supporterFooter").show();
|
||||
s.append(sf);
|
||||
s = s.find(".sbCnt");
|
||||
var now = new Date();
|
||||
var list = [];
|
||||
|
||||
Reference in new issue
Block a user