Skip to content

Commit c9be9e4

Browse files
author
Philip Guo
committed
hide 'Edit code' link if editCodeBaseURL is null
1 parent ac2ee6f commit c9be9e4

3 files changed

Lines changed: 5 additions & 3 deletions

File tree

v3/css/pytutor.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ div.ExecutionVisualizer div#heapHeader {
470470

471471
div.ExecutionVisualizer #executionSlider {
472472
width: 500px;
473-
margin-top: 15px;
473+
margin-top: 20px;
474474
margin-bottom: 5px;
475475

476476
margin-left: auto;

v3/js/opt-frontend.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ $(document).ready(function() {
105105
// jsPlumb connectors won't render properly
106106
myVisualizer.updateOutput();
107107

108-
// customize edit button click functionality AFTER rendering (TODO: awkward!)
108+
// customize edit button click functionality AFTER rendering (NB: awkward!)
109+
$('#pyOutputPane #editCodeLinkDiv').show();
109110
$('#pyOutputPane #editBtn').click(function() {
110111
enterEditMode();
111112
});

v3/js/pytutor.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ var curVisualizerID = 1; // global to uniquely identify each ExecutionVisualizer
7171
// hideOutput - hide "Program output" display
7272
// codeDivHeight - maximum height of #pyCodeOutputDiv (in integer pixels)
7373
// codeDivWidth - maximum width of #pyCodeOutputDiv (in integer pixels)
74-
// editCodeBaseURL - the base URL to visit when the user clicks 'Edit code'
74+
// editCodeBaseURL - the base URL to visit when the user clicks 'Edit code' (if null, then 'Edit code' link hidden)
7575
// embeddedMode - make the widget narrower horizontally and disable breakpoints
7676
// updateOutputCallback - function to call (with 'this' as parameter)
7777
// whenever this.updateOutput() is called
@@ -252,6 +252,7 @@ ExecutionVisualizer.prototype.render = function() {
252252
this.domRoot.find('#editBtn').attr('href', urlStr);
253253
}
254254
else {
255+
this.domRoot.find('#editCodeLinkDiv').hide(); // just hide for simplicity!
255256
this.domRoot.find('#editBtn').attr('href', "#");
256257
this.domRoot.find('#editBtn').click(function(){return false;}); // DISABLE the link!
257258
}

0 commit comments

Comments
 (0)