Skip to content

Commit c02d9d2

Browse files
authored
Merge pull request pytorch#681 from shiftlab/pyt-580-salesforce-form
[PYT-580] Integrate functioning Salesforce sign up on Contributors page
2 parents e874f51 + 5829f6c commit c02d9d2

File tree

2 files changed

+102
-46
lines changed

2 files changed

+102
-46
lines changed

_sass/contributors.scss

+59-27
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@
219219
}
220220

221221
.content-left {
222+
flex: 60%;
222223
padding-top: 76px;
223224

224225
@include desktop {
@@ -228,9 +229,25 @@
228229
h2 {
229230
color: $orange;
230231
}
232+
233+
.contributor-consent-check {
234+
max-width: 400px;
235+
}
236+
237+
.email-consent {
238+
color: $mid_gray;
239+
font-size: 14px;
240+
}
241+
242+
.please-accept-terms {
243+
display: none;
244+
color: $orange;
245+
font-size: 14px;
246+
}
231247
}
232248

233249
.content-right {
250+
flex: 40%;
234251
padding-top: 76px;
235252

236253
h2 {
@@ -239,47 +256,62 @@
239256
}
240257

241258
.contributor-form {
242-
display: flex;
243259
margin: -8px 0 47px 0;
244260

245-
.form-success {
261+
.form-success,
262+
.form-fail {
246263
color: $orange;
247264
display: none;
248-
margin: -6px 0 0 0;
265+
flex: none;
266+
margin: 8px 0 12px 0;
249267
}
250268

251269
form {
252-
display: flex;
253270
width: 100%;
254-
255-
input[type="email"] {
256-
border: 1px solid darken($color: #f3f3f3, $amount: 5);
257-
border-radius: 4px;
258-
flex: 1 70%;
259-
padding: 5px 8px 5px 8px;
260-
margin-right: 10px;
271+
272+
.contributor-form-ui {
273+
display: flex;
274+
max-width: 390px;
275+
flex-wrap: wrap;
261276

262-
&::placeholder {
263-
color: darken($color: #f3f3f3, $amount: 20);
264-
}
277+
input[type="text"] {
278+
border: 1px solid darken($color: #f3f3f3, $amount: 5);
279+
border-radius: 4px;
280+
flex: 1 70%;
281+
padding: 5px 8px 5px 8px;
282+
margin-right: 10px;
265283

266-
&:focus {
267-
border: 1px solid $orange;
284+
&::placeholder {
285+
color: darken($color: #f3f3f3, $amount: 20);
286+
}
287+
288+
&:focus {
289+
border: 1px solid $orange;
290+
}
268291
}
269-
}
270292

271-
input[type="submit"] {
272-
background: darken($color: #f3f3f3, $amount: 5);
273-
border: none;
274-
border-radius: 4px;
275-
color: #6d6d6d;
276-
277-
&:hover {
278-
background: darken($color: #f3f3f3, $amount: 20);
279-
color: darken($color: #6d6d6d, $amount: 20);
293+
input[type="submit"] {
294+
background: darken($color: #f3f3f3, $amount: 5);
295+
border: none;
296+
border-radius: 4px;
297+
color: #6d6d6d;
298+
299+
&:hover {
300+
background: darken($color: #f3f3f3, $amount: 20);
301+
color: darken($color: #6d6d6d, $amount: 20);
302+
}
280303
}
281304
}
282305
}
306+
307+
input[type="checkbox"] {
308+
margin: 1px 6px 0 0;
309+
}
310+
311+
.contributor-consent-check {
312+
color: $mid_gray;
313+
margin-top: 1rem;
314+
}
283315
}
284316

285317
.contributors-button {
@@ -301,7 +333,7 @@
301333
a {
302334
color: $dark_grey;
303335
}
304-
336+
305337
@include animated_border_hover_state;
306338
}
307339
}

ecosystem/contributors.html

+43-19
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,33 @@ <h2 class="lead">The central place for PyTorch contributors to stay up-to-date w
3939
<div class="content-left">
4040
<h2>Newsletter Sign Up</h2>
4141
<p>Follow the contributors newsletter for curated news from across the PyTorch developer community</p>
42-
<a id="subscribe" class="contributors-button" href="https://forms.gle/1Edh9z6ExzJSGAiS6">Subscribe</a>
42+
<div class="contributor-form">
43+
<form action="https://cl.s10.exct.net/DEManager.aspx" name="subscribeForm" method="post">
44+
<input type="hidden" name="_clientID" value="515009167">
45+
<input type="hidden" name="_deExternalKey" value="BBAD707C-57C6-46F4-9701-D24E5550FB79">
46+
<input type="hidden" name="_action" value="add">
47+
<input type="hidden" name="_returnXML" value="0">
48+
<input type="hidden" name="_successURL" value="https://pytorch.org/resources/contributors?signUp=success">
49+
<input type="hidden" name="_errorURL" value="https://pytorch.org/resources/contributors?signUp=fail">
50+
<div class="contributor-form-ui">
51+
<input type="text" name="Email Address">
52+
<input type="submit" value="Submit">
53+
</div>
54+
<div class="contributor-consent-check">
55+
<input type="checkbox" id="agree" oninvalid="this.setCustomValidity('')" required>
56+
<label for="agree">
57+
<span>I accept the terms and conditions below</span>
58+
</label>
59+
</div>
60+
</form>
61+
<p class="form-success">Thanks! You are now subscribed to the PyTorch Contributors Newsletter.</p>
62+
<p class="form-fail">There was an error submitting your email address. Please try again.</p>
63+
<p class="please-accept-terms">Please accept the terms and conditions below</p>
64+
</div>
65+
<p class="email-consent">
66+
By submitting your email, you agree to receive technical updates and marketing-related electronic communications from Facebook Inc, and its affiliated businesses, including news, events, and updates.
67+
You may withdraw your consent and unsubscribe from these at any time, for example, by clicking the unsubscribe link included on our emails. For more information about how Facebook handles your data, please read our <a href="https://pytorch.org/assets/tos-oss-privacy-policy/fb-oss-privacy-policy.pdf">Data Policy</a>
68+
</p>
4369
<a id="issue-toggle" class="contributors-button" href="#pytorch-1">View Issues</a>
4470
</div>
4571

@@ -57,34 +83,32 @@ <h2>Join the conversation</h2>
5783
<script type="text/javascript">
5884
$("#past-issues, #issue-toggle" ).on("click", function() {
5985
$(".hidden").show();
60-
$(".marketo-contain").hide();
6186
$("#sign-up").removeClass("nav-select");
6287
$("#past-issues").addClass("nav-select");
6388
})
6489

6590
$("#sign-up").on("click", function() {
6691
$(".hidden").hide();
67-
$(".marketo-contain").show();
6892
$("#past-issues").removeClass("nav-select");
6993
$(this).addClass("nav-select");
7094
});
7195

72-
$( "#mc-embedded-subscribe-form").submit(function( event ) {
73-
event.preventDefault();
74-
});
96+
var urlParams = new URLSearchParams(window.location.search);
97+
var paramValue = urlParams.has('signUp') ? urlParams.get('signUp') : null;
98+
99+
if (paramValue == 'success') {
100+
$(".form-fail").hide();
101+
$(".form-success").show();
102+
} else if (paramValue == 'fail') {
103+
$(".form-success").hide();
104+
$(".form-fail").show();
105+
}
75106

76-
$("#mc-embedded-subscribe").on("click", function() {
77-
if ($("#mce-EMAIL").val()) {
78-
$.ajax({
79-
type: "POST",
80-
crossDomain: true,
81-
url: "https://shiftlab.us1.list-manage.com/subscribe/post?u=450bf01a83b20e12a0affdd10&amp;id=10b00504eb",
82-
data: $("#mc-embedded-subscribe-form").serialize()
83-
});
84-
$("#mc-embedded-subscribe-form").hide();
85-
$(".form-success").show();
86-
} else {
87-
alert("Please enter a valid email address.");
107+
$('input[type=submit]').on("click", function(e) {
108+
var checked = $('input[type=checkbox]').prop('checked');
109+
if (!checked) {
110+
$(".please-accept-terms").show().fadeOut(4000);
111+
e.preventDefault();
88112
}
89-
})
113+
});
90114
</script>

0 commit comments

Comments
 (0)