Skip to content

Commit 9290c15

Browse files
committed
Merge pull request code-dot-org#685 from code-dot-org/shapeways_disclaimer
Update Shapeways button flow
2 parents 70129f6 + 618704a commit 9290c15

File tree

4 files changed

+39
-3
lines changed

4 files changed

+39
-3
lines changed

blockly/src/feedback.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,12 +507,21 @@ exports.createSharingDiv = function(options) {
507507
});
508508
}
509509

510-
// SMS-to-phone feature
510+
var sharingShapeways = sharingDiv.querySelector('#sharing-shapeways');
511+
if (sharingShapeways) {
512+
dom.addClickTouchEvent(sharingShapeways, function() {
513+
$('#send-to-phone').hide();
514+
$('#shapeways-message').toggle();
515+
});
516+
}
517+
518+
// SMS-to-phone feature
511519
var sharingPhone = sharingDiv.querySelector('#sharing-phone');
512520
if (sharingPhone && options.sendToPhone) {
513521
dom.addClickTouchEvent(sharingPhone, function() {
514522
var sendToPhone = sharingDiv.querySelector('#send-to-phone');
515523
if ($(sendToPhone).is(':hidden')) {
524+
$('#shapeways-message').hide();
516525
sendToPhone.setAttribute('style', 'display:inline-block');
517526
var phone = $(sharingDiv.querySelector("#phone"));
518527
var submitted = false;

blockly/src/templates/sharing.html.ejs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@
4949
<img src='<%= BlocklyApps.assetUrl("media/phone_purple.png") %>' />
5050
</a>
5151
<% } -%>
52-
<% if (options.level.shapewaysUrl) { -%>
53-
<a href='<%= options.level.shapewaysUrl %>' target="_blank">
52+
<% if (options.level.shapewaysUrl && !options.onMainPage && options.sendToPhone) { -%>
53+
<a id="sharing-shapeways" href="" onClick="return false;">
5454
<img src='<%= BlocklyApps.assetUrl("media/shapeways_purple.png") %>' />
5555
</a>
5656
<% } -%>
@@ -63,3 +63,10 @@
6363
<button id="phone-submit" onClick="return false;">Send</button>
6464
<div id="phone-charges">A text message will be sent via <a href="http://twilio.com">Twilio</a>. Charges may apply to the recipient.</div>
6565
</div>
66+
<% if (options.response && options.response.level_source && options.level.shapewaysUrl) { -%>
67+
<div id="shapeways-message" class="sharing" style="display: none">
68+
<div id="shapeways-message-body">You'll be redirected to Shapeways.com to order and purchase a 3D print.</div>
69+
<button id="shapeways-print-go-button" onclick="location.href='<%= options.level.shapewaysUrl %>'">Go to Shapeways</button>
70+
<div id="shapeways-message-body-disclaimer">Students under 13 years need a parent or guardian to do 3D printing.</div>
71+
</div>
72+
<% } -%>

blockly/static/shapeways_purple.png

-9.01 KB
Loading

blockly/style/common.scss

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,26 @@ $modal-image-margin-gap: 10px;
853853
text-align: center;
854854
}
855855

856+
#shapeways-print-go-button {
857+
margin-bottom: 10px;
858+
}
859+
860+
#shapeways-message-body {
861+
font-size: 15px;
862+
margin-bottom: 7px;
863+
line-height: 26px;
864+
}
865+
866+
#shapeways-message-body-disclaimer {
867+
font-size: 11px;
868+
margin-bottom: -11px;
869+
}
870+
871+
#shapeways-message {
872+
display: block;
873+
text-align: center;
874+
}
875+
856876
.modal-image {
857877
width: $modal-image-width;
858878
height: auto;

0 commit comments

Comments
 (0)